Skip to main content
This guide explains how to integrate UPI AutoPay on Cashfree Subscriptions, from product activation to your first live recurring charge. For eNACH (electronic mandate on the National Automated Clearing House, NACH, of the National Payments Corporation of India, NPCI) and card standing instructions, see Supported payment methods. For the rules that apply to UPI mandates, such as pre-debit notifications, retries, and limits, see UPI AutoPay rules and limits.

Prerequisites

Make sure that you have the following before you start:
  • An active Cashfree account. To create one, sign up on the Merchant Dashboard.
  • Completed know your customer (KYC) verification and an active Payment Gateway account. For details, see Account activation.
  • The Subscriptions product activated for your account. To request activation, contact your account manager or fill out the Support Form.
Activation can include a manual review, so request it before you plan a go-live date.

Choose an integration method

Decide how much of the mandate approval experience you want to build. The following table compares the two main methods: You can also use the Subscription Element SDKs, which give you a native mobile interface while Cashfree processes the mandate. To create subscriptions without code, for sales-led billing or testing, use the Merchant Dashboard or a Subscription Payment Form. If you’re not sure which method to use, start with Hosted Checkout. Choose seamless only if a redirect would harm your conversion or brand experience.

Integrate UPI AutoPay

Complete the following steps to build your integration:
1

Get API keys and set up webhooks

Log in to the Merchant Dashboard and go to Payment Gateway > Developers > API Keys to get your test and production keys. For details, see Authentication.Then register your webhook endpoint and subscribe to the following events:
  • SUBSCRIPTION_STATUS_CHANGED
  • SUBSCRIPTION_AUTH_STATUS
  • SUBSCRIPTION_PAYMENT_NOTIFICATION_INITIATED
  • SUBSCRIPTION_PAYMENT_SUCCESS
  • SUBSCRIPTION_PAYMENT_FAILED
  • SUBSCRIPTION_PAYMENT_CANCELLED
If you use merchant-controlled charging, also subscribe to SUBSCRIPTION_CONTROLLED_NOTIFICATION_STATUS and SUBSCRIPTION_CONTROLLED_EXECUTION_STATUS.Webhooks tell your system when a customer approves a mandate or a charge fails. If you miss them, your app can show an outdated status, such as a pending mandate that the customer already approved. Verify the signature of every webhook on your server before you act on it. For details, see Subscription webhook signature and Subscription webhooks.
2

Create a plan

A plan defines the billing rules that the customer approves. When you create it, choose the following:
  • Plan type: PERIODIC, where Cashfree raises each charge on a schedule, or ON_DEMAND, where you raise each charge yourself.
  • Amount: A fixed recurring amount for periodic plans, or a maximum amount for on-demand plans.
Create the plan from the Merchant Dashboard or with the Create Plan API (POST /pg/plans). For the plan fields, see Plans.
3

Create the subscription and get it authorised

Link a customer to the plan with the Create Subscription API (POST /pg/subscriptions). The response returns a subscription_session_id. For Hosted Checkout, use it to open the Cashfree authorisation checkout. For seamless, pass it to the Raise a Charge or Create an Auth API with payment_type set to AUTH.The customer approves the mandate with their UPI PIN in their UPI app, through UPI Intent or a QR code. For the authorisation and subscription lifecycle, see Create a subscription.
4

Charge the subscription

When the subscription is ACTIVE, Cashfree raises charges for periodic plans on schedule. For on-demand plans, raise each charge with the Raise a Charge or Create an Auth API (POST /pg/subscriptions/pay), with payment_type set to CHARGE.Every UPI AutoPay charge follows the pre-debit notification and retry rules in UPI AutoPay rules and limits. Cashfree sends the pre-debit notification before each charge that needs one, and you receive the SUBSCRIPTION_PAYMENT_NOTIFICATION_INITIATED webhook. The debit runs at least 24 hours after the notification succeeds. Test charges also wait 24 hours, so raise them a day ahead, or use the Simulate Payment API.To send pre-debit notifications and trigger debits yourself, see Merchant-controlled charging. For charge cut-off times, see Charge a subscription.You can’t change the amount or expiry of an active mandate directly. To charge a different amount on a periodic subscription, create a plan with the new amount and apply it with the CHANGE_PLAN action.
5

Manage and reconcile subscriptions

Manage active subscriptions from the Merchant Dashboard or with the Manage Subscription API (POST /pg/subscriptions/{subscription_id}/manage). The following table describes each action:
PAUSE and CHANGE_PLAN aren’t supported for on-demand subscriptions.
For more details, see Manage subscriptions.

API reference

The following table lists the APIs you use most often: For full schemas, headers, and error responses, see the Subscriptions API overview. To try the APIs, use the Postman collection.

Test and go live

Test end to end in the sandbox environment (https://sandbox.cashfree.com/pg) before you go live.

Sandbox testing checklist

Use this checklist to track your sandbox testing.
Have you tested mandate creation and a simulated UPI PIN approval in the sandbox environment?
Mandate approval is the first step for every subscription. If it fails, no charges can follow.
For test data, see Sandbox environment.
Have you tested mandate cancellation and a customer declining the mandate?
Your app must show the correct subscription status when a mandate doesn’t become active.
Check the status from the SUBSCRIPTION_STATUS_CHANGED and SUBSCRIPTION_AUTH_STATUS webhooks.
Have you tested the first charge and verified its webhook?
The first charge confirms that your plan, mandate, and webhook handling work together.
Check that your app updates the subscription when it receives SUBSCRIPTION_PAYMENT_SUCCESS.
Have you tested a charge that fails for insufficient funds?
Your app must respond correctly to failed charges and retries.
For the retry rules, see Failed debits and retries.
Have you implemented and tested webhook signature verification?
Without signature verification, your endpoint accepts any request that anyone sends to it.
For the verification steps, see Subscription webhook signature.

Go-live checklist

Use this checklist to confirm that you’re ready to switch to production.
Has Cashfree approved your KYC?
You can’t collect live recurring payments until your KYC is approved.
For the documents your business type needs, see Account activation.
Is Subscriptions activated in your production account?
Activation can include a manual review, which can delay your launch.
Contact your account manager or fill out the Support Form.
Have you added your production API keys to your environment configuration?
Test keys don’t work in production.
Log in to the Merchant Dashboard and go to Payment Gateway > Developers > API Keys.
Have you updated your webhook URLs to your live HTTPS endpoint?
Webhooks sent to a test endpoint never reach your production system.
For the events to subscribe to, see Subscription webhooks.
Have you mapped your error handling to the subscription error codes?
Unmapped errors leave customers without a clear next step.

Troubleshooting

The following table explains the subscription statuses that most often need attention after authorisation, and what to do for each: For all statuses, see Subscription lifecycle. For error codes, see Subscription error codes.