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

Void

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.

Refund

A Refund sends money back to the accountholder after transaction has been settled. If a transaction hasn’t been settled, void it instead.

Reversal

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.

transId
string
required

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.

amount
double

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:

curl --request GET \
    --url https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723 \
    --header 'accept: application/json'
    --header 'requestToken: <insert API token>'

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.

{
    "isSuccess": true,
    "responseText": "Success",
    "responseData": {
        "authCode": "123456",
        "referenceId": "10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
        "resultCode": 1,
        "resultText": "REVERSED",
        "avsResponseText": null,
        "cvvResponseText": null,
        "customerId": null
    }
}

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:

curl --request GET \
    --url https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0 \
    --header "accept: application/json"
    --header "requestToken: <API TOKEN>"

This example refunds a partial amount of $100.99 of the transaction with a referenceId of 10-3ffa27df-b171-44e0-b251-e95fbfc7a723:

curl --request GET \
    --url https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/100.99 \
    --header "accept: application/json"
    --header "requestToken: <API TOKEN>"

A successful refund returns a 200 status with a JSON body.

{
    "responseText": "Success",
    "isSuccess": true,
    "responseData": {
        "authCode": "",
        "referenceId": "10-5f8ab66c-c08e-403c-8392-c02f5a91cfab",
        "resultCode": 1,
        "resultText": "CAPTURED",
        "avsResponseText": null,
        "cvvResponseText": null,
        "customerId": null
    }
}

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 StatusReversal TypeHow it’s TreatedResult
OpenFullProcessed as Void✓ Success
OpenPartialAttempted as Partial Void✗ Rejected (not supported)
Closed (Settled)FullProcessed as Full Refund✓ Success
Closed (Settled)PartialProcessed 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.


curl --request GET \
     --url https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0 \
     --header 'accept: application/json'
     --header 'requestToken: <insert API token>'

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.


curl --request GET \
     --url https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/53.76 \
     --header 'accept: application/json'
      --header 'requestToken: <insert API token>'

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.

{
    "responseText": "Success",
    "isSuccess": true,
    "responseData": {
        "authCode": "",
        "referenceId": "10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
        "resultCode": 1,
        "resultText": "CAPTURED",
        "avsResponseText": null,
        "cvvResponseText": null,
        "customerId": null
    }
}