Autopay Integration


Here’s how the integration process with PhonePe Payment Gateway works.
Follow the steps outlined below to set up and verify your payment flow with ease.

Authentication is the first step in PhonePe Payment Gateway’s Standard Autopay API integration. It involves generating an authorization token to make further API calls. 

Creating an authorization token to make API calls means generating a unique key or password that proves your system has permission to interact with PhonePe Payment Gateway. This token identifies and authenticates your website when it requests services like processing payments, checking status, etc.

For complete details, refer to the Generate Authorization Token.

In this step, you will simultaneously create a user subscription and set up its payment mandate. The integration flow differs based on your platform:

  • Web Applications: Use the Checkout API to create the subscription and initiate the mandate setup directly within the web interface.
  • Mobile Applications: Use the Order Token API to generate a unique orderToken. Pass this token to the Mobile SDK to allow the user to authorize the mandate via their preferred UPI app.

Once the user completes the mandate through mandate supported apps( PhonePe, BHIM, GPay, Paytm, CRED, Amazon Pay, SuperMoney), use Subscription Order Status API to check the status of a Subscription Setup after initiating it.
To check the status of the Subscription, use the Subscription Status API to retrieve the current Subscription Status.

In this step, You must notify users 24 hours before a scheduled debit. This is a mandatory requirement for all active subscriptions to ensure transparency before funds are deducted. This API call is a prerequisite; you cannot execute a subscription redemption without first completing this step.

For complete details, refer to the Notify Redemption.

After initiating a redemption request for an active subscription, use the Redemption Order Status API to check the execution status and check whether the redemption has been notified, is in pending, or completed.

The Redemption Execute API is to directly debit the required payment from a user’s bank account, thereby initiating and completing the actual financial transaction. This API should be called from the backend only if the auto-debit is set to false.

For complete details, refer to the Execute Redemption.

After executing the redemption for an active subscription, use the Redemption Order Status API to check the execution status and check whether the redemption is successful, is in pending, or failed.

In a subscription system, it’s important to know whether a payment was successful, failed, or still pending.

PhonePe supports this with automated callbacks for two key events:

  • Subscription Callbacks
    Sent when a new subscription is created. These confirm if the user’s first payment was successful or not, helping you handle activation or failure from the start.
  • Redemption Callbacks
    Sent for ongoing auto debits. These share the status of each recurring payment and provide individual transaction details, which are useful for retries and reconciliation.
  • Cancel Subscription: Use the Cancel Subscription API to deactivate an active autopay subscription that is no longer required.
  • Pause or Unpause Subscription: PhonePe will send an Webhook callback to notify you that the subscription has been Paused/Unpaused from the user’s end.
  • Revoke Subscription: PhonePe will send an Webhook callback to notify you that the subscription has been cancelled from the user’s end.
  • Initiate Refund and Check Refund Status: The Refund API allows you to initiate refunds for specific transactions, returning funds to customers for reasons like order cancellations, returns, or payment adjustments. You can also check the status of the initiated refund.

Now that you are aware of what Autopay is, let’s explore how to integrate the Autopay feature.

Is this article helpful?