Revoke Subscription:
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.
- Server to server callback responses for REVOKE is initiated from the PhonePe server to the url provided by the merchant.
- In order to receive the S2S response, register your Static Callback URL with PhonePe.
- The payload that is going to be sent to the merchant on the specified callback url will have a base64 encoded JSON. Upon base64 decoding the response, you should get a JSON response.
S2S Callback – Revoke Subscription
Callback for Cancel Subscription
The server to server callback for Revoke Subscription will have the “callbackType”: “SUBSCRIPTION”.
Validations
Validate the checksum which has been passed in the response headers received in the Server to Server callback.
Callback headers
Following are the response headers sent with a callback.
Header Name | Header Value |
---|---|
Content-Type | application/json |
X-VERIFY | SHA256(base64response + salt key) + ### + salt index |
{
"response": "eyJzdWNjZXNzIjp0cnVlLCJjb2RlIjoiU1VDQ0VTUyIsIm1lc3NhZ2UiOiJZb3VyIHN1YnNjcmlwdGlvbiBpcyByZXZva2VkLiIsImRhdGEiOnsiY2FsbGJhY2tUeXBlIjoiU1VCU0NSSVBUSU9OIiwibWVyY2hhbnRJZCI6IlVBVE1FUkNIQU5UIiwibWVyY2hhbnRTdWJzY3JpcHRpb25JZCI6IjQ0ZGVkMDhmLSIsInN1YnNjcmlwdGlvbkRldGFpbHMiOnsic3Vic2NyaXB0aW9uSWQiOiJPTVMyMTA3MTQxNzUzMzEwMjA4MzAxNzQ4Iiwic3RhdGUiOiJSRVZPS0VEIn19fQ=="
}
{
"success": true,
"code": "SUCCESS",
"message": "Your subscription is revoked.",
"data": {
"callbackType": "SUBSCRIPTION",
"merchantId": "UATMERCHANT",
"merchantSubscriptionId": "44ded08f-",
"subscriptionDetails": {
"subscriptionId": "OMS2107141753310208301748",
"state": "REVOKED"
}
}
}