Void, Refund, or Reverse a Transaction
Learn how to cancel a pay-in transaction using the API
How you cancel a pay-in transaction depends on the transaction status. If a transaction hasn’t been settled yet, you can void it. If a transaction has been settled, or settlement is pending, you can refund the transaction. Payabli offers a convenient third method, reversal, which dynamically refunds or voids a transaction based on its settlement status.
This guide explains how to void, refund, and reverse transactions with the Payabli API.
Choose a method
First, choose a transaction cancellation method. To streamline your integration with Payabli, use reverse.
A void cancels an existing sale or captured authorization. Voiding non-captured authorizations prevents future captures. You can void unsettled transactions. If a transaction has been settled, refund it instead.
A Refund sends money back to the accountholder after transaction has been settled. If a transaction hasn’t been settled, void it instead.
A reversal allows you to either refund or void a transaction without knowing the transaction’s settlement status. Send a reversal request for a transaction, and Payabli automatically determines whether it’s a refund or void. Reverse lets you integrate a single function for transaction cancellations and has Payabli dynamically handle the logic.
Void a transaction
You can void transactions that haven’t settled yet.
Start
Make GET request
Send a GET request to the Void endpoint.
Use the referenceID for transaction.
Response
See the API reference for this endpoint.
Build the request
First, choose an endpoint. If you’re testing, use the Sandbox endpoint..
Authenticate
Authenticate by sending your API token in the request header with the key requestToken
:
--header 'requestToken: API TOKEN'
Path parameters
The Void endpoint has one path parameter, transId
, which is the referenceId
for the transaction. To authorize the request, be sure to pass your API token as requestToken
in the request header.
The referenceId identifying the transaction (PaymentId). You can find this in the success response for the payment you want to void.
Example request
This example voids the transaction with a referenceId
of 10-3ffa27df-b171-44e0-b251-e95fbfc7a723
Response
A successful void returns a 200 status with a JSON body. If you try to void a transaction that has already been voided API returns a 400 status with “Invalid TransStatus” in the response text.
Refund a transaction
You can refund settled transactions.
Start
Make GET request
Send a GET request to the Refund endpoint.
Use the referenceID for transaction.
Response
See the API reference for this endpoint.
Build the request
First, choose an endpoint. If you’re testing, use the Sandbox endpoint..
Authenticate
Authenticate by sending your API token in the request header with the key requestToken
:
--header 'requestToken: API TOKEN'
Path parameters
The Refund endpoint has two required path parameters, transId
, which is the referenceId
for the transaction, and the amount
to refund.
The referenceId identifying the transaction (PaymentId). You can find this in the success response for the payment you want to void.
The amount to refund from the original transaction, minus any service fee charged on the original transaction. This amount can’t be greater than the original total amount of the transaction minus the service fee. For example, if a transaction was $90 plus a $10 service fee, you can refund up to $90. Set the amount to 0 (zero) to refund the total amount of the transaction minus any service fee.
Example request
This example refunds the transaction with a referenceId
of 10-3ffa27df-b171-44e0-b251-e95fbfc7a723
for the total amount of the transaction.
This example refunds a partial amount of $100.99 of the transaction with a referenceId
of 10-3ffa27df-b171-44e0-b251-e95fbfc7a723
.
Response
A successful refund returns a 200 status with a JSON body.
Just like sale transactions, you can void a refund transaction before the batch closes. Use the referenceId
from the refund transaction response as the transId
in the void request.
Reverse a transaction
You can use reversal to either refund or void a transaction without knowing the transaction’s settlement status.
Start
Make GET request
Send a GET request to the Reverse endpoint.
Use the referenceID for transaction.
Response
Because reversing a transaction either voids or refunds it, keep these points in mind when creating requests:
- If a transaction isn’t settled, the reversal request reduces the total of the transaction by the amount passed in the request and captures the remainder automatically.
- If a transaction is settled, Payabli refunds the amount passed in the request.
- Partial voids aren’t supported.
See the API reference for this endpoint.
Build the request
First, choose an endpoint. If you’re testing, use the Sandbox endpoint..
Authenticate
Authenticate by sending your API token in the request header with the key requestToken
:
--header 'requestToken: API TOKEN'
Path parameters
The Reverse endpoint has two required path parameters, transId
, which is the referenceId
for the transaction, and the amount
to reverse.
The referenceId identifying the transaction (PaymentId). You can find this in the success response for the payment you want to void.
The amount to refund from the original transaction, minus any service fee charged on the original transaction. This amount can’t be greater than the original total amount of the transaction minus the service fee. For example, if a transaction was $90 plus a $10 service fee, you can refund up to $90. Set the amount to 0 (zero) to refund the total amount of the transaction minus any service fee.
Example request
This example will refund the transaction with a referenceId
of 10-3ffa27df-b171-44e0-b251-e95fbfc7a723
for the total amount of the transaction, if the transaction is settled. If the transaction isn’t settled, it voids the transaction.
This example refunds $53.76 of the transaction with a referenceId
of 10-3ffa27df-b171-44e0-b251-e95fbfc7a723
, if the transaction is settled. If the transaction isn’t settled, it reverses $53.76 of the original authorized amount, and captures the rest.
Response
A successful reverse returns a 200 status with a JSON body. You can tell whether the operation was a refund or a void based on the resultText
value. A “CAPTURED” value means that the operation was a refund, and a “REVERSED” value means the operation was a void.
Was this page helpful?