Accept Payments v4

<html-block html=”

Request Headers

“>

Header NameHeader Value
Content-Typeapplication/json
X-VERIFYSHA256(base64 encoded payload + “/v4/debit” +
salt key) + ### + salt index
X-REDIRECT-URLDynamic redirect URI for UI callback
X-REDIRECT-MODEHTTP mode to be used for UI callback
X-CALLBACK-URLDynamic callback URI for server to server callback
X-CALL-MODEHTTP mode to be used for server to server callback
X-PROVIDER-IDUsed for the cases where the merchant has multiple merchant IDs
{  
   "merchantId":"M2306160483220675579140",
   "transactionId":"TX123456789",
   "merchantUserId":"U123456789",
   "amount":100,
   "merchantOrderId":"OD1234",
   "mobileNumber":"9xxxxxxxxx",
   "message":"payment for order placed OD1234",
   "subMerchant":"DemoMerchant",
   "email":"amit***[email protected]",
   "shortName":"Amit"
}
{
  "request": "eyAgCiAgICJtZXJjaGFudElkIjoiTTIzMDYxNjA0ODMyMjA2NzU1NzkxNDAiLAogICAidHJhbnNhY3Rpb25JZCI6IlRYMTIzNDU2Nzg5IiwKICAgIm1lcmNoYW50VXNlcklkIjoiVTEyMzQ1Njc4OSIsCiAgICJhbW91bnQiOjEwMCwKICAgIm1lcmNoYW50T3JkZXJJZCI6Ik9EMTIzNCIsCiAgICJtb2JpbGVOdW1iZXIiOiI5eHh4eHh4eHh4IiwKICAgIm1lc3NhZ2UiOiJwYXltZW50IGZvciBvcmRlciBwbGFjZWQgT0QxMjM0IiwKICAgInN1Yk1lcmNoYW50IjoiRGVtb01lcmNoYW50IiwKICAgImVtYWlsIjoiYW1pdCoqKjc1QGdtYWlsLmNvbSIsCiAgICJzaG9ydE5hbWUiOiJBbWl0Igp9"
}

<html-block html=”

Request Parameters

“>

Parameter NameTypeDescriptionMandatory
merchantIdSTRINGUnique MerchantID assigned to the merchant by PhonePeYes
transactionIdSTRINGUnique TransactionID generated by the merchant to track request to PhonePe
transactionId length should be less than 38 characters.
Yes
merchantUserIdSTRINGUnique UserID generated by merchant. This is used to pre-login users authenticated on PhonePe. Un-authenticated users are redirected to PhonePe login page. Conversions are higher when this is provided. Avoid passing email/mobile number.
Skip this for guest users.
Note:
Don't pass this if you are passing userAuthToken.
Yes
userAuthTokenSTRINGUnique userAuthTokengiven to merchant in OTP flow. This is used to pre-login users authenticated on PhonePe. If not passed users will be redirected to PhonePe login page.
Note : Used only for OTP linking flow.

amountLONGTransaction amount in PaiseYes
merchantOrderIdSTRINGOrderID generated by the merchant
merchantOrderId length should be less than 48 characters.
No
subMerchantSTRING.Tag to categorize merchant transaction.
Skip this field if you don’t have multiple merchants tagged under one merchant id
No
mobileNumberSTRINGMobile number of the userNo
messageSTRINGShort message. This message is displayed to the user on completion of payment.No
emailSTRINGEmail address of the userNo
shortNameSTRINGUser’s name pre-filled for registration purpose.No

<html-block html=”

Response Parameters

“>

Parameter NameTypeDescription
successBooleanSuccess status of the request
codeEnumSee list of response codes below
shortNameStringShort message about code

<html-block html=”

Regular Debit Response Codes

“>

CodeDescription
INVALID_TRANSACTION_IDDuplicate TransactionID
INVALID_USER_AUTH_TOKENThe userAuthToken provided is either invalid or not mapped to merchant.
BAD_REQUESTInvalid request payload
AUTHORIZATION_FAILEDIncorrect X-VERIFY header
INTERNAL_SERVER_ERRORSomething went wrong

1.Make sure that ‘follow redirection’ is disabled while calling this API.
2.This location endpoint should be appended to host to get the complete redirection URL.
3.It’s recommended to have the server to server call back using x-callback-url header.

Once the transaction is complete, user will be redirected back to the merchant.

{“method”:”post”,”url”:”/v4/debit/”,”auth”:”required”,”results”:{“codes”:[{“name”:”Success Response”,”code”:”{\n \”code\”: \”SUCCESS\”,\n \”message\”: \”Your request has been successfully completed.\”,\n \”data\”: {\n \”redirectType\”: \”WEB\”,\n \”redirectURL\”: \”https://mercury.phonepe.com/transaction?token=fkjsdfka9248jfksjdfkilfjksdk\”\n }\n}”,”language”:”json”,”status”:200},{“name”:”Failure Response”,”code”:”{\n \”success\”: false,\n \”code\”: \”INVALID_TRANSACTION_ID\”,\n \”message\”: \”The transaction id you have entered seems to be invalid.\”,\n \”data\”: {}\n}”,”language”:”json”,”status”:400}]},”params”:[{“name”:”request”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”base64 encoded payload”,”required”:true,”in”:”body”,”ref”:””,”_id”:”5d4810816939910051e3b208″},{“name”:”Content-Type”,”type”:”string”,”enumValues”:””,”default”:”application/json”,”desc”:””,”required”:true,”in”:”header”,”ref”:””,”_id”:”5d4810816939910051e3b207″},{“name”:”X-VERIFY”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”SHA256(base64 encoded payload + \”/v4/debit\” + salt key) + ### + salt index”,”required”:true,”in”:”header”,”ref”:””,”_id”:”5d4810816939910051e3b206″},{“name”:”X-REDIRECT-URL”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”Dynamic redirect URI for UI callback”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5d4810816939910051e3b205″},{“name”:”X-REDIRECT-MODE”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”HTTP mode to be used for UI callback. Default Values are REDIRECT/POST.”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5d4810816939910051e3b204″},{“name”:”X-CALLBACK-URL”,”type”:”string”,”enumValues”:””,”default”:”https://www.demoMerchant.com/callback”,”desc”:”Dynamic callback URI for server to server callback”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5d4810816939910051e3b203″},{“name”:”X-CALL-MODE”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”HTTP mode to be used for server to server callback. Default Values are POST/PUT”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5d4810816939910051e3b202″}],”apiSetting”:”5ecf9143b5bd210023b3b738″,”examples”:{“codes”:[]}}
https://mercury-uat.phonepe.com