Order Status
It is used to retrieve the status of an order using getOrderStatus()
function.
Parameters:
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
merchantOrderId | String | Yes | The merchant order ID for which the status is fetched. |
details | String | No | true → 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:
Property | Data Type | Description |
---|---|---|
orderId | String | Order ID created by PhonePe. |
state | String | State of the order. It can be in any one of the following states: 1. COMPLETED 2. FAILED 3. PENDING |
amount | Long | Order amount in paisa |
expireAt | Long | 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:
Attribute | Data Type | Description |
---|---|---|
paymentMode | String | Mode 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 |
timestamp | Long | Timestamp of the attempted transaction in epoch |
amount | Long | Order amount in paisa. |
transactionId | String | Transaction Id generated by the PhonePe |
state | String | Attempted transaction state. It can be any one of the following states: 1. COMPLETED 2. FAILED 3. PENDING |
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 object has the following properties:
Property | Data Type | Description |
amount | Long | Amount transferred using the above instrument and rail |
instrument | PaymentInstrumentV2 | Instrument used for the payment |
rails | PaymentRail | Rail used for the payment |