Users can cancel the subscription from the PhonePe app under AutoPay by selecting “Remove Autopay”. This is known as Revoke 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.revoked
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 parameter will be a epoch timestamp (in milliseconds)
Sample S2S Responses
Autopay – Revoke Subscription
Note: Merchants should rely only on the highlighted “payload.state” parameter for the subscription state.
{
"type": "SUBSCRIPTION_REVOKED",
"payload": {
"merchantSubscriptionId": "MS1708797962855",
"subscriptionId": "OMS2402242336054995042603",
"state": "REVOKED",
"authWorkflowType": "TRANSACTION",
"amountType": "FIXED",
"maxAmount": 200,
"frequency": "ON_DEMAND",
"expireAt": 1737278524000,
"pauseStartDate": null,
"pauseEndDate": null
}
}