Recurring Debit Execute
post https://api-preprod.phonepe.com/apis/pg-sandbox/v3/recurring/debit/execute

To debit the amount from the user’s account on recurring periods.

Headers

Header NameHeader Value
Content-Typeapplication/json
X-VERIFYSHA256(base64 encoded payload + “/v3/recurring/debit/execute” + salt key) + ### + salt index
Sample Payload for Base64
{ "merchantId": "MID12345", "merchantUserId": "U123456789", "subscriptionId": "OMS2006110139450123456789", "notificationId": "OMN2006110139450123456789", "transactionId": "TX1234567890" }

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.

Sample Request
{ "request":"ewogICJtZXJjaGFudElkIjogIk1JRDEyMzQ1IiwKICAibWVyY2hhbnRVc2VySWQiOiAiVTEyMzQ1Njc4OSIsCiAgInN1YnNjcmlwdGlvbklkIjogIk9NUzIwMDYxMTAxMzk0NTAxMjM0NTY3ODkiLAogICJub3RpZmljYXRpb25JZCI6ICJPTU4yMDA2MTEwMTM5NDUwMTIzNDU2Nzg5IiwKICAidHJhbnNhY3Rpb25JZCI6ICJUWDEyMzQ1Njc4OTAiCn0=" }

Request Parameters

Parameter NameData TypeMandatoryDescription
merchantIdStringYesMID provide by PhonePe
merchantUserIdStringNo
(Optional)
User’s unique Id maintained by merchant
subscriptionIdStringYesPhonePe subscription Id
notificationIdStringYesPhonePe’s notification Id sent in Recurring Init API response
transactionIdStringYesMerchant’s transaction Id of Recurring Init
Sample Response
{ "success": true, "code": "SUCCESS", "message": "Your request has been successfully submitted.", "data": { "merchantId": "MID12345", "transactionId": "TX1234567890", "state": "PENDING", "amount": 39900 } }

Response Parameters

Field NameData TypeDescription
merchantIdStringMerchant ID provided by PhonePe
transactionIdStringMerchant’s TransactionId of Recurring Init
notificationDetailsObjectContains notification details
transactionDetailsObjectSame as normal Transaction, please refer here
subscriptionDetailsObjectContains subscriptionId and state

S2S Callback – Recurring Debit Execute

Callback for Recurring Debit Execute

The server to server callback for Recurring Debit Execute will have the “callbackType”: “DEBIT”.

Validations

Validate the checksum and amount which has been passed with the response received in the Server to Server callback.

Sample Response

