Skip to main content
AutoPay mandates let your AI agent recharge a customer’s Cashfree AgentPay wallet whenever it runs low, without sending a payment link each time. The customer approves a UPI AutoPay mandate once. After that, your agent raises a charge for the amount it needs, up to a limit the customer agreed to.
AutoPay mandates are in beta. The tools, arguments and responses on this page may change before general availability. Contact the Cashfree sales team to enable them for your account before you build on them.
This feature is currently limited to the following options:
  • Plan type: ON_DEMAND. Your agent raises every charge. There’s no fixed charge schedule.
  • Payment method: UPI AutoPay (upi).

What your customer experiences

From the customer’s side, setting up AutoPay is a short chat. The following example shows a customer whose wallet balance is too low to pay a bill: The next time the wallet runs low, the agent tells the customer the amount and recharges the wallet without a new approval.

Key concepts

Keep these concepts in mind as you build your integration:
  • Consent comes first. Every AutoPay tool needs the customer’s access_token from the AgentPay consent step. See Get the customer’s consent.
  • A subscription holds the mandate. You create one subscription for each customer. It carries the plan, which sets plan_max_amount, the most any single recharge can be.
  • The customer authorises once. An AUTH payment returns a UPI AutoPay link. After the customer approves it, the subscription becomes ACTIVE.
  • Every recharge is a charge. A CHARGE payment debits the customer’s UPI account through the mandate. A charge isn’t instant. Cashfree sends the customer a pre-debit notification and debits their account at least 24 hours later, on or after the payment_schedule_date. The charge stays PENDING until then, and becomes SUCCESS or FAILED after the debit.
  • You choose the IDs. subscription_id and payment_id are your own references. They belong to this customer only, so a token for another customer can’t see or change them.
  • The phone number comes from the consent. Never ask the customer for it.
  • Ask the customer for their email address. create_subscription needs it, and it doesn’t come from the consent.

Set up AutoPay and recharge the wallet

Before you start, make sure you have:
  • The AgentPay MCP server connected to your agent. See Connect your agent.
  • A valid access_token for the customer from the AgentPay consent flow.
  • AutoPay mandates enabled for your account.
Here is the whole journey at a glance. The approval happens only once for each customer:
1

Create the subscription

Ask the customer for their email address, then call create_subscription with an ON_DEMAND plan. Set plan_max_amount to the largest recharge you expect to need:
Arguments
The subscription starts as INITIALIZED. Save the subscription_session_id for the next step.
2

Request UPI AutoPay approval

Call raise_subscription_charge with payment_type set to AUTH:
Arguments
The response contains UPI app links in data.payload. Send the customer the default link, or the link for their UPI app.
3

Wait for the customer to approve

The customer opens the link and approves the AutoPay mandate in their UPI app with their UPI PIN. Ask them to tell you when they’re done.
4

Confirm the subscription is active

Call get_subscription until subscription_status is ACTIVE and authorisation_details.authorization_status is ACTIVE. If the authorisation fails, tell the customer and send a new AUTH request with a new payment_id.Stop polling if the subscription reaches one of these statuses:
  • LINK_EXPIRED: the customer didn’t approve in time. Create a new subscription with a new subscription_id.
  • CUSTOMER_CANCELLED or CANCELLED: the subscription has ended. Create a new one only if the customer asks.
See Subscription statuses for every status.
5

Raise a recharge

When the wallet balance can’t cover what the customer wants to pay, tell the customer the amount, then call raise_subscription_charge with payment_type set to CHARGE:
Arguments
payment_amount can’t exceed the plan’s plan_max_amount. Use a new payment_id for every recharge.The debit happens at least 24 hours after Cashfree notifies the customer, so tell the customer when to expect the money.
6

Check the result

After the scheduled debit, call get_subscription_payments and find your payment_id. When payment_status is SUCCESS, check the balance with get_wallet_balance and continue with the bill payment. If the bill’s ref_id is more than 15 minutes old by then, fetch the bill again before you debit the wallet. If it’s FAILED, read failure_details.failure_reason and tell the customer.

Manage the mandate

After setup, you can change the subscription or a single recharge. Always confirm with the customer before you cancel anything. The following actions are available:
Cancel the subscription before you revoke consent. Revoking the customer’s AgentPay consent doesn’t cancel their UPI AutoPay mandate. After revocation, your agent can’t call the AutoPay tools for that customer. If the customer wants to stop using your agent, call manage_subscription with CANCEL first, then call revoke_consent.

Tool reference

AutoPay mandates add six tools to the AgentPay MCP server. Every tool needs the customer’s access_token. Tools that create or change something also accept an optional idempotency_key. Send the same key when you retry the same request, so Cashfree doesn’t process it twice. Send dates in ISO 8601 format with a time zone offset, for example 2026-11-12T00:00:00+05:30. Send all amounts in rupees, not paise. IDs can contain up to 200 letters, digits, dots, underscores or hyphens.

create_subscription

Creates an on-demand subscription for the consented customer.
Response

get_subscription

Returns the subscription’s current status and mandate details.
Response (excerpt)

Subscription statuses

A subscription can have the following statuses: When a customer pauses or cancels the mandate in their UPI app, the status changes within 30 to 45 minutes.

manage_subscription

Cancels the subscription. The response is the updated subscription, in the same format as get_subscription. CANCEL can’t be undone.

raise_subscription_charge

Requests UPI AutoPay approval, or raises a recharge on an active subscription.
Response (AUTH)
Response (CHARGE)
A CHARGE response isn’t the final result. Check get_subscription_payments until the payment is SUCCESS or FAILED.

get_subscription_payments

Lists every approval and recharge for the subscription.
Response
A payment moves from PENDING to SUCCESS, FAILED or CANCELLED.

manage_subscription_payment

Retries or cancels a single recharge. The response is the updated payment, in the same format as an item from get_subscription_payments.

Troubleshooting

The following table lists common errors and how to fix them:

Talk to the customer

Your agent talks to the customer in plain terms. Follow these practices:
  • Explain what AutoPay is for and the maximum amount per recharge before you send the approval link.
  • Tell the customer the amount before every recharge.
  • Confirm before you cancel a subscription or a recharge.
  • If the customer wants your agent to stop, cancel their subscription before you revoke consent.
  • Don’t mention tokens, session IDs, payment IDs or tool names.
  • Don’t ask for the customer’s phone number. It comes from their consent.

Test in sandbox

Use the same sandbox server URL, API key and consent OTP as in Test in sandbox, then complete the following checks:
  1. Setup. Create a subscription, request approval and confirm it becomes ACTIVE.
  2. Recharge. Raise a CHARGE and confirm it appears in get_subscription_payments.
  3. Limits. Raise a CHARGE above plan_max_amount and check that your agent handles the error.
  4. Retry. Retry a failed recharge with manage_subscription_payment.
  5. Cancel. Cancel the subscription and check that Cashfree refuses new recharges.
In beta, sandbox responses for AutoPay mandates are sample data. Statuses don’t change over time, so use them to check your request format and agent flow, not real payment outcomes.