Order Status
Checks the status of an order.
Parameters
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
merchantOrderId | String | Yes | The merchant order ID for which the status is fetched. |
details | Boolean | No | true → return all attempt details under paymentDetails list. false → return only latest attempt details under paymentDetails list |
Example :
import { StandardCheckoutClient, Env } from 'pg-sdk-node';
const clientId:string = "<clientId>";
const clientSecret:string = "<clientSecret>";
const clientVersion:string = 1; //insert your client version here
const env:Env = Env.SANDBOX; //change to Env.PRODUCTION when you go live
const client = StandardCheckoutClient.getInstance(clientId, clientSecret, clientVersion, env);
const merchantOrderId = '<MERCHANT_ORDER_ID>'; //Order Id used for creating new order
client.getOrderStatus(merchantOrderId).then((response) => {
const state = response.state;
});
Returns :
The function returns an OrderStatusResponse
object with the following properties:
Property | Data Type | Description |
---|---|---|
orderId | String | Order ID created by PhonePe. |
state | String | State of order, Expected Values – PENDING, FAILED, COMPLETED. |
amount | Number | Order amount in paisa. |
expireAt | Number | order expiry time in epoch. |
paymentDetails | List<PaymentDetail> | Contain list of details of each payment attempt made corresponding to this order. |
paymentDetail
object has the following properties:
Property | Data Type | Description |
---|---|---|
paymentMode | String | Mode of payment. Expected Values – UPI_INTENT, UPI_COLLECT, UPI_QR, CARD, TOKEN, NET_BANKING. |
timestamp | Number | |
Amount | Number | Order amount in paisa. |
transactionId | String | internal transaction id for given payment attempt. |
state | String | Transaction attempt state. Expected Values = PENDING, COMPLETED, FAILED |
errorCode | String | Error code (Only present when transaction state is failed) |
detailedErrorCode | String | Detailed Error Code (Only present when transaction state is failed) |
splitInstruments | List<InstrumentCombo> | Contains split instrument details of all the transactions made |
InstrumentCombo
Property | Data Type | Description |
---|---|---|
instrument | PaymentInstrumentV2 | Instrument used for the payment |
rails | PaymentRail | Rail used for the payment |
amount | Number | Order amount in paisa. |