Retrieving Refund Details
Function: refund_details()
Purpose
This function retrieves the details of a specific refund by using its unique refund ID. It provides full information about the refund, including its status, amount, payment method, credit note reference, and metadata.
Parameters
Parameter | Type | Description |
---|---|---|
refund_id | String | Unique identifier of the refund to be retrieved. |
Use Case
The function is used to fetch and verify refund information for financial reconciliation or customer service purposes. It allows businesses to confirm refund status, check refunded amounts, validate payment methods, and track audit details such as who created or updated the refund record.
def refund_details():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = exsited_sdk.refund.details(id="REFUND_ID")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testReadDetails()
{
$id = 'REFUND_ID';
try {
$response = $this->refundService->readDetails($id,'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The endpoint response returns complete refund details, including refund status, refund ID, amount, payment method, processor, related credit note, custom attributes, and version information. It also provides audit details such as who created and last updated the record, timestamps, and the unique UUID of the refund.
RefundDetailsDTO(
refund=RefundDataDTO(
status='STATUS',
id='REFUND_ID',
amount='NUMBER',
reference='REFUND_REFERENCE',
note='REFUND_NOTE',
paymentMethod='PAYMENT_METHOD',
paymentProcessor='PAYMENT_PROCESSOR',
gatewayResponse='EMPTY',
creditNoteId='CREDIT_NOTE_ID',
customAttributes=[
CustomAttributesDTO(
name='ATTRIBUTE_NAME',
value='EMPTY'
)
],
version='VERSION',
createdBy='CREATED_BY',
createdOn='TIMESTAMP',
lastUpdatedBy='UPDATED_BY',
lastUpdatedOn='TIMESTAMP',
uuid='UUID',
date='NULL'
)
)
{
"refund": {
"status": "STATUS",
"id": "REFUND_ID",
"amount": "NUMBER",
"reference": "REFUND_REFERENCE",
"note": "REFUND_NOTE",
"payment_method": "PAYMENT_METHOD",
"payment_processor": "PAYMENT_PROCESSOR",
"gateway_response": "EMPTY",
"credit_note_id": "CREDIT_NOTE_ID",
"custom_attributes": [
{
"name": "ATTRIBUTE_NAME",
"value": "EMPTY"
}
],
"version": "VERSION",
"created_by": "CREATED_BY",
"created_on": "TIMESTAMP",
"last_updated_by": "UPDATED_BY",
"last_updated_on": "TIMESTAMP",
"uuid": "UUID"
}
}
Retrieving refund list of a particular account
Function : account_refund_list()
Purpose
This function retrieves the list of refunds associated with a specific account. It provides detailed information about each refund, including status, amount, payment method, linked credit notes, and audit details. The response also includes pagination data for navigating large result sets.
Parameters
Attribute | Type | Description |
---|---|---|
account_id | String | Unique identifier of the account for which refunds are retrieved. |
Use Case
The function is used to fetch and review all refunds processed for a given account. It helps finance or support teams track refund transactions, verify refund details (such as method, processor, and credit note linkage), and manage historical refund records with proper pagination.
def account_refund_list():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = exsited_sdk.refund.account_refund_list(id="REFUND_ID")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testReadAccountRefunds()
{
$accountId = 'ACCOUNT_ID';
try {
$response = $this->refundService->readAccountRefunds($accountId,'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The API endpoint response includes a list of refund records with details such as refund status, ID, amount, payment information, credit note association, audit trail, and custom attributes. It also provides pagination details to navigate through refund records.
AccountRefundListDTO(
account=RefundListDTO(
refunds=[
RefundDataDTO(
status='STATUS',
id='REFUND_ID',
amount='NUMBER',
reference='EMPTY',
note='EMPTY',
paymentMethod='PAYMENT_METHOD',
paymentProcessor='PAYMENT_PROCESSOR',
gatewayResponse='EMPTY',
creditNoteId='CREDIT_NOTE_ID',
customAttributes=[
CustomAttributesDTO(
name='ATTRIBUTE_NAME',
value='EMPTY'
)
],
version='VERSION',
createdBy='CREATED_BY',
createdOn='TIMESTAMP',
lastUpdatedBy='EMPTY',
lastUpdatedOn='TIMESTAMP',
uuid='UUID',
date='NULL'
),
RefundDataDTO(
status='STATUS',
id='REFUND_ID',
amount='NUMBER',
reference='EMPTY',
note='REFUND_NOTE',
paymentMethod='PAYMENT_METHOD',
paymentProcessor='PAYMENT_PROCESSOR',
gatewayResponse='EMPTY',
creditNoteId='CREDIT_NOTE_ID',
customAttributes=[
CustomAttributesDTO(
name='ATTRIBUTE_NAME',
value='EMPTY'
)
],
version='VERSION',
createdBy='CREATED_BY',
createdOn='TIMESTAMP',
lastUpdatedBy='UPDATED_BY',
lastUpdatedOn='TIMESTAMP',
uuid='UUID',
date='NULL'
),
RefundDataDTO(
status='STATUS',
id='REFUND_ID',
amount='NUMBER',
reference='EMPTY',
note='REFUND_NOTE',
paymentMethod='PAYMENT_METHOD',
paymentProcessor='PAYMENT_PROCESSOR',
gatewayResponse='EMPTY',
creditNoteId='CREDIT_NOTE_ID',
customAttributes=[
CustomAttributesDTO(
name='ATTRIBUTE_NAME',
value='EMPTY'
)
],
version='VERSION',
createdBy='CREATED_BY',
createdOn='TIMESTAMP',
lastUpdatedBy='UPDATED_BY',
lastUpdatedOn='TIMESTAMP',
uuid='UUID',
date='NULL'
),
RefundDataDTO(
status='STATUS',
id='REFUND_ID',
amount='NUMBER',
reference='EMPTY',
note='REFUND_NOTE',
paymentMethod='PAYMENT_METHOD',
paymentProcessor='PAYMENT_PROCESSOR',
gatewayResponse='EMPTY',
creditNoteId='CREDIT_NOTE_ID',
customAttributes=[
CustomAttributesDTO(
name='ATTRIBUTE_NAME',
value='EMPTY'
)
],
version='VERSION',
createdBy='CREATED_BY',
createdOn='TIMESTAMP',
lastUpdatedBy='UPDATED_BY',
lastUpdatedOn='TIMESTAMP',
uuid='UUID',
date='NULL'
),
RefundDataDTO(
status='STATUS',
id='REFUND_ID',
amount='NUMBER',
reference='EMPTY',
note='REFUND_NOTE',
paymentMethod='PAYMENT_METHOD',
paymentProcessor='PAYMENT_PROCESSOR',
gatewayResponse='EMPTY',
creditNoteId='CREDIT_NOTE_ID',
customAttributes=[
CustomAttributesDTO(
name='ATTRIBUTE_NAME',
value='EMPTY'
)
],
version='VERSION',
createdBy='CREATED_BY',
createdOn='TIMESTAMP',
lastUpdatedBy='UPDATED_BY',
lastUpdatedOn='TIMESTAMP',
uuid='UUID',
date='NULL'
)
],
pagination=PaginationDTO(
records=NUMBER,
limit=NUMBER,
offset=NUMBER,
previousPage='EMPTY',
nextPage='NULL'
)
)
)
{
"account": {
"refunds": [
{
"status": "STATUS",
"id": "REFUND_ID",
"amount": "NUMBER",
"reference": "EMPTY",
"note": "REFUND_NOTE",
"payment_method": "PAYMENT_METHOD",
"payment_processor": "PAYMENT_PROCESSOR",
"gateway_response": "EMPTY",
"credit_note_id": "CREDIT_NOTE_ID",
"custom_attributes": [
{
"name": "ATTRIBUTE_NAME",
"value": "EMPTY"
}
],
"version": "VERSION",
"created_by": "CREATED_BY",
"created_on": "TIMESTAMP",
"last_updated_by": "UPDATED_BY",
"last_updated_on": "TIMESTAMP",
"uuid": "UUID"
},
{
"status": "STATUS",
"id": "REFUND_ID",
"amount": "NUMBER",
"reference": "EMPTY",
"note": "REFUND_NOTE",
"payment_method": "PAYMENT_METHOD",
"payment_processor": "PAYMENT_PROCESSOR",
"gateway_response": "EMPTY",
"credit_note_id": "CREDIT_NOTE_ID",
"custom_attributes": [
{
"name": "ATTRIBUTE_NAME",
"value": "EMPTY"
}
],
"version": "VERSION",
"created_by": "CREATED_BY",
"created_on": "TIMESTAMP",
"last_updated_by": "UPDATED_BY",
"last_updated_on": "TIMESTAMP",
"uuid": "UUID"
}
],
"pagination": {
"records": "NUMBER",
"limit": "NUMBER",
"offset": "NUMBER",
"previous_page": "URL",
"next_page": "URL"
}
}
}
Removing a Refund Record
Function : refund_delete()
Purpose
This function delete a specific refund from the system using its unique refund ID. It ensures that invalid or unnecessary refund records can be permanently removed.
Parameters
Parameter | Type | Description |
---|---|---|
refund_id | String | The unique identifier of the refund to be deleted. |
Use Case
The function is used when a refund needs to be deleted, for example, if a refund was mistakenly created or is no longer applicable. By calling this function, the authenticated user can remove the refund record directly from the system, ensuring accurate and consistent financial records.
def refund_delete():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
response = exsited_sdk.refund.delete(id="REFUND_ID")
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testDelete()
{
$id = 'REFUND_ID';
try {
$response = $this->refundService->delete($id,'v3');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The function returns a confirmation of the deletion operation. On success, it provides a response indicating that the refund was deleted successfully, along with a 204 status code showing that no additional content is returned.
{
"success": True,
"status_code": 204
}
null
Creating a refund for a specific credit note
Function : refund_create()
Purpose
This function creates a new refund against a specific credit note by providing refund details such as amount, reference, note, and payment method.
Parameters
Parameter | Type | Description |
---|---|---|
cn_id | String | The credit note ID against which the refund is created. |
Use Case
The function is used when a refund needs to be created for a customer against a credit note. For example, if a customer has returned items or requires reimbursement, this function records the refund details and links them with the respective credit note, ensuring proper financial reconciliation.
def refund_create():
SDKConfig.PRINT_REQUEST_DATA = False
SDKConfig.PRINT_RAW_RESPONSE = False
exsited_sdk: ExsitedSDK = ExsitedSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())
try:
request_data = RefundDetailsDTO(refund=RefundDataDTO(
date="TIMESTAMP",
amount="NUMBER",
reference="REFERENCE_ID",
note="STRING_VALUE",
paymentMethod="PAYMENT_METHOD",
paymentProcessor="PAYMENT_PROCESSOR"))
response = exsited_sdk.refund.create(cn_id='CREDIT_NOTE_ID', request_data=request_data)
print(response)
except ABException as ab:
print(ab)
print(ab.get_errors())
print(ab.raw_response)
public function testCreate()
{
$creditNotesId = 'CREDIT_NOTE_ID';
$params = [
"refund" => [
"date" => "TIMESTAMP",
"amount" => "NUMBER",
"reference" => "REFERENCE_ID",
"note" => "STRING_VALUE",
"payment_method" => "PAYMENT_METHOD",
"payment_processor" => "PAYMENT_PROCESSOR"
]
];
try {
$response = $this->refundService->create($creditNotesId, $params, 'API_VERSION');
echo '<pre>' . json_encode($response, JSON_PRETTY_PRINT) . '</pre>';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
}
Response
The SDK function response returns the details of the newly created refund, including its status, unique refund ID, amount, reference, payment method, payment processor, and metadata such as creation time and UUID. It also includes custom attributes for additional tracking and versioning information.
RefundDetailsDTO(
refund=RefundDataDTO(
status='STATUS',
id='REFUND_ID',
amount='AMOUNT',
reference='REFERENCE_ID',
note='STRING_VALUE',
paymentMethod='PAYMENT_METHOD',
paymentProcessor='PAYMENT_PROCESSOR',
gatewayResponse='GATEWAY_RESPONSE',
creditNoteId='CREDIT_NOTE_ID',
customAttributes=[
CustomAttributesDTO(
name='CUSTOM_ATTRIBUTE_NAME',
value='CUSTOM_ATTRIBUTE_VALUE'
)
],
version='VERSION',
createdBy='CREATED_BY',
createdOn='CREATED_TIMESTAMP',
lastUpdatedBy='LAST_UPDATED_BY',
lastUpdatedOn='LAST_UPDATED_TIMESTAMP',
uuid='UUID',
date='REFUND_DATE'
)
)
{
"refund": {
"status": "STATUS",
"id": "REFUND_ID",
"amount": "NUMBER",
"reference": "REFERENCE_ID",
"note": "EMPTY",
"payment_method": "PAYMENT_METHOD",
"payment_processor": "PAYMENT_PROCESSOR",
"gateway_response": "EMPTY",
"credit_note_id": "CREDIT_NOTE_ID",
"custom_attributes": [
{
"name": "ATTRIBUTE_NAME",
"value": "EMPTY"
}
],
"version": "VERSION",
"created_by": "CREATED_BY",
"created_on": "TIMESTAMP",
"last_updated_by": "EMPTY",
"last_updated_on": "TIMESTAMP",
"uuid": "UUID"
}
}