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.
Click to expand
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.
Path parameters
When canceling a transaction via the API, you always need the transId
, which is the referenceId
for the transaction. For refunds and reversals, you also need the amount
to refund.
Required for voids, refunds, and reversals
The referenceId identifying the transaction (PaymentId). You can find this in the success response for the payment you want to void.
Required for refunds and reversals
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.
Void a transaction
You can void transactions that haven’t settled yet. See the API reference for this endpoint.
This example voids the transaction with a referenceId
of 10-3ffa27df-b171-44e0-b251-e95fbfc7a723
:
A successful void returns a 200 status with a JSON body. If you try to void a transaction that has already been voided, the API returns a 400 status with “Invalid TransStatus” in the response text.
Refund a transaction
You can refund settled transactions. See the API reference for this endpoint. If you use the Enhanced Refund Flow, see the guide for information about how refunds are handled in different scenarios.
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
:
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. See the API reference for this endpoint.
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 is treated as a void. Only full voids supported. Partial voids aren’t supported.
- If a transaction is settled, the reversal request is treated as a refund. Both full and partial refunds are supported. Payabli refunds the amount passed in the request.
When using the api/MoneyIn/reverse/
endpoint, the transaction’s batch status determines how your reversal request is processed:
Batch Status | Reversal Type | How it’s Treated | Result |
---|---|---|---|
Open | Full | Processed as Void | ✓ Success |
Open | Partial | Attempted as Partial Void | ✗ Rejected (not supported) |
Closed (Settled) | Full | Processed as Full Refund | ✓ Success |
Closed (Settled) | Partial | Processed as Partial Refund | ✓ Success |
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.
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?