NuPay, developed by Nubank, is a payment method aimed at providing a seamless and secure payment experience for consumers in Brazil. This guide will walk you through the steps to integrate NuPay with EBANX's Direct API, allowing your customers to use NuPay for their transactions.
Requirements
- API credentials - Ensure you have your EBANX integration key. If not, complete the Merchant Signup Form.
- Familiarity with EBANX Direct - This setup follows the same general structure as other payment methods, with a few unique parameters. See EBANX Direct for more info.
- Knowledge of your development environment and tools.
How it works
NuPay enables seamless digital wallet payments for online purchases in Brazil. Here’s how the process generally works when integrated with the EBANX API:
- Initiate payment - When the customer selects NuPay, send a payment request to EBANX with the appropriate parameters, including the NuPay payment type code.
- Redirect or notify - Redirect the customer to a payment URL to complete the transaction via the Nubank app, or they may receive a push notification if their mobile number is registered.
- Payment confirmation - Once the customer completes the payment, EBANX updates the payment status from pending (PE) to confirmed (CO). If the payment is not completed, the status updates to canceled (CA).
Instructions
Follow the steps below.
- Select your environment
Select the appropriate environment for your integration. Use the sandbox environment for testing, or the production environment for live transactions. Use the URL for your HTTP requests based on your selection.
https://sandbox.ebanx.com/ws/direct - Payment request
Once your customer submits a Nupay payment at checkout, create a payment request using the ws/direct endpoint. Assign the
payment_type_codeparameter tonupay.Sample request
curl -X POST \
--location 'https://api.ebanxpay.com/ws/direct' \
--header 'Content-Type: application/json' \
--data '{
"integration_key": "{{integration_key}}",
"payment": {
"amount_total": 99.85,
"currency_code": "BRL",
"name": "John Doe",
"email": "john.doe@example.com",
"country": "br",
"payment_type_code": "nupay",
"merchant_payment_code": "{{merchant_payment_code}}",
"redirect_url": "https://acquirer.redirect.example.com",
"document": "{{tax_id}}"
}
}' - Payment response
Each request returns a response similar to the example below.
{
"payment": {
"hash": "59acc5f00945fa382ab051651440826da7701533249b3a475",
"country": "br",
"merchant_payment_code": "{{merchant_payment_code}}",
"order_number": null,
"status": "PE",
"status_date": null,
"open_date": "{{YYYY-MM-DD HH:mm:ss}}",
"confirm_date": null,
"transfer_date": null,
"amount_br": "99.85",
"amount_ext": "99.85",
"amount_iof": "0.00",
"currency_rate": "1.0000",
"currency_ext": "BRL",
"due_date": "{{YYYY-MM-DD}}",
"instalments": "1",
"payment_type_code": "nupay",
"redirect_url": "https://acquirer.redirect.example.com",
"pre_approved": false,
"capture_available": null
},
"status": "SUCCESS"
}At this stage, the payment will appear as pending (PE) in yourMerchant Areachevron_right - Redirect customer to complete payment
Redirect URL
Redirect the customer to the link provided in the response to complete the payment.
"redirect_url": "https://acquirer.redirect.example.com"Nupay App
Alternatively, if the customer has registered a mobile number with their NuPay app, they will receive a push notification and can finalize the payment directly.
Nupay app workflow:
- Monitor payment for status changes
Notifications
-
EBANX will send a notification whenever a payment status changes.
-
Make sure your system is set up to receive notifications from EBANX for any changes in payment status.
Status
-
After receiving a notification, retrieve the payment status.
-
When a payment is confirmed, the status will change from pending (PE) to confirmed (CO). If the customer does not complete the payment, the status will automatically update to cancelled (CA).
-
- Congratulations!
You have successfully integrated Nupay.
For more information, refer to theDirect API reference guidechevron_right
Resources
Use the following resources when testing in your sandbox environment.
API Reference
Click here to access detailed API documentation to integrate efficiently.
Mock Customer Data
Click here to view mock customer data for testing and validating user flows.
Error Codes
Click here to review common error codes to troubleshoot and resolve issues quickly.
Still need help?
We hope this article was helpful. If you still have questions, you can explore the following options:
- Merchant support: Contact our support team at sales.engineering@ebanx.com for assistance.
- Not a partner yet? Please complete the Merchant Signup Form, and our commercial team will reach out to you.