Pix
Accept PIX payments in your online store.
PIX is a payment method in Brazil that allows instant direct bank transfers for online purchases. Pix is built and owned by the Central Bank (Banco Central) and operated by Brazilian banks, digital accounts, and wallets. Use the emerchantpay API to accept Pix as a payment method across the supported emerchantpay’s payment integrations.
Payment method | Countries/regions | Supported payments |
---|---|---|
Instant bank transfer | Brazil | Online banking |
Prerequisites
To proceed with this solution, you must have an emerchantpay merchant account. Apply for a merchant account by filling out and submitting this contact form.
You will be assigned an emerchantpay Account Manager, who will provide you with credentials and assist you with any of emerchantpay’s payment solutions.
1. Create a Pix payment request
To submit a payment using Pix, create a payment request to the emerchantpay Genesis payment gateway. Specify pix as the transaction_type
.
<?xml version=”1.0″ encoding=”UTF-8″?>
<payment_transaction>
<transaction_type>pix</transaction_type>
<transaction_id>119643250547501c79d8295</transaction_id>
<usage>40208 concert tickets</usage>
<remote_ip>245.253.2.12</remote_ip>
<return_success_url>http://www.example.com/success</return_success_url>
<return_failure_url>http://www.example.com/failure</return_failure_url>
<amount>100</amount>
<currency>USD</currency>
<document_id>12345678909</document_id>
<birth_date>30-12-1992</birth_date>
<customer_email>travis@example.com</customer_email>
<billing_address>
<first_name>Barney</first_name>
<last_name>Rubble</last_name>
<address1>14, Nerazdelni str</address1>
<zip_code>1407</zip_code>
<city>Rio de Janeiro</city>
<country>BR</country>
</billing_address>
<risk_params>
<user_id>123456</user_id>
</risk_params>
</payment_transaction>’
2. Receive a response
You will receive a Success or Error response to your payment request.
Example of a Success response:
<?xml version=”1.0″ encoding=”UTF-8″?>
<payment_response>
<transaction_type>pix</transaction_type>
<status>pending_async</status>
<mode>live</mode>
<transaction_id>119643250547501c79d8295</transaction_id>
<unique_id>44177a21403427eb96664a6d7e5d5d48</unique_id>
<technical_message>Transaction successful!</technical_message>
<message>Transaction successful!</message>
<timestamp>2023-03-06T16:33:11Z</timestamp>
<descriptor>Descriptor one</descriptor>
<amount>100</amount>
<currency>USD</currency>
<sent_to_acquirer>true</sent_to_acquirer>
<emv_string>00020101021226870014br.gov.bcb.pix2565pix-h.santander.com.br/qr/v2/573119fe-8811-4612-9233-7252abc22ef45204000053039865802BR5925EMERCHANTPAY DO BRAZIL…6009SAO PAULO62070503***6304e675</emv_string>
</payment_response>
<
redirect_url
to redirect your customer to authorise the payment with Pix. See the emerchantpay API for the complete list of Pix response parameters and code samples.
Asynchronous notification
Because the Pix payment transaction is asynchronous, the result of your customer’s payment is sent as a separate HTTP POST notification from the gateway to the notification_url that you supplied with the transaction request. Example of a notification for a Pix transaction:“transaction_id”: “f44f2856b5d933c04f42d1e922e30cbf”
“terminal_token”: “871bbbd2f9ce1d58dead9848ef5a24ab59a8ee94”
“unique_id”: “832eb553eba838f79113167cbc1002a1”
“transaction_type”: “pix”
“status”: “approved”
“signature”: “b74ed54d95589fce6f9d7a229b225fd4a925e9bc”
“amount”: “1200”
“funds_status”: “NOT_EXPECTED”
“account_holder”: “John Smith”
“bank_account_number”: “NL18ABNA0484869868”
“bank_identifier_code”: “ABNANL2A”
status
field provides you with information on the outcome of the transaction. See Transaction States for more information about transaction statuses.
Use the signature
field to verify that the notification has been sent by the Genesis gateway. Each session signature is generated by combining the unique_id
of the transaction and your API password, and generating a SHA-1 hash function of the combined string.
signature
= SHA-1 hash value of <unique_id><API password>
unique_id | API password | signature |
---|---|---|
26aa150ee68b1b2d6758a0e6c44fce4c | 50fd87e65eb415f42fb5af4c9cf497662e00b785 | c5219b3d385e74496b2b48a549 |
3f760162ef57a829011e5e2379b3fa17 | 50fd87e65eb415f42fb5af4c9cf497662e00b785 | 14519d0db2f7f8f407efccc9b099 |
After you have verified the notification state and validity, render an XML page containing the transaction’s unique id to acknowledge that you have received the notification.
Example of a notification reply you use to confirm a notification:<?xml version=”1.0″ encoding=”UTF-8″?>
<notification_echo>
<unique_id>3f760162ef57a829011e5e2379b3fa17</unique_id>
</notification_echo>
3. Test your integration
Before you can accept live payments, you must test your integration in the emerchantpay staging environment.
- Add an item to your cart in your online store.
- Proceed to the checkout page and check out using Pix.
- Follow the redirect link in the response.
- In the payment simulator, follow the instructions to simulate a transaction.
- Complete the order and verify that you are redirected to the order confirmation page.
- Log in to Genesis.
- In the navigation menu, go to Payment transactions.
- Verify that the transaction appears at the top of the list and is successful.
4. Accept live payments
After you have successfully tested your Pix integration, you are ready to move to the production environment and accept live payments. Contact your emerchantpay Account Manager to get your login credentials for the Genesis production environment.
You are now ready to accept live payments using Pix.