Recurring UPI with Direct API
About this guide
By following this basic integration guide, you will understand how you can start accepting recurring UPI payments in India using EBANX Direct API.
To complete a recurring transaction in India you will, basically, need to call three of our APIs; /ws/userenrollment/
to request a subscription registration, /ws/customerenrollment-notify/
one to trigger the mandatory pre debit notification to user, and /ws/direct/
to request the charge.
Availability
Recurring UPI integration for merchants offering digital products & services through Direct API is available to the following countries:
- India
If you are not integrated with EBANX Direct API yet, please take a look in this basic guide about it. Are you not sure if EBANX Direct API is the best option for your e-commerce? Please, talk with one of our integration specialists.
What you will need
Before starting your integration, please make sure that you have:
- An EBANX Sandbox account. That's not the case? Please sign up for an Sandbox Account here;
- Recurring UPI enabled in your EBANX Dashboard.
How it works
To complete recurring UPI integration through EBANX Direct API, please follow the steps below.
Enable recurring UPI
Recurring UPI availability may vary depending on your contract. So the first step is to check if it is active in your EBANX dashboard.
All set? We can go ahead to the next step, otherwise, please get in touch with our integration specialists.
Configure your Notification URL
For your recurring UPI flow, you will receive webhook notifications for subscription status updates (paused, revoked), pre-debit notifications to the user, and payment transaction events. Each time a webhook notification is received we will require you to query us for the latest status . Please refer to the instructions for configuring your URL Notifications Notifications.
Request a Subscription
Basic parameters
Parameter Description operation
Operation must be enrollment
integration_key
Your unique and secret integration key payment_type_code
For recurring payments in India the types currently available are upi-collect-autopay
Subscription details
Parameter Description enrollment.merchant_enrollment_code
Unique identifier associated with the subscription. (character limit : 254) enrollment.country
Two-letter country code - in
for India.subscription.subscription_name
Description for the subscription. subscription.expiration_date
Valididy for the subscription. subscription.frequency
Frequency rule for charging the subscription. Values accepted are: ondemand
,monthly
,biweekly
,weekly
.subscription.recurrence_rule
Must be on
if subscription.frequency ismonthly
,biweekly
orweekly
.subscription.recurrence_value
Mandatory for defining rules if subscription.frequency
ismonthly
,biweekly
orweekly
. Acceepted values are the following: forweekly
1 to 7, forbiweekly
1 to 16, formonthly
1 to 31.subscription.min_amount
Minimum amount (per charge) during the validity of subscription plan, in INR
. (should start from INR 1)subscription.max_amount
Maximum amount (per charge) during the validity of the subscription plan, in INR
. (max amount INR 100000)upi.vpa
Subscription payer UPI ID. Expected standard format is 'payer@vpa'. Mandatory if payment_type_code
isupi-collect-autopay
.info
Values shared in the following parameters on
subscription
object:subscription_name
,expiration_date
,frequency
,min_amount
andmax_amount
; will be displayed to the user on its UPI App along with the subscription authentication request.note
The values for pre-defined frequencies accepted on
subscription.frequency
are considered for setting the rules for when the charges for the subscription can be executed. This must not be considered as an automation of the subsequent actions required for charging a subscription. The pre debit nofitication to user and charge subscription actions will still be required and must be managed for all subsequent transactions. Charge attempts for subscriptions with a pre-defined rules outside such rules will be declined. In cases of skipping or missing the time window for such patter, the subscription status will not be altered or impacted, and the charge attempts can be normally handled in the following window. For more flexibility on handling your subscriptions charges, it is recommended to set theondemand
value for subscription frequency.tip
To set a fixed amount for the subscription request, values for
subscription.min_amount
andsubscription.max_amount
should be send with an equal amount information.Pre debit notification to user
Parameter description
Parameter Description integration_key
Your unique and secret integration key. amount
Amount for the upcoming charge being notified. merchant_enrollment_code
Unique enrollment code defined when subscription was registered. payment_execution_date
Time and date for the upcoming charge being notified. Expected format: yyyy-mm-dd hh:mm:ss
.Request example:
curl -L -X POST 'https://sandbox.ebanxpay.com/ws/customerenrollment-notify/ ' \-H 'Content-Type: application/json' \--data-raw '{"integration_key": "{{integration_key}}","amount": "1000","merchant_enrollment_code": "1234567ABCD","payment_execution_date": "2024-08-01 12:00:00"}'A successful request will return a JSON response like the one below.
{"status": "SUCCESS","notification": {"hash": "ac682d9c3b5a2f90150bjcbabe89b933f954e616fbd19e0dff99339f7586881f4e397ca7dd88baba9715d40f39562e8040c1898a551143574aa0f93fc07a4c6e","amount": "1000","status": "notified","payment_execution_date": "2024-08-01 12:00:00"}}caution
There is a mandatory wait period between the pre-debit notification to the user and the initiation of the subscription charge, which can only occur after receiving a successful response with the
"status": "notified."
. Customer needs to be notified 24hrs prior to the debit happening. Subscription charge attempts without a prior pre-debit notification to the user, or made within a shorter-than-required wait period, will be declined.Charge Subscription
The request for charging a Subscription will follow the same standards for the
ws/direct
charge requests, with the addition of some specific parameters related to the Subscription to which the charge belongs.Basic parameters
Basic parameters: integration_key
Your unique and secret integration key. operation
Operation must be request
.Charge parameters
Charge parameters: payment.name
Payer full name. payment.email
Customer email. payment.country
Two-letter country code - in
for India.payment.merchant_payment_code
Unique code for the payment. payment.currency_code
ISO-4217 Currency code transaction. Supported value: INR
.payment.amount_total
Charge amount payment.enrollment.merchant_enrollment_code
Unique identifier associated with the subscription.(character limit : 254) payment.enrollment.customer_notify_hash
Pre-debit notification. This is the hash received in the response when a pre-debit notification is successfully sent. Request example:
curl -L -X POST 'https://sandbox.ebanxpay.com/ws/direct' \-H 'Content-Type: application/json' \--data-raw '{"integration_key": "{{integration_key}}", "operation": "request","payment": {"name": "John Doe","email": "email@example.com","country": "in","payment_type_code": "upi-collect-autopay", "merchant_payment_code": "PMT1234567BC", "currency_code": "INR","amount_total": 1000,"enrollment": {"merchant_enrollment_code": "testautopay010811","customer_notify_hash": "561eb4005d491a7eb009af3f09355969b0f3ed51dda6f3bd99e50c4c41ab799e33 7a6cb9295cf4028a9ceccdc299850a07ecb123f0fef14bdcc6e7679633956d"}}}'A successful request will return a JSON response like the one below.
{"payment":{"hash":"66a22a492540fe35c3d6479aa88551d844ea66de7c193bd1","country":"in","merchant_payment_code":"PMT1234567BC","status":"PE","open_date":"2024-08-02 13:00:00","amount_br":"1000.00","amount_ext":"1000.00","amount_iof":"0.00","currency_rate":"1.0000","currency_ext":"INR","due_date":"2024-07-28","installments":"1","payment_type_code":"upi-collect-autopay","customer":{"email":"email@example.com","name":"John Doe"}},"status":"SUCCESS"}info
After receiving a successful
pre debit notification to the user
and meeting the mandatory wait period requirement, a total of 3 attempts for charging the transaction will be allowed. At this point you have apending
(PE
) payment in your EBANX Dashboard.Wait for the payment
As soon as EBANX identifies that the payment was confirmed, payment status is modified from
pending
toconfirmed
.If, for cases where 2FA are required for approving the transaction, your customers don't conclude the payment, it will be automatically canceled.
Query Enrollment
During any enrollment status change, EBANX will notify merchant via our async notification, for example:
operation=enrollment_status_change¬ification_type=update&merchant_enrollment_code=testenrollment00104Additionally, EBANX supports merchants to actively retrieve user enrollment status before performing consecutive notification and transaction.
Endpoint:
https://api.ebanx.com/ws/userenrollments/query
Sample request:
{"integration_key":"DEMO_KEY","operation":"query","payment_type_code":"upi-collect-autopay","enrollment":{"merchant_enrollment_code":"testMandateProdUPI131101","country":"in"}}Response:
{"status": "SUCCESS","enrollment": {"status": "accepted"}}Revoke an Enrollment
If you require to revoke/cancel a subscription for a customer , you can simply send us a request with
operation : "cancel"
, this will immediately cancel the subscription.Sample request:
{"integration_key": "6e590512de1c170a4fa943025e3fb946ebxlfe","operation": "cancel","payment_type_code": "upi-collect-autopay","enrollment": {"merchant_enrollment_code": "1234567ABCD","email": "email@example.com","country": "IN"}}Response:
{"status": "SUCCESS","enrollment": {"status": "revoked"}}
Request example:
A successful request will return a JSON response like the one below.
tip
For subscriptions with expected charge amounts lower than INR 15.000, the auto-debit can be enabled for the subsequent charges. The auto-debit will exempt the requirement for 2FA on user end (PIN authentication for UPI transactions) for the succeding transactions with amount under 15.000 INR. For that, the first charge must be executed within 5 minutes from mandate registration. Important: This will not exempt the subsequent charges from the mandatory pre debit notification to the user. Charges above INR 15,000 will always require user authentication (2FA) for approval. In these cases, the maximum time for users to confirm the transaction is up to 60 minutes after the Subscription Charge was requested.
Top 5 Third Party App VPA examples: PhonePe VPA: @ybl / @ibl / @axl Google Pay VPA: @okaxis PayTM VPA: @paytm Amazon Pay VPA: @apl
Top 5 bank VPA examples: State Bank of India: @sbi ICICI Bank: @icici HDFC Bank: @hdfcbank Axis Bank: @axisbank Punjab National Bank: @pnb
Please note these are just the most common VPA addresses likely to be visible but it can vary bank to bank.
info
The complete API reference for the end-point ws/direct
can be found here. We strongly recommend you to take a look in all the available options.
Getting help
We hope this article was enlightening, but in case we’ve failed to take out your doubts you have the following options to keep on seeking for answers:
- If you’re not our partner yet and would like to know more about our prices and conditions please fill ou this form and our comercial team will get in touch with you.
- In case you’re already our partner please get in touch with our support team at integration@ebanx.com.