Merchant backend should call this API to get an Order Token, which should be passed to the Merchant app and then to the PhonePe SDK.
Host Details
Environment | Value |
---|---|
UAT | https://api-preprod.phonepe.com/apis/pg-sandbox |
PROD | https://api.phonepe.com/apis/pg |
API Endpoint
/checkout/v2/sdk/order
Complete URL
Environment | Value |
---|---|
UAT | https://api-preprod.phonepe.com/apis/pg-sandbox/checkout/v2/sdk/order |
PROD | https://api.phonepe.com/apis/pg/checkout/v2/sdk/order |
Request Details
Copied !
Request Headers
Header Name | Header Value |
---|---|
Content-Type | application/json |
Authorization | O-Bearer <access_token> |
Request Parameters
Parameter Name | Data Type | Description | Mandatory (Yes/No) | Constraints |
merchantOrderId | STRING | Unique merchant order id generated by merchant | Yes | Max Length = 63 charactersNo Special characters allowed except underscore “_” and hyphen “-“ |
amount | LONG | Order amount in paisa | Yes | Min Value = 100 (in Paise) |
expireAfter | LONG | Order expiry in seconds. If not passed, default value will be used. | No | Min Value = 300, Max Value = 3600 (in Seconds) Default Value – 1200 Secs (20 mins) |
metaInfo | OBJECT | Merchant defined meta info to store additional information.same data will be returned in status and callback response | No | |
metaInfo.udf1- 5 | STRING | Merchant defined additional information | No | Max length = 256 characters |
paymentFlow | OBJECT | Additional details required by this flow | Yes | |
paymentFlow.type | STRING | Type of payment flow | Yes | Values Allowed – PG_CHECKOUT |
Request Body
{
"merchantOrderId": "TX123456",
"amount": 100,
"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_CHECKOUT"
}
}
Request Body with Selected Instrument
Copied !
{
"merchantOrderId": "TX123456",
"amount": 100,
"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_CHECKOUT",
"paymentModeConfig": {
"enabledPaymentModes": [
{
"type": "UPI_INTENT"
},
{
"type": "UPI_COLLECT"
},
{
"type": "UPI_QR"
},
{
"type": "NET_BANKING"
},
{
"type": "CARD",
"cardTypes": [
"DEBIT_CARD",
"CREDIT_CARD"
]
}
],
"disabledPaymentModes": [
{
"type": "UPI_INTENT"
},
{
"type": "UPI_COLLECT"
},
{
"type": "UPI_QR"
},
{
"type": "NET_BANKING"
},
{
"type": "CARD",
"cardTypes": [
"DEBIT_CARD",
"CREDIT_CARD"
]
}
]
}
}
}
NOTE : Above Request Body has only the dummy data, please refer to the request headers and parameters table above to generate the payload and headers.
Important Notes:
- Merchants should pass “paymentModeConfig” block only if the merchant wants to manage the instrument to be displayed on the checkout page. Otherwise, the “paymentModeConfig” block should be ignored which will show the default instruments enabled at PhonePe’s end.
- Either enabledPaymentModes or disabledPaymentModes is required, if both are present API will throw error.
- paymentModeConfig.enabledPaymentModes:
This will ensure the list of Instruments passed within the “enabledPaymentModes” block will only be shown on the Checkout Page while all other enabled instruments at PhonePe end won’t be displayed. - paymentModeConfig.disabledPaymentModes:
This will ensure the list of Instruments passed within the “disabledPaymentModes” block will not be shown on the Checkout Page while all other enabled instruments at PhonePe end will be displayed. - Special Case for the CARD instrument
Ensure to pass the cardTypes as well along with type.- If “enabledPaymentModes.type” = “CARD” but
“enabledPaymentModes.cardTypes” is not passed, then the Card option will be displayed based on the instrument enabled at PhonePe’s end [CreditCard (and/or) Debit Card]. - If “enabledPaymentModes.type” = “CARD” and
“enabledPaymentModes.cardTypes” = [“DEBIT_CARD”] is passed, then the Debit Card option only will be allowed on the PhonePe checkout. - If “disabledPaymentModes.type” = “CARD” but
“disabledPaymentModes.cardTypes” is not passed, then the Card option won’t be disabled and user will be displayed based on the instrument enabled at PhonePe’s end [CreditCard (and/or) Debit Card].
- If “disabledPaymentModes.type” = “CARD” and
“disabledPaymentModes.cardTypes” = [“DEBIT_CARD”] is passed, then the Debit Card option alone will be disabled on the PhonePe checkout. - If “disabledPaymentModes.type” = “CARD” and
“disabledPaymentModes.cardTypes” = [“DEBIT_CARD”, “CREDIT_CARD”] is passed, only then both Debit Card and Credit Card will be disabled on the PhonePe checkout.
- If “enabledPaymentModes.type” = “CARD” but
Response Body
{
"orderId": "OMO123456789",
"state": "PENDING",
"expireAt": 1703756259307,
"token": "<order-token>"
}
Response Parameters
Parameter Name | Data Type | Description |
---|---|---|
orderId | String | PG generated internal order id |
state | String | State of the order |
expireAt | DateTime | Order expiry timestamp in epoch (in milliseconds) |
token | String | Order Token that should be passed to the Merchant app and then to the PhonePe SDK. |