Users can PAUSE/UNPAUSE the recurring payment in subscription from the PhonePe app under the AutoPay section. This is known as PAUSE/UNPAUSE Subscription. In such a case, PhonePe will send the S2S Callback response to inform the merchants.
Webhook Configuration
Merchants can configure the Webhook/S2S Callback URLs along with username & password.
PROD – Merchants can configure URL, Username and Password on the PhonePe dashboard.
UAT – Merchants can reach out to the Integration Team
- Once the username and password is configured, PhonePe will pass the same SHA256 (username:password) as the “Authorization” header in s2s response.
- Merchants should calculate using the same logic and match with the one passed by PhonePe. If both are matching, then the response payload can be consumed by the merchant. Otherwise, merchants should ignore the response.
Callback Types
- subscription.paused
- subscription.unpaused
Authorization
PhonePe will pass the authorization header as:
- Authorization : SHA256(username:password)
Callback Validation/Verification flow for merchants
For the incoming request, extract the basic authorization header “Authorization”, verify it with the one which you have shared with us and accept the response if Username and password matches.
Key Notes
- Merchants should rely only on the root level “payload.state” parameter for the subscription state.
- Avoid Strict Deserialization
- Don’t rely on “type” parameter in the webhook response (This will be deprecated) instead rely on the “event” parameter only for the webhook event name.
- expireAt, pauseStartDate and pauseEndDate parameters will be a epoch timestamp (in milliseconds)
Sample S2S Responses
Autopay – Pause Subscription
Note: Merchants should rely only on the highlighted “payload.state” parameter for the subscription state.
{
"type": "SUBSCRIPTION_PAUSED",
"payload": {
"merchantSubscriptionId": "MS1708797962855",
"subscriptionId": "OMS2402242336054995042603",
"state": "PAUSED",
"authWorkflowType": "TRANSACTION",
"amountType": "FIXED",
"maxAmount": 200,
"frequency": "ON_DEMAND",
"expireAt": 1737278524000,
"pauseStartDate": 1708798426196,
"pauseEndDate": 1708885799000
}
}
Autopay – UnPause Subscription
Note: Merchants should rely only on the highlighted “payload.state” parameter for the subscription state.
{
"type": "SUBSCRIPTION_UNPAUSED",
"payload": {
"merchantSubscriptionId": "MS1708797962855",
"subscriptionId": "OMS2402242336054995042603",
"state": "ACTIVE",
"authWorkflowType": "TRANSACTION",
"amountType": "FIXED",
"maxAmount": 200,
"frequency": "ON_DEMAND",
"expireAt": 1737278524000,
"pauseStartDate": null,
"pauseEndDate": null
}
}
Key Points
UNPAUSE Subscription:
- UnPause can be controlled by the user on the PhonePe App as well as by the merchant if the pauseEndDate received in the Pause Callback has elapsed.
- If the Redemption Notify is successful and then the user Pause the Subscription, in this case, the Redemption can’t be executed.
- Once the Redemption Notify is successful, the user Pause the Subscription. Now, if the user UNPause the Subscription, the Redemption can’t be executed directly. Again the Redemption Notify has to be done and then followed by the Redemption after 24hrs from the Successful Notification.
- Cancel/Revoke is allowed even if the mandate is in PAUSED State.
- As a best practice and to avoid any known failures in Redemption Notify or Redemption Execute, it is recommended to call the Subscription Status and ensure the state is “ACTIVE” before any of these two API Calls.