Create Order

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

EnvironmentValue
UAThttps://api-preprod.phonepe.com/apis/pg-sandbox
PRODhttps://api.phonepe.com/apis/pg

API Endpoint

/checkout/v2/sdk/order

Complete URL

EnvironmentValue
UAThttps://api-preprod.phonepe.com/apis/pg-sandbox/checkout/v2/sdk/order
PRODhttps://api.phonepe.com/apis/pg/checkout/v2/sdk/order
anchor image
Copied !

Request Headers

Header NameHeader Value
Content-Typeapplication/json
AuthorizationO-Bearer <access_token>

Request Parameters

Parameter NameData TypeDescriptionMandatory (Yes/No)Constraints
merchantOrderIdSTRINGUnique merchant order id generated by merchantYesMax Length = 63 charactersNo Special characters allowed except underscore “_” and hyphen “-“
amountLONGOrder amount in paisaYesMin Value = 100 (in Paise)
expireAfterLONGOrder expiry in seconds. If not passed, default value will be used.NoMin Value = 300, Max Value = 3600 (in Seconds)
Default Value – 1200 Secs (20 mins)
metaInfoOBJECTMerchant defined meta info to store additional information.same data will be returned in status and callback response No
metaInfo.udf1-5STRINGMerchant defined additional informationNoMax length = 256 characters 
paymentFlowOBJECTAdditional details required by this flowYes
paymentFlow.typeSTRINGType of payment flowYesValues 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" } }
anchor image
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.

Response Body

{ "orderId": "OMO123456789", "state": "PENDING", "expireAt": 1703756259307, "token": "<order-token>" }

Response Parameters

Parameter NameData TypeDescription
orderIdStringPG generated internal order id
stateStringState of the order
expireAtDateTimeOrder expiry timestamp in epoch (in milliseconds)
tokenStringOrder Token that should be passed to the Merchant app and then to the PhonePe SDK.