Cancelling Pix Automático Payments

Overview

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.

Availability

Pix Automático integration through Direct API will be available in Brazil only.

What you will need

A Sandbox Account

As with any secure payment integration, you will first need to set up authorization. The EBANX sandbox allows you to set up a test environment to run transactions using test credit card numbers and explore our payment solutions.

Sign up for an Sandbox Account at our EBANX Business Page, select your business model and answer a few questions. We'll get in touch with you shortly after!

Sign up for an EBANX Sandbox Account here

How it works

To Cancel a payment through EBANX Direct API, please follow the steps below.

  1. 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-point ws/query.

    Confirmed payments

    Please, note that payments with status equal to CO (Confirmed) can only be refunded, not canceled.

  2. 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:

    FieldDescription
    integration_keyYour unique and secret integration key
    hashThe 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"
    }
note

Pix Automático goes live on June 16th 2025. Stay tuned for Sandbox Environment availability on December 1st 2024!

Still need help?

Help Image

We hope this article was helpful. If you still have questions, you can explore the following options:

Last updated on by Alex Nunes Gonzaga