Create Order


Once your backend receives the Auth Token from the Fetch Auth Token API, you must call the Create Order API . Pass the required details to create the order. PhonePe will return the Order Token in response, which your backend should use in the next step.

EnvironmentHttp MethodAPI
SandboxPOSThttps://api-preprod.phonepe.com/apis/pg-sandbox/payments/v2/sdk/order
ProductionPOSThttps://api.phonepe.com/apis/pg/payments/v2/sdk/order
Request Headers
Header NameHeader ValueDescription
Content-Typeapplication/json
AuthorizationO-Bearer <access_token>Pass access_token received in Authorization call
Request Parameters
Parameter NameTypeDescription
merchantOrderIdStringUnique merchant order id generated by merchant
amountLongIn paisa, minimum value Rs. 1 (100 in paise)
paymentFlowObject
paymentFlow.typeStringValues Allowed = [PG]
Sample Request
{
    "merchantOrderId": "TX123456",
    "amount": 100,
    "paymentFlow": {
        "type": "PG"
    }
}
Sample Response
{
    "orderId": "OMO123456789",
    "state": "PENDING",
    "expireAt": 1703756259307,
    "token": "<order-token>"
}
Response Parameters
Parameter NameTypeDescription
orderIdStringPG generated internal order id
stateStringState of the order created, Expected value is PENDING 
expireAtLongOrder expiry date in epoch
tokenStringOrder Token to be passed to SDK

The token collected from this API will be passed from the your backend to the your app, and then to PhonePe SDK while initiating the payment.

In the next section, you will learn how to initiate payment. This action is performed after the user selects a payment instrument and clicks “Pay.” This API call is essential as it returns the Order Token and Merchant Order ID required to proceed.

Is this article helpful?