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
Environment | Http Method | API Host URL |
---|---|---|
Sandbox | POST | https://api-preprod.phonepe.com/apis/pg-sandbox |
Production | POST | https://api.phonepe.com/apis/pg |
Endpoint
Copied !
/payments/v2/sdk/order – Endpoint is common for sandbox and production.
Request Headers
Header Name | Header Value | Description |
---|---|---|
Content-Type | application/json | |
Authorization | O-Bearer <access_token> | Pass access_token received in Authorization call |
Request Parameters
Parameter Name | Type | Description |
---|---|---|
merchantOrderId | String | Unique merchant order id generated by merchant |
amount | Long | In paisa, minimum value Rs. 1 (100 in paise) |
paymentFlow | Object | |
paymentFlow.type | String | Values 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 Name | Type | Description |
---|---|---|
orderId | String | PG generated internal order id |
state | String | State of the order created, Expected value is PENDING |
expireAt | Long | Order expiry date in epoch |
token | String | Order 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.