Skip to main content
UPI

UPI (Unified Payments Interface) is one of India’s most popular digital payment systems, enabling instant, secure, and real-time payments directly from customers’ bank accounts. Managed by the National Payments Corporation of India (NPCI), UPI has revolutionized digital transactions in India with features like 24/7 availability, multi-bank support, and seamless transaction processing. Integrating UPI with EBANX allows international merchants to accept payments from Indian customers using one of the most trusted payment methods in the region.

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.

Workflow options

UPI offers two distinct payment flows to accommodate different user interactions:

  • UPI QR Code - This flow generates a QR code that users scan with their UPI app. It redirects them to the app, where the payment details are pre-filled. Users then enter their UPI PIN to complete the transaction.
  • UPI Intent - This flow is designed for mobile devices. Users tap to pay, pre-selecting their UPI app (or a generic option). The deep link redirects them directly to the chosen app, with pre-filled payment details, where they authenticate the transaction with their UPI PIN.

The main difference is in how each flow is initiated: upi-qrcode requires scanning a QR code, while upi-intent involves tapping and selecting the UPI app.

How it Works

  • Customer initiates payment - At checkout, the customer selects UPI as their preferred payment option.
  • Payment method selection - The customer can choose between scanning a QR code (upi-qrcode) or tapping to pay using a specific UPI app (upi-intent).
  • Redirection to UPI app
    • For upi-qrcode, the user scans the QR code, which redirects them to the UPI app with pre-filled payment details.
    • For upi-intent, the user is directly redirected to their chosen UPI app with pre-filled payment details.
  • UPI PIN authentication - In the UPI app, the customer enters their UPI PIN to authorize and complete the transaction.
  • Payment confirmation - Once the transaction is successful, the customer receives a confirmation notification in their UPI app, and the merchant is updated with the transaction status.
  • EBANX notification - EBANX sends a notification to the you, confirming the successful transaction, allowing you to fulfill your customer's order.

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. Define your parameters

    Basic parameters:

    ParameterDescription
    operationSet to request
    integration_keyYour EBANX integration key
    payment_type_codeSet to upi-qrcode or upi-intent
    countrySet to in for India

    Customer data:

    ParameterDescription
    nameCustomer name
    emailCustomer email
    phone_numberCustomer phone
    addressCustomer address
    street_numberCustomer street number
    cityCustomer city
    stateCustomer state
    zipcodeCustomer zip code
    Name Validation

    The value provided in the name parameter will undergo a validation process to ensure it matches the UPI ID account holder’s registered name.

    Charge parameters:

    ParameterDescription
    merchant_payment_codeUnique merchant payment code
    currency_codeSupported value: INR
    amount_totalTotal amount to be charged
  3. UPI QR Code

    In the upi-qrcode flow, users scan a QR code, which redirects them to their UPI app to complete the transaction. Upon redirection, the UPI app loads the pre-filled payment details and prompts the user to enter their UPI PIN for authentication, finalizing the transaction.

    Request

    Use the following example to initiate a request.

    // ****** UPI QR Code ******
    curl -X POST \
    --location 'https://sandbox.ebanx.com/ws/direct' \
    --header 'Content-Type: application/json' \
    --data '{
    "integration_key": "your_ebanx_integration_key",
    "operation": "request",
    "payment": {
    "name": "John Doe",
    "email": "email@example.com",
    "phone_number": "7000000000",
    "address": "MG Road",
    "street_number": "101",
    "city": "Bangalore",
    "state": "KA",
    "zipcode": "560001",
    "country": "in",
    "payment_type_code": "upi-qrcode", // Set to 'upi-qrcode'.
    "merchant_payment_code": "0x012B01-IN-U01",
    "order_number": "1234567",
    "currency_code": "INR",
    "amount_total": "100.00"
    }
    }'

    Response

    A successful request returns a response like the example below.

    // ****** UPI QR Code ******
    "payment": {
    "hash": "656de0b6c82a3416e2ad70ef1234a774d405114b7c03b1fd",
    "country": "in",
    "merchant_payment_code": "0x012B01-IN-U01",
    "order_number": "1234567",
    "status": "PE",
    "status_date": null,
    "open_date": "2024-01-01 01:01:01",
    "confirm_date": null,
    "transfer_date": null,
    "amount_br": "100.00",
    "amount_ext": "100.00",
    "amount_iof": "0.00",
    "currency_rate": "1.0000",
    "currency_ext": "INR",
    "due_date": "2024-01-01 01:06:01",
    "instalments": "1",
    "payment_type_code": "upi-qrcode",
    "pre_approved": false,
    "capture_available": null,
    },
    "requested_currency" : "INR",
    "upi": {
    "q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4ojihMlhvagm9P0AWnGonIaJjGKuplJMO6HiEQLAyuscebHUZnp1BnX9A5cRAOwWnI3YNd9011a7LgtL8xMAWqh6/tuZD5zb0JmnMwSA743T2EoPUTM6c2smx/ix6fvjws0AfQGxa3ZsmtszCk6TTHYxBIBj+bdUq5fxhn88aXFaH5kfBFjAj4XDxNkmpGMnZ87nP18nAwD4sYlFgg+ruomBI5GfGentABKGI6+jfcadkj6Iy/T+ZfXNgCv1UNSQerSLFz3kaMe/+nAr4H/rD82DGsSsJwHxAAAAAElFTkSuQmCC",
    "expiration_date": "2024-01-01 09:36:01"
    },
    "currency_ext_base": "INR"
    },
    "status": "SUCCESS"
    }

    The Base64 encoded qr_code_value will be used to render the QR Code.

  4. UPI Intent

    In the upi-intent flow, mobile users select their preferred UPI app or choose the ‘Other UPI app’ option at checkout before proceeding with payment. Upon clicking to pay, they are redirected to their chosen UPI app. The app then loads the pre-filled payment details and prompts the user to enter their UPI PIN for authentication, completing the transaction.

    Request

    Use the following example to initiate a request.

    // ****** UPI Intent ******
    curl -X POST \
    --location 'https://sandbox.ebanx.com/ws/direct' \
    --header 'Content-Type: application/json' \
    --data '{
    "integration_key": "your_ebanx_integration_key",
    "operation": "request",
    "payment": {
    "name": "John Doe",
    "email": "email@example.com",
    "phone_number": "7000000000",
    "address": "MG Road",
    "street_number": "101",
    "city": "Bangalore",
    "state": "KA",
    "zipcode": "560001",
    "country": "in",
    "payment_type_code": "upi-intent", // Set to 'upi-intent'.
    "merchant_payment_code": "0x012B01-IN-U02",
    "order_number": "1234567",
    "currency_code": "INR",
    "amount_total": "100.00"
    }
    }'

    Response

    A successful request returns a response like the example below.

    // ****** UPI Intent ******
    {
    "payment": {
    "hash": "656de0b6c82a3416e2ad70ef1234a774d405114b7c03b1fd",
    "country": "in",
    "merchant_payment_code": "0x012B01-IN-U02",
    "order_number": "1234567",
    "status": "PE",
    "status_date": null,
    "open_date": "2024-01-01 01:01:01",
    "confirm_date": null,
    "transfer_date": null,
    "amount_br": "100.00",
    "amount_ext": "100.00",
    "amount_iof": "0.00",
    "currency_rate": "1.0000",
    "currency_ext": "INR",
    "due_date": "2024-01-01 01:06:01",
    "instalments": "1",
    "payment_type_code": "upi-intent",
    "pre_approved": false,
    "capture_available": null,
    },
    "requested_currency" : "INR",
    "upi": {
    "app_links": [
    "gpay://upi//pay?pa=pay.merch0000000@bankltd&pn=Merchant&am=1.00&tr=000000000000&mc=0000&mode=00&purpose=00"
    "phonepe://upi//pay?pa=pay.merch0000000@bankltd&pn=Merchant&am=1.00&tr=000000000000&mc=0000&mode=00&purpose=00",
    "paytm://upi//pay?pa=pay.merch0000000@bankltd&pn=Merchant&am=1.00&tr=000000000000&mc=0000&mode=00&purpose=00"
    ],
    "expiration_date": "2024-01-01 09:36:01"
    },
    "currency_ext_base": "INR"
    },
    "status": "SUCCESS"
    }

    App Links (Deep Links)

    Deep links are URLs that direct users to a specific app or page within an app, enabling seamless navigation directly to the desired content. The deep link details for launching specific UPI apps are provided within the app_links object.

    • Generic UPI App Link - When creating a URL to initiate a payment with a generic UPI app (instead of a specific one like Google Pay), you need to modify the URL structure:

      • Original URL for Google Pay - "gpay://upi//pay?" – This prefix is specifically for Google Pay.
      • Modified URL for a Generic UPI App - "upi:/pay?" – This is a standardized prefix that works with any UPI app.

    By changing the prefix from Google Pay to generic, you ensure compatibility with all UPI apps, allowing users to complete the payment using their preferred app, not just Google Pay. All other URL parameters related to the transaction remain the same.

    Redirection behavior

    The redirection behavior for the generic URL varies between Android and iOS devices. On Android, users will see a list of compatible apps installed on their device and can select their preferred app. On iOS, users are automatically redirected to a default app.

  5. Monitor payment for status change

    At this stage, the payment will appear as pending (PE) in your
    EBANX Dashboardchevron_right

    After completing UPI PIN authentication, your customer will receive a confirmation notification on their UPI app, indicating that the payment was successful.

    Notifications

    Status

    • After receiving a notification that status has changed, 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 eventually change to cancelled (CA).

  6. Congratulations!

    You have succesfully integrated UPI.

    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: