MACH Pay
MACH Pay is a digital wallet from Chile that enables customers to pay for online purchases by scanning a QR code with the MACH app. When a payment is created through the EBANX Direct API, a QR code is generated for the customer to scan. Once the customer authorizes the payment in the MACH app, EBANX updates the payment status from pending (PE) to confirmed (CO).
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
MACH Pay enables digital wallet payments for online purchases in Chile. Here is how the process works when integrated with the EBANX API:
- Initiate payment - When the customer selects MACH Pay, send a payment request to EBANX with the appropriate parameters, including
machpayas the payment type code. - Display QR code - Present the QR code from the response to the customer. The customer scans it with the MACH app to authorize the payment.
- 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 before the expiration time, the status updates to cancelled (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 MACH Pay payment at checkout, create a payment request using the ws/direct endpoint. Assign the
payment_type_codeparameter to the digital wallet code.Payment parameters
Parameter Type Required Description integration_keyString Yes Your unique EBANX integration key. payment.nameString Yes Customer full name. payment.emailString Yes Customer email address. payment.countryString Yes Two-letter country code. Use clfor Chile.payment.payment_type_codeString Yes Payment type identifier. Use machpay.payment.merchant_payment_codeString Yes Unique payment identifier generated by your system. payment.currency_codeString Yes Three-letter currency code. Use CLPfor Chilean Peso.payment.amount_totalNumber Yes Total payment amount in CLP. Sample request
curl -X POST \
--location 'https://sandbox.ebanx.com/ws/direct' \
--header 'Content-Type: application/json' \
--data '{
"integration_key": "{{integration_key}}",
"payment": {
"amount_total": 99.85,
"currency_code": "CLP",
"name": "John Doe",
"email": "john.doe@example.com",
"country": "cl",
"payment_type_code": "machpay",
"merchant_payment_code": "{{unique_merchant_code}}"
}
}' - Payment response
Each request returns a response similar to the example below. The response includes a
redirect_urlfor the checkout view and anewalletobject containing theqr_code_value.{
"payment": {
"hash": "<{hash_here}>",
"country": "cl",
"merchant_payment_code": "{{unique_merchant_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": "CLP",
"due_date": "{{YYYY-MM-DD}}",
"instalments": "1",
"payment_type_code": "machpay",
"redirect_url": "https://sandbox.ebanx.com/ws/redirect?hash=<{hash_here}>",
"pre_approved": false,
"capture_available": null,
"ewallet": {
"qr_code_value": "{{data:image/png;base64,...}}"
}
},
"status": "SUCCESS"
}At this stage, the payment will appear as pending (PE) in yourMerchant Areachevron_right - Display the QR code for the customer
Use the
qr_code_valuefrom theewalletobject in the response to display a QR code to the customer. The value is a base64-encoded PNG image that can be rendered directly in an<img>tag.<img src="{{qr_code_value}}" alt="MACH Pay QR Code" />The customer scans the QR code with the MACH app to authorize and complete the payment.
Alternatively, you can redirect the customer to the
redirect_urlprovided in the response, which leads to the EBANX checkout page where the QR code and payment instructions are displayed.TipIn the sandbox environment, use the EBANX payment simulator to test payment confirmation. Navigate to the sandbox dashboard to simulate status changes for your test payments.
- 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 MACH Pay.
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.