Skip to main content
Phone Pe Business Logo

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.

Parameter NameData TypeMandatory
(Yes/No)
Description
merchantOrderIdStringYesThe order ID for which the status needs to be fetched
detailsBooleanNo• true → Returns all payment attempt details under the paymentDetails list.
• false → Returns only the latest payment attempt details

Sample Request
    public async Task<IActionResult> CustomOrderStatus(string orderId)
    {
        _logger.LogInformation($"Testing Custom GetOrderStatus API for Order ID: {orderId}...");
        try
        {
            var response = await _customCheckoutClient.GetOrderStatus(orderId, details: true);
            _logger.LogInformation("Order Status Response:\n{Response}", JsonSerializer.Serialize(response, new JsonSerializerOptions { WriteIndented = true }));
            return Ok(response);
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, "Custom GetOrderStatus API Failed");
            return StatusCode(500, new { message = ex.Message });
        }
    }

The function returns a OrderStatusResponse object with the following properties:

PropertyData TypeDescription
orderIdStringOrder ID generated by PhonePe PG.
stateStringCurrent state of the order: Expected values:
• PENDING
• FAILED
• COMPLETED
expireAtLongExpiry time in epoch.
amountLongOrder amount in paisa.
paymentDetailsList<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.

PropertyTypeDescription
paymentModeStringMode of Payment. It can be anyone of the following modes:
• UPI_INTENT
• UPI_COLLECT
• UPI_QR
• CARD
• TOKEN
• NET_BANKING
timestampNumberTimestamp of the attempted transaction in epoch
amountNumberOrder amount in Paisa
transactionIdStringTransaction Id generated by the PhonePe
stateStringAttempted transaction state. It can be any one of the following states:
• PENDING
• COMPLETED
• FAILED
errorCodeStringError code (Only present when transaction state is failed)
detailedErrorCodeStringDetailed Error Code (Only present when transaction state is failed)
railPaymentRailContains processing rail details under which transaction attempt is made.
instrumentPaymentInstrumentV2Contains instrument details of that particular transaction Id
splitInstrumentsList<InstrumentCombo>Contains split instrument details of all the transactions made

splitInstruments provides a list of InstrumentCombo objects. Details of each InstrumentCombo object are explained in the table below.

PropertyData TypeType
instrumentPaymentInstrumentV2Instrument used for the payment.
railsPaymentRailRail used for the payment.
amountNumberAmount transferred using the above instrument and rail.

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.

Is this article helpful?