Version: current

Recurring Payments with Digital Wallets

Overview

This guide will walk you through a basic API integration that accept e-wallet recurring payments in EBANX.

About this guide

By following this basic integration guide, you will understand how you can accept e-wallet recurring payments in your ckeck-out, by using EBANX Direct API. To complete a recurring payment with e-wallets you will, basically, need to call two of our APIs, one to check the e-wallet availability and another one to make the payment.

Availability

Recurring Payments with Digital Wallet integration through Direct API is available to the following countries and e-wallets:

  • Brazil
    • PayPal
    • Mercado Pago
  • Argentina
    • Mercado Pago
  • Chile
    • Mercado Pago
  • Uruguay
    • Mercado Pago
  • Mexico
    • Mercado Pago

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 complete an e-wallet payment, please follow the steps below.

  1. Get the available e-walllets

    E-Wallets availability may vary depending on your country and contract. So the first step is to check and get more information about the available e-wallets.

    curl --location --request POST 'https://api.ebanxpay.com/ws/ewallet-availableEWallets' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "integration_key":{{your_integration_key}},
    "country":"br"
    }'

    This method will return you all the necessary information that you need to render e-wallets in your page, such as e-wallet name, icons and ,if available, some promotional content.

    To learn more about the method getAvailableEWallets, you can check our the complete API reference

    info

    Note that e-wallets for recurring payments will always have a code ending with -recurrent

  2. Use the response to render e-wallets in your page.

    Now you have everything you need to render e-wallets in your page. Below you can find an example of the ewallet-availableEWallets method response.

    [
    {
    "code": "paypal-recurrent",
    "name": "PayPal",
    "icon_url": "https://s3-sa-east-1.amazonaws.com/assets.ebanx.com/gateway/paypal/icon.png",
    "promotional_text": ""
    }
    ]

    Don't know exactly how to use it? You can use our payment page as a benchmark to render it in your check-out 😉.

    EBANX Payment page

  3. Call our direct API with the e-wallet payment_type_code

    For MercadoPago it is necessary to enroll the user using the /ws/userenrollment/mpconnect endpoint

    {
    "integration_key": "***",
    "operation": "enrollment",
    "payment_type_code": "mpconnect",
    "enrollment": {
    "merchant_enrollment_code": "{{unique_enrollment_code}}",
    "email": "customer.email@example.com",
    "country": "AR"
    }
    }

    The response of this call will have either a SUCCESS or a Canceled status

    {
    "redirect_url": "{{mpconnect_url_to_finish_enrollment}}",
    "status": "SUCCESS",
    "enrollment": {
    "merchant_enrollment_code": "{{code_sent}}",
    "email": "customer.email@example.com",
    "country": "AR"
    }
    }

    This enrollment can be cancelled with the endpoint/ws/userenrollment/mpconnect/cancel

    {
    "integration_key": "integration_key",
    "operation": "cancel",
    "payment_type_code": "mpconnect",
    "enrollment": {
    "merchant_enrollment_code": "test-001",
    "email": "user@email.com",
    "country": "AR"
    }
    }

    After getting the e-wallet code you need to use it in EBANX Direct API, as a payment_type_code.

    Paypal:

    {
    "integration_key": "*****",
    "operation": "request",
    "mode": "full",
    "payment": {
    "amount_total": 20,
    "currency_code": "BRL",
    "name": "Test Customer",
    "email": "test@example.com",
    "payment_type_code": "paypal-recurrent",
    "redirect_url": "https://your-call-back-url.com",
    "birth_date": "12/04/1979",
    "document": "07683846953",
    "country": "br",
    "zipcode": "80330080",
    "address": "Rua Principal",
    "street_number": "15",
    "city": "Curitiba",
    "phone_number": "3199999999",
    "state": "PR"
    }
    }

    MercadoPago:

    {
    "integration_key": "***",
    "operation": "request",
    "payment": {
    "payment_type_code": "mpconnect",
    "country": "ar",
    "amount_total": "20.00",
    "currency_code": "ARS",
    "merchant_payment_code": "xyz-123-1001",
    "name": "PAYMENT REQUEST CUSTOMER",
    "email": "customer.email@example.com"
    }
    }

    The response of this call will have either a Completed status or a Canceled, "status": "CO" or "status": "CA", and there will be no redirection.

    Paypal:

    {
    "payment": {
    "hash": "5ec27f3b86fa8e3123452345626aec3989aa2ceccdb7",
    "pin": "237274394",
    "country": "br",
    "merchant_payment_code": "xyz-123-1001",
    "order_number": null,
    "status": "CO",
    "status_date": null,
    "open_date": "2020-05-18 12:27:38",
    "confirm_date": null,
    "transfer_date": null,
    "amount_br": "20.00",
    "amount_ext": "20.00",
    "amount_iof": "0.00",
    "currency_rate": "1.0000",
    "currency_ext": "BRL",
    "due_date": "2020-05-21",
    "instalments": "1",
    "payment_type_code": "paypal-recurring",
    "pre_approved": false,
    "capture_available": null
    },
    "status": "SUCCESS"
    }

    MercadoPago:

    {
    "payment": {
    "hash": "5ec27f3b86fa8e3123452345626aec3989aa2ceccdb7",
    "country": "ar",
    "merchant_payment_code": "xyz-123-1001",
    "order_number": null,
    "status": "CO",
    "status_date": "2021-12-13 20:23:25",
    "open_date": "2021-12-13 20:23:21",
    "confirm_date": "2021-12-13 20:23:25",
    "transfer_date": null,
    "amount_br": "20.00",
    "amount_ext": "20.00",
    "amount_iof": "0.00",
    "currency_rate": "1.0000",
    "currency_ext": "ARS",
    "due_date": "2021-12-16",
    "instalments": "1",
    "payment_type_code": "mpconnect",
    "pre_approved": false,
    "capture_available": null
    },
    "status": "SUCCESS"
    }

    To learn more about the method EBANX Direct API, you can check our the complete API reference

Getting help

If you have any doubts or need help, you can send and email to: EBANX Integration

Last updated on by Fabio Bandacheski