Version: current

Online Debit with Direct API

About this guide

This page explains how to add Online Debit (TEF) to your existing Direct API integration. Direct API integration is basically the same for all payment methods, only varying the payment_type_code and some additional required fields.

If you are not integrated with EBANX Direct API yet, please take a look in this basic guide about it. Are you not sure if EBANX Direct API is the best option for your e-commerce? Please, talk with one of our integration specialists.

What you will need

Before starting your integration, please make sure that you have:

  1. An EBANX Sandbox account. That's not the case? Please sign up for an Sandbox Account here;
  2. Online Debit enabled in your EBANX Dashboard.

How it works

To complete Online Debit integration throught EBANX Direct API, please follow the steps below.

  1. Enable Online Debit

    Online Debit availability may vary depending on your contract. So the first step is to check if it is active in your EBANX Dashboard.

    All set? We can go ahead to next step, otherwise, please get in touch with our integration specialists.

  2. Call the /ws/direct API to get the Online Debit link (server-side)

    With Online Debit, your consumers are redirected to their online-banking website and the payment is made safely and quickly. To get this redirection link, you just need to call the end-point ws/request (server-side) with the following required fields:

    Basic parameters:

    ParameterDescription
    operationOperation must be request
    integration_keyYour unique and secret integration key
    payment_type_codeSupported banks are: banrisul, bradesco, bancodobrasil, itau

    Customer data:

    ParameterDescription
    nameCustomer name
    emailCustomer e-mail
    documentCustomer document
    addressCustomer address
    street_numberCustomer street number
    cityCustomer city
    stateCustomer state (Two letter code)
    zipcodeCustomer zip-code
    phone_numberCustomer phone number

    Charge parameters:

    ParameterDescription
    merchant_payment_codeUnique merchant payment code
    currency_codeCurrency code
    amount_totalTotal amount to be charged

    Optionally, you can set a due date to your voucher using the parameter payment.due_date in the format dd/mm/yyyy. It can be more than three days only when payment currency is BRL (Brazilian Real), and your merchant account has this feature enabled. The due date is based on the local time of the country that the payment is generated.

    Check the example:

    curl -X POST 'https://sandbox.ebanxpay.com/ws/direct' \
    -d 'request_body={
    "integration_key": "{{integration_key}}",
    "operation": "request",
    "payment": {
    "name": "José Silva",
    "email": "jose@example.com",
    "document": "853.513.468-93",
    "address": "Rua E",
    "street_number": "1040",
    "city": "Maracanaú",
    "state": "CE",
    "zipcode": "61919-230",
    "country": "BR",
    "phone_number": "8522847035",
    "payment_type_code": "itau",
    "merchant_payment_code": "0x0W26D04-T03",
    "due_date": "27/06/2020",
    "currency_code": "BRL",
    "amount_total": 100
    }
    }'

    A successful request will return a JSON response like the one below. The redirection link to the bank will be in the parameter payment.redirect_url.

    {
    "redirect_url": "https://sandbox.ebanxpay.com/ws/directtefredirect/?hash=5ef50c977378a231f42da8c8d882264ba8251a31e781b33c",
    "payment": {
    "hash": "5ef50c977378a231f42da8c8d882264ba8251a31e781b33c",
    "pin": "489539812",
    "country": "br",
    "merchant_payment_code": "0x0W26D04-T03",
    "order_number": null,
    "status": "PE",
    "status_date": null,
    "open_date": "2020-06-25 20:44:07",
    "confirm_date": null,
    "transfer_date": null,
    "amount_br": "100.00",
    "amount_ext": "99.62",
    "amount_iof": "0.38",
    "amount_ext_requested": "100.00",
    "currency_rate": "1.0000",
    "currency_ext": "BRL",
    "due_date": "2020-06-27",
    "instalments": "1",
    "payment_type_code": "itau",
    "redirect_url": "https://sandbox.ebanxpay.com/ws/directtefredirect/?hash=5ef50c977378a231f42da8c8d882264ba8251a31e781b33c",
    "pre_approved": false,
    "capture_available": null,
    "customer": {
    "document": "85351346893",
    "email": "jose@example.com",
    "name": "JOSE SILVA",
    "birth_date": null
    }
    },
    "status": "SUCCESS"
    }
    info

    The complete API reference for the end-point ws/request can be found here. We strongly recommend you to take a look in all the available options.

  3. Redirect customer to the returned URL

    Redirect your customer to the URL returned in the parameter redirect_url. After the redirection, your customers will be in their online-banking environment, with all the necessary purchase details to finalize their payment securely and easily.

    At this point you have a pending payment in your EBANX Dashboard.

    Sandbox environment

    You can test this integration in our Sandbox environment as we offer a Online-Banking mock interface.

    Check it below:

    Online Debit

  4. Wait for the payment

    After the payment in the Customer's online-banking environment, it will take sometime to EBANX get informed by the bank. As soon as we get the confirmation, payment status is modified from pending to confirmed.

    If your customers don't conclude the payment, it will be automatically canceled.

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 ou this form and our comercial 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.
Last updated on by Fernando Pankiewicz Gomes