Skip to main content

Reverse a payment

Learn how to reverse a payment with the Dojo API.

Use a reversal if you need to cancel a payment, for example if a customer has requested a payment to be canceled. You can reverse the full payment amount only.

Reversal scenarios

You can reverse a payment in the following scenarios:

StatecaptureMode:AutocaptureMode:Manual
Creatednono
AuthorizedN/Ayesyes
Capturedyesyesno

*   If reversed within 7 days of the original payment date.


* * If reversed on the same calendar day as the original payment date.




info
  • Reversing a payment won't work in any other state.
  • Once the reversal time limit expires, the payment can only be refunded.
  • Payments that were captured in captureMode:Manual can only be refunded, and not reversed.

If you want to reverse a payment using the Dojo for Merchants App, see Reversing online checkout transactions.

Reverse using the Dojo API

To reverse a payment, use the endpoint below:

POST /payment-intents/{paymentIntentId}/reversal

In your request, include:

  • paymentIntentId: This identifies the payment being reverse.

For the full API specification, see the reference.

Request example

The next example below shows how you would reverse the payment intent pi_pT08VyWG3EC_HQB4NBVliA.

# The sandbox API key passed in 'authorization' is public.
# Don't submit any personally identifiable information in any requests made with this key.
# Sign in to developer.dojo.tech to create your own private sandbox key and use that instead
# for secure testing.

curl -v --request POST \
--url https://api.dojo.tech/payment-intents/<paymentIntentId>/reversal \
--header 'Authorization: Basic <your_api_key>' \
--header 'Version: 2024-02-05'

Response example

If your request is successful, the response will return information about the reversal.

{
"message": "reverse for the order 3443",
"reversalId": "rvs_g8mCx87TykeQ6BOXqxZ9NQ"
}

Cancel a reverse

Once created, a reversal can't be canceled. You cannot reverse a reversal. You will have to create a new payment intent, instead.