Skip to main content
A mandate is a one-time authorization from your customer that lets Flexprice charge their future invoices without asking them to pay each time. The lifecycle has three phases: the customer registers the mandate once at checkout, the first charge runs, and every invoice after that auto-debits in the background. Razorpay Checkout supports three collection methods: To debit a bank account instead, set up an eNACH mandate. Use a mandate when the customer will be billed repeatedly — a subscription, metered usage, or wallet top-ups. Use the one-time payment link when there is a single payment and nothing recurring.

Prerequisites

  • Razorpay connection with invoice sync enabled. Set sync_config.invoice.outbound: true when you connect Razorpay so future invoices sync automatically.
  • Customer contact (phone number). A mandate registration is rejected without it ("The contact field is required"). The requirement comes from Razorpay’s authorization step, so set contact when you create the customer if you plan to use autopay.
  • A plan and price in the currency you will charge. The examples below use INR.
Set contact at customer-creation time. Adding it later does not retroactively fix a mandate registration that already failed — you will need to start a new checkout.

Register a mandate at checkout

Razorpay supports UPI and card mandates through Checkout Sessions. eNACH bank mandates use the customer setup-intent API below instead of payment_provider_config. Create a checkout session and include payment_provider_config. This is what switches the session from a one-time payment link to a mandate registration.
The response is the same shape as any checkout session — a payment_action.url, this time a Razorpay UPI Autopay authorization link:
Redirect the customer to payment_action.url. They authorize the mandate once in their UPI app.

payment_provider_config fields

For Razorpay, payment_provider_config.notify_customer defaults to false. Set it to true to ask Razorpay to send the payment link to the customer.

Card mandate

A card mandate uses the same request. Change payment_method to CARD:
The response is the same — a Razorpay-hosted link where the customer enters card details and authorizes recurring charges. Everything after authorization works identically to UPI.

What happens after authorization

Once the customer authorizes, Razorpay confirms the mandate (token.confirmed) and captures the first payment (payment.captured). Flexprice marks the checkout session completed, activates the subscription, and finalizes the invoice — the same completion path as a one-time payment link. From then on, every new invoice for that customer is checked for a usable saved token and charged automatically, with no further customer action. This applies to subscription renewals, and also to one-off invoices and wallet top-up invoices. An invoice falls back to a normal Razorpay payment link when there is no usable saved token, or when the invoice amount exceeds max_mandate_limit. The fallback is automatic and safe to rely on — the customer receives a link to pay that invoice manually.
max_mandate_limit is a hard ceiling, not a soft warning. An invoice above it never auto-charges; it always falls back to a payment link. Set the limit high enough to cover your largest expected invoice.

Set up a Razorpay eNACH bank mandate

Razorpay eNACH setup creates a bank-mandate link. Razorpay saved eMandate tokens are represented as the ENACH payment method and include a bank_account object. The customer must already exist and have an email address and phone number. A Razorpay connection must be available for the customer’s billing entity. Create a setup intent with POST /v1/payments/customers/{id}/setup/intent:
max_amount is the per-debit ceiling in INR for eNACH and defaults to 99999. notify_customer defaults to false; set it to true to ask Razorpay to send the setup link to the customer. The HTTP 201 response includes setup_intent_id, checkout_url, provider status, customer_id, created_at, and expires_at. The timestamps are Unix seconds; expires_at is zero when Razorpay provides no expiry. Generic fields such as checkout_session_id, client_secret, and usage are empty for this Razorpay response. Redirect the customer to checkout_url, then read the latest status with GET /v1/payments/customers/{id}/setup/intent?provider=razorpay. Creating a new setup link replaces the customer’s latest link and attempts to cancel the previous link. If the create request times out, use the GET endpoint to check whether a new link was created before retrying the POST. To cancel the customer’s latest setup link, call POST /v1/payments/customers/{id}/setup/intent/cancel?provider=razorpay. The endpoint returns the setup-intent response and only cancels a link that has not been completed. Use the returned status; the API passes through the provider’s setup-link status.

Gotchas

  • contact is mandatory to register a mandate. Collect it at customer creation — see Prerequisites.
  • max_mandate_limit is a hard ceiling. Invoices above it fall back to a payment link rather than auto-charging. This is an intentional safety cap.
  • Currency casing. Send currency in any casing — Flexprice normalizes it to uppercase before calling Razorpay.

Razorpay Setup

Enable the webhook events, including the mandate events autopay needs.

Checkout Sessions API

Full field reference for the create session call.

Implementation Guide

End-to-end integration with webhook handling.