Order Status

Order Status

Checks the status of an order.

Parameters

Parameter NameData TypeMandatoryDescription
merchantOrderIdStringYesThe merchant order ID for which the status is fetched.
detailsBooleanNotrue → 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:

PropertyData TypeDescription
orderIdStringOrder ID created by PhonePe.
stateStringState of order, Expected Values – PENDING,
FAILED,
COMPLETED.
amountNumberOrder amount in paisa.
expireAtNumberorder expiry time in epoch.
paymentDetailsList<PaymentDetail>Contain list of details of each payment attempt made corresponding to this order.

paymentDetail object has the following properties:

PropertyData TypeDescription
paymentModeStringMode of payment. Expected Values – UPI_INTENT,
UPI_COLLECT,
UPI_QR, CARD,
TOKEN,
NET_BANKING.
timestampNumber
AmountNumberOrder amount in paisa.
transactionIdStringinternal transaction id for given payment attempt.
stateStringTransaction attempt state. Expected Values = 
PENDING,
COMPLETED,
FAILED
errorCodeStringError code (Only present when transaction state is failed)
detailedErrorCodeStringDetailed Error Code (Only present when transaction state is failed)
splitInstrumentsList<InstrumentCombo>Contains split instrument details of all the transactions made

InstrumentCombo

PropertyData TypeDescription
instrumentPaymentInstrumentV2Instrument used for the payment
railsPaymentRailRail used for the payment
amountNumberOrder amount in paisa.