Skip to main content
Phone Pe Business Logo

UPI QR

The UPI QR flow lets you generate a QR code that the customer can scan using any UPI app to complete the payment. The request includes order details, optional metadata, and split settlement info. The response returns an orderId, PENDING status, a qrData for generating the QR, and an intentUrl for app redirection.

EnvironmentHttp MethodAPI
SandboxPOSThttps://api-preprod.phonepe.com/apis/pg-sandbox/payments/v2/pay
ProductionPOSThttps://api.phonepe.com/apis/pg/payments/v2/pay

📘 Pre-requisite for UAT Testing

Before initiating the payment, ensure that the PhonePe Test App is installed and the template is configured. Failing to do so will result in an HTTP 500 error.

Request Headers
Header NameHeader Value
Content-Typeapplication/json
AuthorizationO-Bearer <partner-auth-token>
X-MERCHANT-IDMID
Sample Request
{
    "merchantOrderId": "TX123456",
    "amount": 1000,
    "expireAfter": 1200,
    "metaInfo": {
        "udf1": "<additional-information-1>",
        "udf2": "<additional-information-2>",
        "udf3": "<additional-information-3>",
        "udf4": "<additional-information-4>",
        "udf5": "<additional-information-5>"
    },       
    "paymentFlow": {
        "type": "PG",    
       "paymentMode" : {
            "type" : "UPI_QR"
        }
    },
    "splitSettlementInfo":
    {
        "type": "PERCENT", // Values: PERCENT or ABSOLUTE
        "accountsSplit":
        [
            {
                "value": 10.5,  // Floor upto 2 decimal 
                "accountId": "B12345678"
            },
            {
                "value": 20.5, // Floor
                "accountId": "B9101112"
            }
        ]
    } 
}
Request Parameters
Parameter NameData TypeDescriptionMandatory (Yes/No)Constraints
detailsObjectObject that holds the UPI collect payment details.Yes
details.typeStringSpecifies the type of UPI collect request. Supported values:
• VPA
• UPI_NUMBER
Yes
details.vpaStringThe Virtual Payment Address to which the collect request should be sent. Required when type is set to VPA.Yes
details.upiNumberStringThe UPI number to which the collect request should be sent. Required when type is set to UPI_NUMBER.Yes
messageStringCustom message to be displayed in the customer’s collect prompt.Yes
merchantOrderIdStringUnique order ID created by the merchant to identify the transaction.YesMax Length = 63 charactersNo Special characters allowed except underscore “_” and hyphen “-“
amountLongTotal amount of the order specified in paisa.YesMin Value = 100 (In paise)
expireAfterLongTime after which the order will expire, specified in seconds. If not provided, a default value will be applied.NoMin Value = 300, Max Value = 5184000

Default Value (in Secs):
UPI QR: 480
UPI Intent : 600
UPI Collect: 480
Card : 720
NetBanking : 480
metaInfoObjectMerchant defined meta information used to store additional data related to the order. The same data will be returned in the status and callback response.No
metaInfo.udf1-5StringAdditional information provided by the merchant, usually used to store custom data related to the order.NoMax length = 256 characters 
deviceContext.deviceOSStringDevice operating system is required only when the payment mode is UPI_INTENT.YesValues Allowed:
• iOS
• ANDROID
deviceContext.merchantCallBackSchemeStringMerchant callback scheme is required only when the target app is PhonePe and the device operating system is IOS.Yes
paymentFlowObjectAdditional information required to complete this payment flow.Yes
paymentFlow.typeStringSpecifies the type of payment flow used.YesValued Allowed: PG
paymentModeObjectContains information related to available payment modes.Yes
paymentMode.typeStringSpecifies the type of the payment methodYesValues Allowed:
• UPI_INTENT
• UPI_COLLECT
• UPI_QR
• NET_BANKING
• TOKEN
• CARD
merchantUrls.redirectUrlStringURL to which the user is redirected after completing the payment. Required only for NET BANKING, TOKEN, and CARD payment modes.YesValid Http url. 
splitSettlementInfoObjectAccounts where the merchant wants the amount to be distributed. Applicable only if split is enabled for the merchant.NoThe total split amount must not exceed the order amount provided.

The splitSettlementInfo field contains two key components which are explained below.

Field NameData TypeMandatoryDescription
splitSettlementInfo.typeStringYesType of split. i.e if the amount in split is in percent or absolute.
splitSettlementInfo.accountsSplitListYesInformation of the account into which the split should be done

If splitInfo.type is set to “PERCENT”, the splitInfo.accounts field should contain details of each account along with the percentage of the total amount to be allocated.

Field NameData TypeMandatoryDescription
valueDoubleYesPercentage of the amount to be split, allowing up to two decimal places.
accountIdStringYesName assigned by the merchant when adding the beneficiary, used for the merchant’s reference.

If splitInfo.type is set to ABSOLUTE, then accountsSplit must include the following details.

Field NameData TypeMandatoryDescription
valueDoubleYesAmount to be split, specified in Paisa.
accountIdStringYesName assigned by the merchant while adding the beneficiary. This acts as a reference for the merchant.
Response Headers
Header NameHeader Value
Content-Typeapplication/json
Case 1: Success Response
{
    "orderId": "OMO123456789",
    "state": "PENDING",
    "expireAt": 1703756259307,
    "intentUrl": "ppe://url",
    "qrData": ""
}
Case 2: Order fails validation due to issues like split not being enabled, invalid split details, or incorrect split amount.
{
    "code": SPLIT_SETTLEMENT_NOT_ENABLED/ INVALID_SPLIT_DETAILS / BAD_REQUEST
    "message": Split settlement not enabled/ invalid split details
}
Case 3: Internal Server Error
{
    "code": "INTERNAL_SERVER_ERROR",
    "message": "There is an error trying to process your transaction at the moment. Please try again in a while."
}
Response Field Details:
Field NameData TypeDescription
orderIdStringInternal order ID generated by the PG.
stateStringCurrent state of the created order. The expected value is CREATED.
expiryAtLongThe timestamp when the order will expire, represented in epoch (milliseconds).
redirectUrlStringThe URL to which the merchant should redirect the user to complete the payment.
intentUrlStringThe intent URL used to trigger the UPI app flow. Present only in case of UPI_INTENT or UPI_QR payment modes.
Error Response Field Details:
Field NameData TypeDescription
codeStringError Code
messageStringError Message

Is this article helpful?