Initiate Transaction (SDK less) API

<html-block html=”

Request Headers

“>

Header NameHeader Value
Content-Typeapplication/json
X-VERIFYSHA256(base64 encoded payload +
“/v3/transaction/sdk-less/initiate” + salt key) + ‘###’ + salt index
X-CLIENT-IDThis will verify corresponding to the merchants. The default value will be merchant ID
X-CALLBACK-URLPlease 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 NameTypeDescriptionMandatory
merchantIdSTRINGUnique MerchantID assigned to the merchant by PhonePeYes
subMerchantIdSTRINGUnique subMerchantId assigned to the merchant by PhonePeOptional
transactionIdSTRINGUnique TransactionID generated by the merchant to track request to PhonePe
transactionId length should be less than 35 characters.
Yes
amountINTTransaction amount in PaiseYes
validForLONGTime in Miliseconds for which the payment is validYes
merchantOrderIdSTRINGOrderID generated by the merchant
merchantOrderId length should be less than 48 characters
Yes
redirectUrlSTRINGAs soon as user completes the transaction on PhonePe Switch, user will be redirected to this redirection URLYes
transactionContext STRINGBase 64 encoded of the cart details pertaining to the categoryYes

<html-block html=”

Response Parameters

“>

Parameter NameTypeDescription
successBOOLEANSuccess status of the request
codeENUMSee list of response codes below
dataObjectThe redirectUrl which needs to be open at the client side using the code as

<html-block html=”

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
API_RATE_LIMIT_REACHEDIf 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