Skip to main content

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 machpay as 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.

  1. 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
  2. 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_code parameter to the digital wallet code.


    Payment parameters

    ParameterTypeRequiredDescription
    integration_keyStringYesYour unique EBANX integration key.
    payment.nameStringYesCustomer full name.
    payment.emailStringYesCustomer email address.
    payment.countryStringYesTwo-letter country code. Use cl for Chile.
    payment.payment_type_codeStringYesPayment type identifier. Use machpay.
    payment.merchant_payment_codeStringYesUnique payment identifier generated by your system.
    payment.currency_codeStringYesThree-letter currency code. Use CLP for Chilean Peso.
    payment.amount_totalNumberYesTotal 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}}"
    }
    }'
  3. Payment response

    Each request returns a response similar to the example below. The response includes a redirect_url for the checkout view and an ewallet object containing the qr_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 your
    Merchant Areachevron_right
  4. Display the QR code for the customer

    Use the qr_code_value from the ewallet object 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_url provided in the response, which leads to the EBANX checkout page where the QR code and payment instructions are displayed.

    Tip

    In 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.

  5. Monitor payment for status changes

    Notifications

    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).

  6. Congratulations!

    You have successfully integrated MACH Pay.

    For more information, refer to the
    Direct API reference guidechevron_right

Resources

Use the following resources when testing in your sandbox environment.

Still need help?

Help Image

We hope this article was helpful. If you still have questions, you can explore the following options: