Cancel a payment
About this guide
This guide quickly demonstrates how to cancel a pending or open payment in EBANX. We will walk you through the basic steps to achieve this goal using your already existing Direct API integration.
How it works
To Cancel a payment through EBANX Direct API, please follow the steps below.
Make sure that the payment status is equal pending or open
You can only cancel a payment if its
status
is equal to (OP) open or (PE) pending. You can check the status of your payment using the end-pointws/query
. You can learn more about this end-point in this quick guide.Confirmed payments
Please, note that payments with
status
equal to CO (Confirmed) can only be refunded, not canceled.Cancel the payment using /ws/cancel end-point
To cancel a payment, you just need to call the end-point
/ws/cancel
(from your server) with the following required fields:Field Description integration_key
Your unique and secret integration key hash
The payment hash (EBANX unique identifier) Please, check the example below:
curl -X POST -G 'https://sandbox.ebanxpay.com/ws/cancel' \-d 'integration_key=your_test_integration_key' \-d 'hash=5476099e890c06ca6f02cae9da1b1faaf3c5929439076cb9'A successful request will return a JSON response similar to the one below.
{"payment": {"hash": "5476099e890c06ca6f02cae9da1b1faaf3c5929439076cb9","merchant_payment_code": "1461416920319","order_number": "146","status": "CA","status_date": "2014-11-26 17:34:11","open_date": "2014-11-25 10:45:56","confirm_date": null,"transfer_date": null,"amount_br": "204.45","amount_ext": "87.00","amount_iof": "0.00","currency_rate": "2.3500","currency_ext": "USD","due_date": "2014-12-2","instalments": "1","payment_type_code": "boleto","pre_approved": false,"capture_available": null},"operation": "cancel","status": "SUCCESS"}Complete EBANX Direct API Reference
The complete API reference for the end-point
ws/cancel
can be found here. We strongly recommend you to take a look in all the available options and examples.
Canceling a payment via Dashboard
Alternativelly, you can also cancel an open payment using your EBANX Dashboard.
Getting help
We hope this article was enlightening, but in case we’ve failed to take out your doubts you have the following options to keep on seeking for answers:
- If you’re not our partner yet and would like to know more about our prices and conditions please fill our this form and our commercial team will get in touch with you.
- In case you’re already our partner please get in touch with our support team at integration@ebanx.com.