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.

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.

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.

transId
string
required

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

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>'

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.

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

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.

transId
string
required

The referenceId identifying the transaction (PaymentId). You can find this in the success response for the payment you want to void.

amount
double
required

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.

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>"

Response

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

Success refund response
{
    "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.

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.

transId
string
required

The referenceId identifying the transaction (PaymentId). You can find this in the success response for the payment you want to void.

amount
double
required

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.


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>'

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.