Sample S2S Callback Response - SUCCESSFUL Debit
{ "response": "ewogICJzdWNjZXNzIjogdHJ1ZSwKICAiY29kZSI6ICJTVUNDRVNTIiwKICAibWVzc2FnZSI6ICJZb3VyIHBheW1lbnQgaXMgc3VjY2Vzc2Z1bC4iLAogICJkYXRhIjogewogICAgImNhbGxiYWNrVHlwZSI6ICJERUJJVCIsCiAgICAibWVyY2hhbnRJZCI6ICJNSUQxMjM0NSIsCiAgICAidHJhbnNhY3Rpb25JZCI6ICJUWDEyMzQ1Njc4OTAiLAogICAgIm5vdGlmaWNhdGlvbkRldGFpbHMiOiB7CiAgICAgICJub3RpZmljYXRpb25JZCI6ICJPTU4yMDA2MTEwMTM5NDUwMTIzNDU2Nzg5IiwKICAgICAgInN0YXRlIjogIk5PVElGSUVEIiwKICAgICAgImFtb3VudCI6IDM5OTAwLAogICAgICAibm90aWZpZWRBdCI6ICIxNjIyNTM5NzUxNTg2IgogICAgfSwKICAgICJ0cmFuc2FjdGlvbkRldGFpbHMiOiB7CiAgICAgICJwcm92aWRlclJlZmVyZW5jZUlkIjogIlAxODA2MTUxMzIzMDkzOTAwNTU0OTU3IiwKICAgICAgImFtb3VudCI6IDM5OTAwLAogICAgICAic3RhdGUiOiAiQ09NUExFVEVEIiwKICAgICAgInBheVJlc3BvbnNlQ29kZSI6ICJTVUNDRVNTIiwKICAgICAgInBheW1lbnRNb2RlcyI6IFsKICAgICAgICB7CiAgICAgICAgICAibW9kZSI6ICJBQ0NPVU5UIiwKICAgICAgICAgICJhbW91bnQiOiAzOTkwMDAsCiAgICAgICAgICAidXRyIjogIjgxNjYyNjUyMTYxNiIsCiAgICAgICAgICAiaWZzYyI6ICJIREZDMDAwMDk5OSIsCiAgICAgICAgICAibWFza2VkQWNjb3VudE51bWJlciI6ICJYWFhYWFg5OTkiLAogICAgICAgICAgInVtbiI6ICI5MTIzZGFjMzU3ZGUxMjNjYjJjYmQ0NTI4MzQxMjMwNUB5YmwiCiAgICAgICAgfQogICAgICBdCiAgICB9LAogICAgInN1YnNjcmlwdGlvbkRldGFpbHMiOiB7CiAgICAgICJzdWJzY3JpcHRpb25JZCI6ICJPTVMyMDA2MTEwMTM5NDUwMTIzNDU2Nzg5IiwKICAgICAgInN0YXRlIjogIkFDVElWRSIKICAgIH0KICB9Cn0=" }
Base64 Decoded S2S Response - SUCCESSFUL Debit
{ "success": true, "code": "SUCCESS", "message": "Your payment is successful.", "data": { "callbackType": "DEBIT", "merchantId": "MID12345", "transactionId": "TX1234567890", "notificationDetails": { "notificationId": "OMN2006110139450123456789", "state": "NOTIFIED", "amount": 39900, "notifiedAt": "1622539751586" }, "transactionDetails": { "providerReferenceId": "P1806151323093900554957", "amount": 39900, "state": "COMPLETED", "payResponseCode": "SUCCESS", "paymentModes": [ { "mode": "ACCOUNT", "amount": 399000, "utr": "816626521616", "ifsc": "HDFC0000999", "maskedAccountNumber": "XXXXXX999", "umn": "9123dac357de123cb2cbd45283412305@ybl" } ] }, "subscriptionDetails": { "subscriptionId": "OMS2006110139450123456789", "state": "ACTIVE" } } }
Sample S2S Callback Response - FAILED Debit
{ "response": "ewogICJzdWNjZXNzIjogdHJ1ZSwKICAiY29kZSI6ICJTVUNDRVNTIiwKICAibWVzc2FnZSI6ICJQYXltZW50IEZhaWxlZCIsCiAgImRhdGEiOiB7CiAgICAiY2FsbGJhY2tUeXBlIjogIkRFQklUIiwKICAgICJtZXJjaGFudElkIjogIk1JRDEyMzQ1IiwKICAgICJ0cmFuc2FjdGlvbklkIjogIlRYMTIzNDU2Nzg5MCIsCiAgICAibm90aWZpY2F0aW9uRGV0YWlscyI6IHsKICAgICAgIm5vdGlmaWNhdGlvbklkIjogIk9NTjIwMDYxMTAxMzk0NTAxMjM0NTY3ODkiLAogICAgICAic3RhdGUiOiAiTk9USUZJRUQiLAogICAgICAiYW1vdW50IjogMzk5MDAsCiAgICAgICJub3RpZmllZEF0IjogIjE2MjI1Mzk3NTE1ODYiCiAgICB9LAogICAgInRyYW5zYWN0aW9uRGV0YWlscyI6IHsKICAgICAgInByb3ZpZGVyUmVmZXJlbmNlSWQiOiAiUDE4MDYxNTEzMjMwOTM5MDA1NTQ5NTciLAogICAgICAiYW1vdW50IjogMzk5MDAsCiAgICAgICJzdGF0ZSI6ICJGQUlMRUQiLAogICAgICAicGF5UmVzcG9uc2VDb2RlIjogIkFVVEhPUklaQVRJT05fRkFJTEVEIiwKICAgICAgInBheVJlc3BvbnNlQ29kZURlc2NyaXB0aW9uIjogIkJhbmsgZGlkIG5vdCBhdXRob3Jpc2UiLAogICAgICAicGF5bWVudE1vZGVzIjogWwogICAgICAgIHsKICAgICAgICAgICJtb2RlIjogIkFDQ09VTlQiLAogICAgICAgICAgImFtb3VudCI6IDM5OTAwMCwKICAgICAgICAgICJ1dHIiOiAiODE2NjI2NTIxNjE2IgogICAgICAgIH0KICAgICAgXQogICAgfSwKICAgICJzdWJzY3JpcHRpb25EZXRhaWxzIjogewogICAgICAic3Vic2NyaXB0aW9uSWQiOiAiT01TMjAwNjExMDEzOTQ1MDEyMzQ1Njc4OSIsCiAgICAgICJzdGF0ZSI6ICJBQ1RJVkUiCiAgICB9CiAgfQp9" }
Base64 Decoded S2S Response - FAILED Debit
{ "success": true, "code": "SUCCESS", "message": "Payment Failed", "data": { "callbackType": "DEBIT", "merchantId": "MID12345", "transactionId": "TX1234567890", "notificationDetails": { "notificationId": "OMN2006110139450123456789", "state": "NOTIFIED", "amount": 39900, "notifiedAt": "1622539751586" }, "transactionDetails": { "providerReferenceId": "P1806151323093900554957", "amount": 39900, "state": "FAILED", "payResponseCode": "AUTHORIZATION_FAILED", "payResponseCodeDescription": "Bank did not authorise", "paymentModes": [ { "mode": "ACCOUNT", "amount": 399000, "utr": "816626521616" } ] }, "subscriptionDetails": { "subscriptionId": "OMS2006110139450123456789", "state": "ACTIVE" } } }
{“method”:”post”,”url”:”/v3/recurring/debit/execute”,”auth”:”required”,”results”:{“codes”:[{“name”:””,”code”:”{\n \”success\”: true,\n \”code\”: \”SUCCESS\”,\n \”message\”: \”Your request has been successfully submitted.\”,\n \”data\”: {\n \”merchantId\”: \”MID12345\”,\n \”transactionId\”: \”TX1234567890\”,\n \”state\”: \”PENDING\”,\n \”amount\”: 39900\n }\n}”,”language”:”json”,”status”:200},{“name”:””,”code”:”{\n \”success\”: false,\n \”code\”: \”SUBSCRIPTION_NOT_FOUND\”,\n \”message\”: \”No Subscription found with the given details.\”,\n \”data\”: {}\n}”,”language”:”json”,”status”:400}]},”params”:[{“name”:”Content-Type”,”type”:”string”,”enumValues”:””,”default”:”application/json”,”desc”:””,”required”:true,”in”:”header”,”ref”:””,”_id”:”60af204fe658370029294c48″},{“name”:”X-VERIFY”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”SHA256(base64 encoded payload + \”/v3/recurring/debit/execute\” + salt key) + ### + salt index”,”required”:true,”in”:”header”,”ref”:””,”_id”:”60af204fe658370029294c47″},{“name”:”request”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”base64 encoded payload”,”required”:true,”in”:”body”,”ref”:””,”_id”:”60b75aa0852148003bcb654c”}],”apiSetting”:”63bb01b11abcf7046d98754c”,”examples”:{“codes”:[]}}
https://api-preprod.phonepe.com/apis/pg-sandbox

HEADERS
Content-Type string required
X-VERIFY string required
SHA256(base64 encoded payload + "/v3/recurring/debit/execute" + salt key) + ### + salt index

BODY PARAMS
request string required
base64 encoded payload

RESPONSES
Code 200
200
Code 400
400