Bank Transfer with Direct API
About this guide
This page explains how to add Bank Transfer 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:
- An EBANX Sandbox account. That's not the case? Please sign up for an Sandbox Account here;
- Bank Transfer enabled in your EBANX Dashboard.
How it works
To complete Bank Transfer integration through EBANX Direct API, please follow the steps below.
Enable Bank Transfer
Bank Transfer 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.
Call the /ws/direct API to get the Bank Transfer link (server-side)
Bank Transfer generates a voucher, so you will need to redirect your customer to a page containing it. To get this link, you just need to call the end-point
ws/request
(server-side) with the following required fields:- Operation: Must be
request
; - Payment type code: Must be
banktransfer
;
Customer data:
- Customer name;
- Customer e-mail;
- Customer document;
- Customer address;
- Customer street number;
- Customer city;
- Customer state (Two letter code);
- Customer zip-code;
- Customer phone number
Charge info:
- Unique merchant payment code;
- Currency code;
- Total 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 isBRL
(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": "banktransfer","merchant_payment_code": "0x0W26D04-T02","currency_code": "BRL","amount_total": 100}}'A successful request will return a JSON response like the one below. The voucher link will be in the parameter
payment.voucher_url
.{"payment": {"hash": "5ef4d5116163a1dc2a1c6271ae5c55714c77e4c0a10fa750","pin": "255672522","country": "br","merchant_payment_code": "0x0W26D04-T02","order_number": null,"status": "PE","status_date": null,"open_date": "2020-06-25 16:47:12","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-26","instalments": "1","payment_type_code": "banktransfer","voucher_url": "https://sandbox.ebanxpay.com/print/voucher/execute?hash=5ef4d5116163a1dc2a1c6271ae5c55714c77e4c0a10fa750","pre_approved": false,"capture_available": 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.- Operation: Must be
Redirect customer to the returned url
Redirect your customer to the URL returned in the parameter
voucher_url
. Your customers will see an interface like this:At this point you have a
pending
payment in your EBANX Dashboard.Wait for the payment
After the bank transfer, it will take sometime to EBANX get informed by the bank. As soon as we get the confirmation, payment status is modified from
pending
toconfirmed
.If your customers don't transfer the money to the indicated account, payment will be automatically canceled.
info
The generated voucher has an expiration date (that will be configured by you in the parameter
payment.due_date
). After this date, customer will have to issue a new voucher. Optionally, you can generate a new voucher and send to your customers through your EBANX Dashboard.
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.