If the code is PAYMENT_INITIATED, need to check status of the transaction using transaction status API.
{
"merchantId":"TESTMERCHANT",
"transactionId":"TX1234",
"merchantOrderId":"ORDERID",
"merchantUserId":"TXX",
"mobileNumber":"9123456789",
"amount":100, //total amount
"paymentSources":[
{
"mode":"wallets",
"providers":[ //taking list here for multiple wallet providers
"PHONEPE"
]
}
]
}
{
"request": "<Base64Encode>"
}
<html-block html=”
Request Headers
“>
Header Name | Header Value |
---|---|
Content-Type | application/json |
X-VERIFY | SHA256(base64 encoded payload + “/v3/merchant/inline/pay” + salt key) + ### + salt index |
<html-block html=”
Request Parameters
“>
Parameter Name | Type | Description | Mandatory |
---|---|---|---|
merchantId | STRING | Unique MerchantID assigned to the merchant by PhonePe | Yes |
transactionId | STRING | Unique merchant transaction id (merchants do a status check etc using this id). | Yes |
merchantUserId/ userAuthToken | STRING | User Id to identify user / token generated while linking user | Yes |
amount | LONG | Transaction amount in Paise | Yes |
merchantOrderId | STRING | Merchant order id | No |
paymentSources | ARRAY | List of payment sources (explained below) | Yes |
mobileNumber | STRING | Customers’ mobile number | Yes |
<html-block html=”
Response Codes
“>
CODE | Despcription |
---|---|
PAYMENT_INITIATED | Success scenario – will contain redirect url |
AUTHORIZATION_FAILED | Value of X-VERIFY is incorrect |
BAD_REQUEST | Some mandatory parameter is missing |
INTERNAL_SERVER_ERROR | Something went wrong |
INVALID_TRANSACTION_ID | If the transaction id is not unique |
INVALID_TRANSACTION_ID | Duplicate TransactionID |
INVALID_USER_AUTH_TOKEN | The userAuthToken provided is either invalid or not mapped to merchant. |
USER_BLACKLISTED | Customer is blacklisted on PhonePe side |
MERCHANT_USER_NOT_FOUND | No user exists for merchant id and user id combination. |
USER_BLOCKED | User is blocked for 1 day. |
Transaction status check API:
After user is redirected to merchant page after completing the transaction, you can get the
status of transaction using transaction status api. Please use this link for reference.
{“method”:”post”,”url”:”/v3/merchant/inline/pay”,”auth”:”required”,”results”:{“codes”:[{“name”:”Sample response”,”status”:200,”language”:”json”,”code”:”{ \n \”success\”:true,\n \”code\”:\”PAYMENT_INITIATED\”,\n \”data\”:{ \n \”redirectUrl\”:\”https://mercury.phonepe.com/1234\” \n }\n}”}]},”examples”:{“codes”:[]},”apiSetting”:”5ecf9143b5bd210023b3b738″,”params”:[{“name”:”request”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”base64 encoded payload”,”required”:true,”in”:”body”,”ref”:””,”_id”:”5b4c6d05bdd7010003e92300″},{“name”:”Content-Type”,”type”:”string”,”enumValues”:””,”default”:”application/json”,”desc”:””,”required”:true,”in”:”header”,”ref”:””,”_id”:”5b4c6d05bdd7010003e922ff”},{“name”:”X-VERIFY”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”SHA256(base64 encoded payload + \”/v3/merchant/inline/pay\” + salt key) + ### + salt index”,”required”:true,”in”:”header”,”ref”:””,”_id”:”5b4c6d05bdd7010003e922fe”},{“name”:”X-REDIRECT-URL”,”type”:”string”,”enumValues”:””,”default”:””,”desc”:”Dynamic redirect URI for UI callback”,”required”:false,”in”:”header”,”ref”:””,”_id”:”5c470f26138d190c350acb4e”},{“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”:”5c470f26138d190c350acb4d”},{“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”:”5c470f26138d190c350acb4c”},{“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”:”5c470f26138d190c350acb4b”}]}
https://mercury-uat.phonepe.com