To refund a payment, you must call the API method refund. One payment can be refunded if, and only if, its status confirmed (CO).
Pay attention, because open (OP) or pending (PE) payments cannot be refunded.
To understand how it works, look the refund flow in the following diagram:
The merchant requests the refund through the Dashboard or the API. This refund request gets directly into EBANX refund queue, marked as Requested. EBANX then acknowledges the refund and the refund is marked as Pending.
When the customer receives the money back (in his bank account or through his credit card), the refund transitions its state to Confirmed. When the refund is Requested or Pending, it can be cancelled by the merchant.
Look at these remarks about refunds in EBANX:
Each payment can have many refunds, given that the sum of their amounts does not exceed the original payment amount. Cancelled refunds do not count toward this sum.
Only confirmed payments (CO) can be refunded.
The currency of the refund is the same as the original payment.
Refunds are notified when the refund is pending and an email is sent to the customer asking for bank information and when the refund is confirmed.
A successful request will return a JSON expression similar to the one below.