Check Order Status with .NET SDK
The Order Status API allows you to check the current status of a payment order by using the getOrderStatus() function.
Request
| Parameter Name | Data Type | Mandatory (Yes/No) | Description |
merchantOrderId | String | Yes | The order ID for which the status needs to be fetched |
details | Boolean | No | • true → Returns all payment attempt details under the paymentDetails list. • false → Returns only the latest payment attempt details |
var response = await checkoutClient.GetOrderStatus(orderId, details: true);
logger.LogInformation("Order Status Response:\n{Response}", JsonSerializer.Serialize(response, new JsonSerializerOptions { WriteIndented = true }));Response
The function returns a OrderStatusResponse object with the following properties:
| Property | Data Type | Description |
orderId | String | Order ID generated by PhonePe PG. |
state | String | Current state of the order: Expected values: • PENDING • FAILED • COMPLETED |
expireAt | Long | Expiry time in epoch. |
amount | Long | Order amount in paisa. |
paymentDetails | List<PaymentDetail> | Contain list of details of each payment attempt made corresponding to this order. |
The paymentDetails property contains a list of payment details for each payment attempt made against an order. The details of each payment are explained in the table below.
splitInstruments provides a list of InstrumentCombo objects. Details of each InstrumentCombo object are explained in the table below.
| Property | Data Type | Type |
| PaymentInstrumentV2 | Instrument used for the payment. |
| PaymentRail | Rail used for the payment. |
| Number | Amount transferred using the above instrument and rail. |
What’s Next?
You’ve understood how to retrieve the status of an order using the getOrderStatus() function. Now, let’s move on to learn how to process refunds, which allows you to return funds to the customer for eligible transactions.