doTransaction method allows you to process refunds. There are two primary scenarios for this operation:
- Standard Refund: Done on the same terminal where the original sale occurred.
- External Refund: Done on a different terminal, requiring additional metadata for server-side validation.
To perform a Refund transaction, save the
originalTransactionId from the original transaction.Standard Refund
A Standard Refund is utilized when a transaction needs to be reversed or partially returned using the same terminal that processed the original sale.Request
The following example shows a typical request body for a standard refund:JSON
External Refund [from other device]
To refund a transaction initiated on a different terminal, the system requires the following metadata from the original transaction to ensure security and validity:transactionOriginalTimetransactionOriginalAmounttransactionOriginalRequestIdmainBoardSerialhwSerial
Request
The following example shows a typical request body for an external refund:Response
A successful request will return a response similar to the one in the code block below:Refund Request Parameters
To perform a refund, you must include the following parameters within theparams object of the doTransaction method.
| Name | Type | Description |
|---|---|---|
jsonrpc | string | JSON-RPC protocol version (e.g., “2.0”). |
method | string | The API method to call: doTransaction. |
vuid | string | Vendor unique identifier. |
amount | integer | The refund amount (in the smallest currency unit, e.g., cents). |
originalTransactionId | string | Mandatory. The ID of the transaction to be refunded. |
tranType | integer | Mandatory. Set to 2 for Refund transactions. |
originalSiteId | integer | Conditional. Required for external refunds to identify the source site. |
transactionOriginalTime | string | Conditional. Original timestamp in YYYY-MM-DD HH:MM:SS.mmm format. |
transactionOriginalAmount | integer | Conditional. The original amount of the initial transaction. |
transactionOriginalRequestId | string | Conditional. The original request GUID/ID. |
mainBoardSerial | string | Conditional. Mainboard serial of the original device. |
hwSerial | string | Conditional. Hardware serial of the original device. |
Refund Response Parameters
Below are the parameters returned in theresult object following a refund request:
| Name | Type | Description |
|---|---|---|
statusCode | integer | 0 for success; non-zero for errors or declines. |
statusMessage | string | High-level status text (e.g., “TRANSACTION APPROVED”). |
appVersion | string | The current version of the application. |
vuid | string | Vendor unique identifier for the transaction. |
amount | integer | The amount processed for the refund. |
transactionId | string | The unique ID assigned to this refund attempt. |
entryMode | integer | Method used to enter the card data. |
transactionOriginalRequestId | string | Matches the request ID of the original transaction. |
transactionOriginalTime | string | The timestamp recorded for the original transaction. |
transactionOriginalAmount | integer | The total amount of the original transaction. |
serverResultMessage | string | Detailed message from the processor (e.g., “Refund is Approved”). |
tranType | integer | Transaction type identifier (e.g., 2). |
dtId | string | Device-specific transaction identifier. |
currencyCode | string | Alphanumeric currency code (e.g., “USD”). |
currencyISOCode | string | Numeric ISO currency code (e.g., “840”). |
mainBoardSerial | string | Serial number of the processing device’s main board. |
hwSerial | string | Hardware serial number of the processing device. |