Accept Payments Testing

<html-block html=”

Request Headers

“>

Header NameHeader Value
Content-Typeapplication/json
X-VERIFYSHA256(base64 encoded payload + “/v4/debit” + salt key) + ### + salt index
X-CALLBACK-URLS2S callback url
X-CALL-MODES2S call mode (POST/ PUT)
{	
	"merchantId": "M2306160483220675579140", // String Mandatory
	"transactionId": "e3e1mmcccdmm9ef8vdfmd7b", // String Mandatory
	"merchantUserId": "unknown8898", // String Mandatory - used for auto login.
	"amount": 200, // long Mandatory - amount should be in paise
	"merchantOrderId": "OD139924923", // String Mandatory
	"subMerchant": "unknown8898", // String - ONLY if sub merchant id is allocated to you 
	"mobileNumber": "unknown8898", // String - mobile number of the user
	"message": "Payment towards order No. OD139924923.", // String - message will be displayed on completion of payment.
	"email": "xMerchantId", // String - email id of the user.
	"shortName": "OD139924923", // String - user name is pre filled for registration purpose.
	"paymentScope": "PHONEPE", // String Mandatory - value should be PHONEPE only
	"deviceContext":{  // Object Mandatory
		"phonePeVersionCode": 303391 // Long Mandatory - returns intent URI
	}
}

// transactionId length should be less than 38 characters. 
// merchantOrderId length should be less than 48 characters.

<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.
Only for OTP linking flow.
amountLONGTransaction amount in PaiseYes
merchantOrderIdSTRINGOrderID generated by the merchant
merchantOrderId length should be less than 48 characters.
Yes
subMerchantSTRINGTag to categorize merchant transaction.
Skip this field if you don’t have multiple merchants tagged under one merchant id.
No
mobileNumber
STRINGMobile 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
paymentScopeSTRINGValue should be “PHONEPE”Yes
deviceContextOBJECTPhonePe version codeYes
merchantContextOBJECTRefer Deep Offer APINo

<html-block html=”

Response Parameters

“>

Parameter NameTypeDescription
successBOOLEANSuccess status of the request
codeENUMSee list of response codes below
{“method”:”post”,”url”:”/v4/debit”,”auth”:”required”,”examples”:{“codes”:[]},”apiSetting”:”5ecf9143b5bd210023b3b738″,”results”:{“codes”:[{“name”:””,”code”:”{\n\t\”code\”: \”SUCCESS\”,\n\t\”message\”: \”Your request has been successfully completed.\”,\n\t\”data\”: {\n\t\t\”redirectType\”: \”INTENT\”,\n\t\t\”redirectURL\”: \”upi://pay? \tpn=PAYU&pa=PAYUPAYMENTS@ybl&tid=YBL6663638d0312408a8f54f7df8f1bd6b9&tr=P1812191027266848105909&am=405.00&mam=405.00&cu=INR&url=https://phonepe.com&mc=7299&tn=Payment%20for%207787496005&utm_source=7787496005&utm_medium=PAYUPAYMENTS&utm_campaign=DEBIT\”\n\t}\n}\n\n\n”,”language”:”json”,”status”:200},{“name”:””,”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”:false,”in”:”body”,”ref”:””,”_id”:”5c4ed5db77417c00395f31d3″},{“name”:”Content-Type”,”type”:”string”,”enumValues”:””,”default”:”application/json”,”desc”:””,”required”:true,”in”:”header”,”ref”:””,”_id”:”5c4ed5db77417c00395f31d2″},{“name”:”X-VERIFY”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”SHA256(base64 encoded payload + \”/v4/debit\” + salt key) + ### + salt index”,”required”:true,”in”:”header”,”ref”:””,”_id”:”5c4ed5db77417c00395f31d1″},{“name”:”X-CALLBACK-URL”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”S2S callback url”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5c4ed5db77417c00395f31ce”},{“name”:”X-CALL-MODE”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”S2S call mode (POST/ PUT)”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5c4ed5db77417c00395f31cd”}]}
https://api-preprod.phonepe.com/apis/pg-sandbox