Order Status

Order Status

It is used to retrieve the status of an order using getOrderStatus() function.

Parameters:

Parameter NameData TypeMandatoryDescription
merchantOrderIdStringYesThe merchant order ID for which the status is fetched.
detailsStringNotrue → return all attempt details under paymentDetails list
false → return only latest attempt details under paymentDetails list

Example:

import com.phonepe.sdk.pg.Env;
import com.phonepe.sdk.pg.payments.v2.StandardCheckoutClient;
import com.phonepe.sdk.pg.common.models.response.OrderStatusResponse;
 
String clientId = "<clientId>";
String clientSecret = "<clientSecret>";
Integer clientVersion = 1;  //insert your client version here
Env env = Env.SANDBOX;      //change to Env.PRODUCTION when you go live
StandardCheckoutClient client = StandardCheckoutClient.getInstance(clientId, clientSecret,
        clientVersion, env);
 
String merchantOrderId = "<merchantOrderId>";
 
OrderStatusResponse orderStatusResponse = client.getOrderStatus(merchantOrderId);
String state = orderStatusResponse.getState();

Returns :

The function returns a OrderStatusResponse object with the following properties:

OrderStatusResponse Properties:

PropertyData TypeDescription
orderIdStringOrder ID created by PhonePe.
stateStringState of the order. It can be in any one of the following states:
1. COMPLETED
2. FAILED
3. PENDING
amountLongOrder amount in paisa
expireAtLongOrder 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:

AttributeData TypeDescription
paymentModeStringMode of Payment. It can be anyone of the following modes:
1. UPI_INTENT
2. UPI_COLLECT
3. UPI_QR
4. CARD
5. TOKEN
6. NET_BANKING
timestampLongTimestamp of the attempted transaction in epoch
amountLongOrder amount in paisa.
transactionIdStringTransaction Id generated by the PhonePe
stateStringAttempted transaction state. It can be any one of the following states:
1. COMPLETED
2. FAILED
3. PENDING
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 object has the following properties:

PropertyData TypeDescription
amountLongAmount transferred using the above instrument and rail
instrumentPaymentInstrumentV2Instrument used for the payment
railsPaymentRailRail used for the payment