post https://mercury-uat.phonepe.com/v3/recurring/subscription/cancel
To cancel the subscription permanently
Headers
Field | Mandatory | Description |
---|---|---|
Content-Type | Yes | application/json |
X-Verify | Yes | SHA256(base64 encoded payload + "/v3/recurring/subscription/cancel" + salt key) + ### + salt index |
X-CALLBACK-URL | Yes | The callback URL to receive the server to server callback response. |
X-CALL-MODE | Yes | Value will be POST. |
{
"merchantId":"MID12345",
"merchantUserId":"U123456789",
"subscriptionId":"OMS2006110139450123456789",
}
{
"request": "ewoJIm1lcmNoYW50SWQiOiJNSUQxMjM0NSIsCgkibWVyY2hhbnRVc2VySWQiOiJVMTIzNDU2Nzg5IiwKCSJzdWJzY3JpcHRpb25JZCI6Ik9NUzIwMDYxMTAxMzk0NTAxMjM0NTY3ODkiLAp9"
}
Request Parameters
Field Name | Data Type | Mandatory | Description |
---|---|---|---|
merchantId | String | Yes | Unique Id assigned to the merchant in the PhonePe system. Assigned during merchant onboarding. |
merchantUserId | String | Yes | Unique Customer Id maintained by the merchant |
subscriptionId | String | Yes | PhonePe generated Subscription Id |
{
"success": true,
"code": "SUCCESS",
"message": "Your subscription has been successfully suspended.",
"data": {
"subscriptionId": "OMS2006110139450123456789",
"state": "CANCEL_IN_PROGRESS"
}
}
Response Parameters
Field Name | Data Type | Description | Comments |
---|---|---|---|
subscriptionId | String | PhonePe Subscription Id | |
state | String | CANCEL_IN_PROGRESS | Inline state response is available only when the user authentication is not required |
Failure Response Fields Details
Field Name | Data Type | Description |
---|---|---|
message | String | |
code | String | Values can be: ● SUBSCRIPTION_NOT_FOUND ● SUBSCRIPTION_NOT_ACTIVE ● SUBSCRIPTION_EXPIRED ● SUBSCRIPTION_FAILED ● SUBSCRIPTION_REVOKE_IN_PROGRESS ● SUBSCRIPTION_ALREADY_REVOKED ● SUBSCRIPTION_CANCEL_IN_PROGRES ● INVALID_SUBSCRIPTION_STATE ● SUBSCRIPTION_ALREADY_CANCELLED |
S2S Callback - Cancel Subscription
Callback for Cancel Subscription
The server to server callback for Cancel 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 |
Sample Response
{
"response":"eyJzdWNjZXNzIjp0cnVlLCJjb2RlIjoiU1VDQ0VTUyIsIm1lc3NhZ2UiOiJZb3VyIHN1YnNjcmlwdGlvbiByZXF1ZXN0IGhhcyBiZWVuIHJldm9rZWQuIiwiZGF0YSI6eyJjYWxsYmFja1R5cGUiOiJTVUJTQ1JJUFRJT04iLCJtZXJjaGFudElkIjoiTUVSQ0hBTlRVQVQiLCJtZXJjaGFudFN1YnNjcmlwdGlvbklkIjoiYTcyOGE4NGEtIiwic3Vic2NyaXB0aW9uRGV0YWlscyI6eyJzdWJzY3JpcHRpb25JZCI6Ik9NUzIxMDcyMTEyMzYzNDUzNTU4NzM3OTUiLCJzdGF0ZSI6IlJFVk9LRUQifX19"
}
{
"success": true,
"code": "SUCCESS",
"message": "Your subscription request has been cancelled.",
"data": {
"callbackType": "SUBSCRIPTION",
"merchantId": "MERCHANTUAT",
"merchantSubscriptionId": "a728a84a-",
"subscriptionDetails": {
"subscriptionId": "OMS2107211236345355873795",
"state": "CANCELLED"
}
}
}