Endpoints

https://api.ebanx.com/ws/refundOrCancel

https://sandbox.ebanx.com/ws/refundOrCancel

HTTP Method

POST

Response

JSON

This is a server-to-server operation to cancel payments or create payments refunds.

When refundOrCancel operation is requested, the following will occur according to the payment status:

  • Open (OP) or Pending (PE) – the payment will be canceled (status changes to CA), and no refund will be made.
  • Confirmed (CO) – it will be made a full refund of the payment to the customer.

Request parameters

integration_key

string, length 100, required

Your unique and secret integration key.

hash

string, length 41, required if merchant_payment_code not provided

The payment hash (EBANX unique identifier).

description

string, length 1-1500, required for request

Description of the refund reason.

merchant_refund_code

string, length 1-20, optional

The ID of the refund on the merchant system.

This method call will return a JSON object with the payment data. The most relevant node for this operation is payment.refunds.

Response parameters

status

string

The status of the the request (SUCCESS or ERROR).

payment

JSON

A JSON object that represents the payment.

payment.hash

string, 41 length, unique

The payment hash (EBANX unique identifier).

payment.merchant_payment_code

string, 1-40 length

The payment hash Merchant Payment Code (merchant unique ID).

payment.order_number

string, 1-40 length

The order number, optional identifier set by the merchant. You can have multiple payments with the same order number.

payment.status

string, 2 length

The payment status. The following statuses are available:

  • OP: the customer has not yet filled the payment details on the EBANX Checkout. It can change either to CA (timeout) or to PE.
  • PE: the payment is pending confirmation. It can change either to CA or to CO.
  • CO: the payment is confirmed (paid).
  • CA: the payment is cancelled.

payment.status_date

string, 19 length, UTC Date

The date and hour of the last status change.

payment.open_date

string, 19 length, UTC Date

The date and hour of when the payment was created.

payment.confirm_date

string, 19 length, UTC Date

The date and hour of when the payment was confirmed.

payment.transfer_date

string, 19 length, UTC Date

The date and hour of when the payment was settled.

payment.amount_br

float

The amount in local currency.

payment.amount_iof

float

The tax amount in local currency (varies between countries).

payment.amount_ext

float

The amount in the original currency.

payment.currency_rate

float

The exchange rate used in the payment.

payment.currency_ext

string, 3 length, ISO 4217 three letter code

Three-letter code of the original currency.

payment.due_date

string, 10 length, dd/mm/yyyy

Expiry date of the payment (not applicable to all payment methods).

payment.instalments

integer, ranges from 1 to 12

Number of instalments, defaults to 1.

payment.payment_type_code

string, 32 length

The code of the payment method. The supported codes are:

amex: American Express credit card (Brazil, Mexico). aura: Aura credit card (Brazil). bancodobrasil: Banco do Brasil bank transfer (Brazil). banrisul: Banrisul bank transfer (Brazil). boleto: Boleto bancário (Brazil). bradesco: Bradesco bank transfer (Brazil). carnet: CARNET credit card (Mexico). debitcard: Debit cards (Mexico) diners: Diners credit card (Brazil). discover: Discover credit card (Brazil). elo: Elo credit card (Brazil). hipercard: Hipercard credit card (Brazil). itau: Itaú bank transfer (Brazil). ebanxaccount: EBANX Account (Brazil). mastercard: MasterCard credit card (Brazil, Mexico). oxxo: OXXO (Mexico). pagoefectivo: PagoEfectivo (Peru). safetypay: SafetyPay (Peru, Checkout only). safetypay-cash: SafetyPay Cash (Peru). safetypay-online: SafetyPay Online (Peru). visa: Visa credit card (Brazil, Mexico). bitcoin: Bitcoin (Brazil, Peru and Mexico). servipag: Servipag (Chile). eft: Bank Transfer (Colombia).

payment.transaction_status

JSON

A JSON object that represents the payment credit card transaction.

payment.transaction_status.acquirer

string, 16 length

The acquirer that processed the transaction.

payment.transaction_status.code

string, 2-7 length

The transaction status code:

  • OK: The transaction amount was approved.
  • NOK: The acquirer did not approved the transaction. The customer must contact the issuer to check for any issue with his credit card.
  • RETRY: Something went wrong with the process. You can retry with the same data. We recommend you to try more 3 times on different periods of time (first try, then second try after 2 hours after the first, etc).

You can see more of these status HERE.

payment.transaction_status.description

string, 500 length

The description for the status code, which is returned from the acquirer.

payment.transaction_status.authcode

string, length 40

Transaction authentication code in the acquirer.

payment.pre_approved

boolean

Flag that shows if a payment is pre-approved by the credit card acquirer. Once pre-approved, the payment will pass through EBANX anti-fraud system which may take from a few minutes up to 8 business hours. After the check, the payment will be confirmed (CO) or cancelled (CA).

payment.capture_available

boolean

Flag that shows if a payment is ready to be captured. Applies only to credit cards when auto_capture is set to false. Some remarks on this attribute:

  • A payment can only be captured if pre_approved value is true, which means that the payment has been pre approved by the credit card acquirer. Before capture, an authorized payment has status as PE (pending). After the capture, the status changes to CO (confirmed). A payment can only be captured if the status is PE (pending). *Payments must be captured in 4 (four) days, otherwise they are automatically cancelled.

NOTE: It can be changed up to 5 (five) days.

payment.redirect_url

string, variable

The URL the customer should be redirected to. Applies to certain payment methods using the Direct API.

payment.pay_with_balance_url

string, variable

If the customer has an EBANX Account profile and it has balance enough to pay for the created boleto, the response will contain this parameter responsible for redirecting the customer to his EBANX Account page so he can pay the boleto with his available balance.

payment.boleto_url

string, variable

The boleto URL.

payment.boleto_barcode

string, length 47

The boleto barcode number. (Boleto)

payment.cip_url

string, variable

The CIP URL. (PagoEfectivo)

payment.cip_code

string, length 12

The CIP code. (PagoEfectivo)

payment.refunds

JSON

An array of objects that represent a refund linked to this payment. This node will only be present if a refund was issued.

payment.refunds.id

integer

The ID of the refund on EBANX.

payment.refunds.merchant_refund_code

string, length 1-20

The ID of the refund on the merchant system (optional).

payment.refunds.status

string, length 2

The status of the refund:

  • RE (Requested): The refund has been requested and is waiting to be processed. It can be cancelled while it has this status.
  • PE (Pending): The refund is being processed. It cannot be cancelled anymore.
  • CO (Confirmed): The refund was processed and the money was sent back to the customer.
  • CA (Cancelled): The refund was cancelled.

payment.refunds.request_date

string, length 19, UTC Date

The date and hour when the refund was created.

payment.refunds.pending_date

string, length 19, UTC Date

The date and hour when the customer data was received

payment.refunds.confirm_date

string, length 19, UTC Date

The date and hour when the money was transferred to the customer.

payment.refunds.amount_ext

float

The refunded amount in the original currency.

payment.refunds.description

string, length 1-1500

Description of the refund reason.

payment.chargeback

JSON

A JSON object that represents a chargeback linked to this payment. This node will only be present if a chargeback was issued.

payment.chargeback.create_date

string, length 19, UTC Date

The date and hour when the chargeback was imported into the system.

payment.chargeback.chargeback_date

string, length 19, UTC Date

The date and hour when the chargeback was created by the acquirer on behalf of the customer.

payment.chargeback.description

string, length 1-1500

Description of the chargeback.

payment.chargeback_credit

boolean

Flag that shows if a chargeback credit was issued.