QR Init

QR Init is used when the merchant wants to generate a new dynamic QR code.

Request Headers

Header Name

Header Value

Content-Type

application/json

X-VERIFY

SHA256(base64 encoded payload + "/v3/qr/init" +
salt key) + ### + salt index

X-CALLBACK-URL

URL on which server to server response is required
once payment is done

X-CALL-MODE

HTTP mode to be used for callback. Default Value: POST

{
  "request": "ewoJIm1lcmNoYW50SWQiOiJNMjMwNjE2MDQ4MzIyMDY3NTU3OTE0MCIsCgkidHJhbnNhY3Rpb25JZCI6IlRYMzIzMjE4NDk2NDQyMzQiLAoJImFtb3VudCI6MTAwMCwKCSJzdG9yZUlkIjoiMjM0NTU1IiwKCSJ0ZXJtaW5hbElkIjoiODk0MjM3Igp9"
}

Request Parameters

Parameter Name

Type

Description

Mandatory

merchantId

STRING

Unique MerchantID assigned to the merchant by PhonePe

Yes

subMerchantId

STRING

Unique identity of end merchant

No

storeId

STRING

Same as subMerchantId

No

terminalId

STRING

Unique terminal Id for each POS device

No

transactionId

STRING

Unique transactionId

Yes

amount

LONG

Amount in Paise

Yes

expiresIn

LONG

Expiry time in seconds

Yes

merchantOrderId

STRING

OrderId. This can be same as transactionId

No

message

STRING

Message for customer

No

{
    "success": true,
    "code": "SUCCESS",
    "message": "Your request has been successfully completed.",
    "data": {
        "merchantId": "M2306160483220675579140",
        "transactionId": "TX32321849644234",
        "amount": 1000,
        "qrString": "upi://pay?pn=MERCHANT&[email protected]&tid=YBL60c7891e33cb42daaf86b0aeb992a8b9&tr=P1806151323093900554957&am=10.00&cu=INR&url=https://phonepe.com&mc=5311&tn=Payment%20for%20P1806151323093900554957"
    }
}

Response Codes

Code

Description

INVALID_TRANSACTION_ID

Duplicate TransactionID

BAD_REQUEST

Invalid request payload

AUTHORIZATION_FAILED

Incorrect X-VERIFY header

INTERNAL_SERVER_ERROR

Something went wrong

SUCCESS

API successful

Sample Codes##

Sample code can be downloaded from the link mentioned below:-

URL: https://phon.pe/uh822h5f,
Password: OQ9qgKB9jp

Language
Click Try It! to start a request and see the response here!