Create Order

Once the Auth token is collected in response to the Fetch Auth Token API, immediately merchants should call Create Order API for Order creation from the merchant Backend side by passing the below details. PhonePe backend will pass the Order token in response to the merchant Backend. Refer below API for reference.


API Host and Endpoint

Host

EnvironmentHttp MethodAPI Host URL
SandboxPOSThttps://api-preprod.phonepe.com/apis/pg-sandbox
ProductionPOSThttps://api.phonepe.com/apis/pg
anchor image
Copied !

/payments/v2/sdk/order – Endpoint is common for sandbox and production.

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 merchant backend to the merchant app, and then to PhonePe SDK while initiating the payment.