<html-block html=”
Request Headers
“>
Header Name | Header Value |
---|---|
Content-Type | application/json |
X-VERIFY | SHA256(base64 encoded payload + “/v3/transaction/sdk-less/initiate” + salt key) + ‘###’ + salt index |
X-CLIENT-ID | This will verify corresponding to the merchants. The default value will be merchant ID |
X-CALLBACK-URL | Please find the details here |
Every service request has cart details that are typed by the category of that request. Here is an example for the category Bus.
The category tree is managed and maintained by PhonePe.
{
"merchantId":"MERCHANTTEST",
"amount":10000000,
"validFor":900000,
"subMerchantId":"SUBMERCHANTTEST",// needs to send only when mentioned by PhonePe integration team//
"transactionId":"T12RTRTBJGGTGJNYGB",
"merchantOrderId":"T12RTRTBJGGTGJNYGB",
"redirectUrl":"https://test-merchant.com/order/42314233232",
"transactionContext": "ewoJIm9yZGVyQ29udGV4dCI6IHsKCQkidHJhY2tpbmdJbmZvIjogewoJCQkidHlwZSI6ICJIVFRQUyIsCgkJCSJ1cmwiOiAiaHR0cHM6Ly9nb29nbGUuY29tIgoJCX0KCX0sCgkiZmFyZURldGFpbHMiOiB7CgkJInRvdGFsQW1vdW50IjogMzkwMCwKCQkicGF5YWJsZUFtb3VudCI6IDM5MDAKCX0sCgkiY2FydERldGFpbHMiOiB7CgkJImNhcnRJdGVtcyI6IFt7CgkJCSJjYXRlZ29yeSI6ICJTSE9QUElORyIsCgkJCSJpdGVtSWQiOiAiMTIzNDU2Nzg5MCIsCgkJCSJwcmljZSI6IDM5MDAsCgkJCSJpdGVtTmFtZSI6ICJURVNUIiwKCQkJInF1YW50aXR5IjogMQoJCX1dCgl9Cn0="
}
{ "request": "ewoibWVyY2hhbnRJZCI6Ik1FUkNIQU5UVEVTVCIsCiJhbW91bnQiOjEwMDAwMDAwLAoidmFsaWRGb3IiOjkwMDAwMCwKInN1Yk1lcmNoYW50SWQiOiJTVUJNRVJDSEFOVFRFU1QiLC8vIG5lZWRzIHRvIHNlbmQgb25seSB3aGVuIG1lbnRpb25lZCBieSBQaG9uZVBlIGludGVncmF0aW9uIHRlYW0vLwoidHJhbnNhY3Rpb25JZCI6IlQxMlJUUlRCSkdHVEdKTllHQiIiLAoibWVyY2hhbnRPcmRlcklkIjoiVDEyUlRSVEJKR0dUR0pOWUdCIiwKICJyZWRpcmVjdFVybCI6Imh0dHBzOi8vdGVzdC1tZXJjaGFudC5jb20vb3JkZXIvNDIzMTQyMzMyMzIiCiAidHJhbnNhY3Rpb25Db250ZXh0IjogImV3b0pJbTl5WkdWeVEyOXVkR1Y0ZENJNklIc0tDUWtpZEhKaFkydHBibWRKYm1adklqb2dld29KQ1FraWRIbHdaU0k2SUNKSVZGUlFVeUlzQ2drSkNTSjFjbXdpT2lBaWFIUjBjSE02THk5bmIyOW5iR1V1WTI5dElnb0pDWDBLQ1gwc0Nna2labUZ5WlVSbGRHRnBiSE1pT2lCN0Nna0pJblJ2ZEdGc1FXMXZkVzUwSWpvZ016a3dNQ3dLQ1FraWNHRjVZV0pzWlVGdGIzVnVkQ0k2SURNNU1EQUtDWDBzQ2draVkyRnlkRVJsZEdGcGJITWlPaUI3Q2drSkltTmhjblJKZEdWdGN5STZJRnQ3Q2drSkNTSmpZWFJsWjI5eWVTSTZJQ0pUU0U5UVVFbE9SeUlzQ2drSkNTSnBkR1Z0U1dRaU9pQWlNVEl6TkRVMk56ZzVNQ0lzQ2drSkNTSndjbWxqWlNJNklETTVNREFzQ2drSkNTSnBkR1Z0VG1GdFpTSTZJQ0pVUlZOVUlpd0tDUWtKSW5GMVlXNTBhWFI1SWpvZ01Rb0pDWDFkQ2dsOUNuMD0iCn0=" }
<html-block html=”
Request Parameters
“>
Parameter Name | Type | Description | Mandatory |
---|---|---|---|
merchantId | STRING | Unique MerchantID assigned to the merchant by PhonePe | Yes |
subMerchantId | STRING | Unique subMerchantId assigned to the merchant by PhonePe | Optional |
transactionId | STRING | Unique TransactionID generated by the merchant to track request to PhonePetransactionId length should be less than 35 characters. | Yes |
amount | INT | Transaction amount in Paise | Yes |
validFor | LONG | Time in Miliseconds for which the payment is valid | Yes |
merchantOrderId | STRING | OrderID generated by the merchantmerchantOrderId length should be less than 48 characters | Yes |
redirectUrl | STRING | As soon as user completes the transaction on PhonePe Switch, user will be redirected to this redirection URL | Yes |
transactionContext | STRING | Base 64 encoded of the cart details pertaining to the category | Yes |
<html-block html=”
Response Parameters
“>
Parameter Name | Type | Description |
---|---|---|
success | BOOLEAN | Success status of the request |
code | ENUM | See list of response codes below |
data | Object | The redirectUrl which needs to be open at the client side using the code as |
<html-block html=”
Response Codes
“>
Code | Description |
---|---|
INVALID_TRANSACTION_ID | Duplicate TransactionID |
INVALID_USER_AUTH_TOKEN | The userAuthToken provided is either invalid or not mapped to merchant. |
BAD_REQUEST | Invalid request payload |
AUTHORIZATION_FAILED | Incorrect X-VERIFY header |
INTERNAL_SERVER_ERROR | Something went wrong |
API_RATE_LIMIT_REACHED | If the API call limit is breached then HTTP status code 429 would be sent |
It’s recommended to have the server to server call back using x-callback-url header.
{“method”:”post”,”url”:”/v3/transaction/sdk-less/initiate”,”auth”:”required”,”results”:{“codes”:[{“name”:””,”code”:”\n{\n\”success\”:true,\n\”code\”:\”SUCCESS\”,\n\”data\”:{\n\”redirectUrl\”:\”phonepe://checkoutResolve?reservationId=R2001231624585218494402&redirectUrl=https://test-merchant.com/order/42314233232\”\n}\n}\n”,”language”:”json”,”status”:200},{“name”:””,”code”:”{}”,”language”:”json”,”status”:400}]},”params”:[{“name”:”X-VERIFY”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”SHA256(base64 encoded payload + \”/v3/transaction/sdk-less/initiate\” + salt key) + “###” + salt index”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5e9fe3c1267b41003b28c424″},{“name”:”X-CLIENT-ID”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”This will verify corresponding to the merchants. The default value will be merchant ID”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5e9fe3c1267b41003b28c423″},{“name”:”Content-Type”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”application/json”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5e9fe3c1267b41003b28c422″},{“name”:”X-CALLBACK-URL”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”Callback API of the merchant”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5e9fe3c1267b41003b28c421″}],”examples”:{“codes”:[]},”apiSetting”:”5da600be463ecf036287d7f3″}
https://apps-uat.phonepe.com