Version: current

Webpay with Direct API

About this guide

This page explains how to add Webpay 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. Webpay enabled in your EBANX Dashboard.

How it works

To complete Webpay integration through EBANX Direct API, please follow the steps below.

  1. Enable Webpay

    Webpay 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 end-point to get the Webpay link (server-side)

    With Webpay, your consumers are redirected to a third-party website and the payment is made safely and quickly. To get this redirection link, you just need to call the end-point ws/direct (server-side) with the following required fields:

    Basic parameters:

    ParameterDescription
    operationOperation must be request
    integration_keyYour unique and secret integration key
    payment_type_codeTo Webpay must be webpay
    countryTwo-letter country code - cl for Chile.

    Customer data:

    ParameterDescription
    nameCustomer name
    emailCustomer e-mail
    phone_numberCustomer phone number
    documentCustomer's valid document number
    zipcodeCustomer Zipcode
    addressCustomer address
    street_numberCustomer street number
    cityCustomer city
    stateCustomer state conamede

    Charge parameters:

    ParameterDescription
    merchant_payment_codeUnique merchant payment code
    currency_codeISO-4217 Currency code of your transaction. Supported values: PEN and USD
    amount_totalTotal amount to be charged

    Check the example:

    curl -L -X POST 'https://sandbox.ebanxpay.com/ws/direct' \
    -H 'Content-Type: application/json' \
    --data-raw '{
    "integration_key": "{{integratio_key}}",
    "operation": "request",
    "payment": {
    "name": "José Silva",
    "email": "josechile@example.com",
    "phone_number": "0405777687",
    "address": "Rua E",
    "street_number": "1040",
    "city": "Antofagasta",
    "state": "Antofagasta",
    "zipcode": "61919-230",
    "country": "cl",
    "document": "9882884-2",
    "payment_type_code": "webpay",
    "merchant_payment_code": "0x0W28D03-CL-T07",
    "currency_code": "CLP",
    "amount_total": "500"
    }
    }'

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

    {
    "payment": {
    "hash": "5efded178fb076acee48b51822375075a7a8f5850241de57",
    "pin": "443281986",
    "country": "cl",
    "merchant_payment_code": "0x0W28D03-CL-T07",
    "order_number": null,
    "status": "PE",
    "status_date": null,
    "open_date": "2020-07-02 14:20:07",
    "confirm_date": null,
    "transfer_date": null,
    "amount_br": "500.00",
    "amount_ext": "500.00",
    "amount_iof": "0.00",
    "amount_ext_requested": "500.00",
    "currency_rate": "1.0000",
    "currency_ext": "CLP",
    "due_date": "2020-07-05",
    "instalments": "1",
    "payment_type_code": "webpay",
    "redirect_url": "https://sandbox.ebanx.com/ws/redirect/execute?hash=5efded178fb076acee48b51822375075a7a8f5850241de57",
    "pre_approved": false,
    "capture_available": null
    },
    "status": "SUCCESS",
    "redirect_url": "https://sandbox.ebanx.com/ws/redirect/execute?hash=5efded178fb076acee48b51822375075a7a8f5850241de57"
    }
    info

    The complete API reference for the end-point ws/direct 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 a third-party website, 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:

    Webpay

  4. Wait for the payment

    Once the payment is made by your customer, it will take sometime to EBANX get informed. 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.

    Notification Flow

    You can set-up notification to get informed as soon as the payment is confirmed. Lern more here

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 our this form and our commercial 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 “ElderBalsani