To cancel the subscription permanently

Headers

FieldMandatoryDescription
Content-TypeYesapplication/json
X-VerifyYesSHA256(base64 encoded payload + "/v3/recurring/subscription/cancel" + salt key) + ### + salt index
X-CALLBACK-URLYesThe callback URL to receive the server to server callback response.
{
	"merchantId":"MID12345",
	"merchantUserId":"U123456789",
	"subscriptionId":"OMS2006110139450123456789",
}

šŸ‘

Convert the JSON Payload to Base64 Encoded Payload

The above JSON request payload should be converted to the Base64 Encoded Payload and then the request should be sent in the below format.

{
  "request": "ewoJIm1lcmNoYW50SWQiOiJNSUQxMjM0NSIsCgkibWVyY2hhbnRVc2VySWQiOiJVMTIzNDU2Nzg5IiwKCSJzdWJzY3JpcHRpb25JZCI6Ik9NUzIwMDYxMTAxMzk0NTAxMjM0NTY3ODkiLAp9"
}

Request Parameters

Field NameData TypeMandatoryDescription
merchantIdStringYesUnique Id assigned to the merchant in the PhonePe system. Assigned during merchant onboarding.
merchantUserIdStringYesUnique Customer Id maintained by the merchant
subscriptionIdStringYesPhonePe generated Subscription Id
{
  "success": true,
  "code": "SUCCESS",
  "message": "Your subscription has been successfully suspended.",
  "data": {
    "subscriptionId": "OMS2006110139450123456789",
    "state": "CANCEL_IN_PROGRESS"
  }
}

Response Parameters

Field NameData TypeDescriptionComments
subscriptionIdStringPhonePe Subscription Id
stateStringCANCEL_IN_PROGRESSInline state response is
available only when the user
authentication is not required

Failure Response Fields Details

Field NameData TypeDescription
messageString
codeStringValues 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 NameHeader Value
Content-Typeapplication/json
X-VERIFYSHA256(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"
    }
  }
}
Language
Click Try It! to start a request and see the response here!