Skip to content

Generate QR API

Method: POST

Path: https://amazonpay.amazon.in/v2/pay/token

Description: This API will be used by merchants to request for QR code for a particular transaction at Amazon Pay end.In return, merchants will receive “200 OK” status code with UPI QR code in string and/or image format that needs to be further displayed over their Billing POS/EDC device.

Request Parameters

Parameter Name Data Type Description Mandatory Constraints
merchantId String Merchant ID provided by Amazon Yes
expiryTimeStamp String The time (in seconds) after which the QR code will expire Yes Format: UTC Timestamp value in yyyy-mm-dd hh:mm:ss
Minimum value = 60 secs
maximum value = 600 secs
amount String Total Order Amount Yes Minimum value = 0.01
currency String Currency of the order Yes Allowed value: "INR"
orderId String Unique Order ID generated by the merchant Yes Max 35 characters
Alphanumeric
Allowed characters:
lowercase a-z
uppercase A-Z
numbers 0-9
dash (-)
underscore (_)
clientId String Dependent on the DQR generation use case Yes Allowed value:"04"
qrMedium String Specifies the QR code source. Channel/creation point as defined by NPCI:
01 - PICK FROM GALLERY
02 - APP
03 – POS
04 – PHYSICAL/Share Intent mode
Yes For POS based QR generation always pass "03"
distributionType String Dynamic QR UPI Request Method Yes Possible values:
1.'QR_STRING' (for String)
2.'QR_IMAGE' (for Base64 Image)
3.PAY_LINK(for SMS)
storeId String Store ID assigned by Amazon for an MID Yes
storeIdType String Type of Store ID being passed Yes Possible values:
1. AMAZON_STORE_ID
2. MERCHANT_STORE_ID
3. PARTNER_STORE_ID
terminalId String Terminal ID created by merchant against a store Conditional If VPA is mapped to a store, the Terminal ID is optional.

If VPA is mapped to a terminal under a store, Terminal ID is mandatory.

Sample Request

{
    "merchantId" : "AMZONMID0Z",
    "storeIdType" : "MERCHANT_STORE_ID",
    "storeId": "test01",
    "terminalId":"12341234",
    "currency": "INR",
    "clientId": "04",
    "distributionType": ["QR_STRING"],
    "expiryTimestamp": "2024-08-08 12:00:00",
    "amount": "100.00",
    "orderId": "AMD00000000000000000000123456789123",
    "qrMedium": "03"
}

Response Parameters

Parameter Name Data Type Description
tokenId String This value is the same as TID, which will be generated at Amazon's end. This is the same as orderId passed in the QR generation request
qrPayload QrPayload Determined by the distributionType passed in the request
  • QrPayload structure -
Parameter Name Data Type Description
qrString String UPI QR String that can be converted to a QR Code to be displayed on POS device
qrImage String Base64 image string of the UPI QR code

Sample Response

    Status distributionType HTTP Status Code Payload
    Success QR_STRING 200 OK

    {
        "tokenId":"AMZDQR1112LX1uh0mAH00000057soA12115",
        "qrPayload":{
        "qrString":"upi://pay?pa=vpatestamzn%40yapl&amzn_mt=pro&cu=INR&mc=8351&am=1.00&tid=AMZDQR1112LX1uh0mAH00000057soA12115&tr=AMZDQR1112LX1uh0mAH00000057soA12115&pn=vpatestamzn1"
        }
    }
    
    Success QR_IMAGE 200 OK

    {
        "tokenId":"AMZDQR1112LX1uh0mAH00000057soA12115",
        "qrPayload":{
            "qrString": "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJ…"
        }
    }
    
    Success QR_IMAGE QR_STRING 200 OK

    {
        "tokenId":"AMZDQR1112LX1uh0mAH00000057soA12116",
        "qrPayload":{
            "qrString":"upi://pay?pa=vpatestamzn%40yapl&amzn_mt=pro&cu=INR&mc=8351&am=1.00&tid=AMZDQR1112LX1uh0mAH00000057soA12116&tr=AMZDQR1112LX1uh0mAH00000057soA12116&pn=vpatestamzn1",
            "qrImage":"/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgG..."
        }
    }
    
    InvalidArguments - 400
    {
        "code": "InvalidArguments",
        "message": " expiryTimeStamp field is mandatory, cannot be null or blank"
    }
    
    InternalServerError - 500
    {
        "code": "InternalServerError",
        "message": "An internal server error has occurred. Try your request again later."
    }
    

Common Errors

Status Code Message Description
200 OK Success
400 Missing parameter <> A mandatory parameter is missing
400 Invalid Input Exception A request is made with an unsupported parameter
401 Authn/Authz Failure Request authentication/authorization failure
404 StoreId/TerminalId not found Request made with an invalid terminalId or storeId
409 OrderID already exists Duplicate QR generation request made for the same order
500 Internal Server Error Amazon Pay server issue, try again