Order Status

Order Status

Checks the status of an order.

Parameters

Parameter NameData TypeMandatoryDescription
merchant_order_idstryesThe 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 :

from phonepe.sdk.pg.payments.v2.standard_checkout_client import StandardCheckoutClient
from phonepe.sdk.pg.env import Env
 
client_id = "<YOUR_CLIENT_ID>"
client_secret = "<YOUR_CLIENT_SECRET>"
client_version = 1  # Insert your client version here
env = Env.SANDBOX  # Change to Env.PRODUCTION when you go live
should_publish_events = False
 
client = StandardCheckoutClient.get_instance(client_id=client_id,
                                                              client_secret=client_secret,
                                                              client_version=client_version,
                                                              env=env,
                                                              should_publish_events=should_publish_events)

merchant_order_id = "YOUR_MERCHANT_ORDER_ID"
response = client.get_order_status(merchant_order_id, details=False)
 
state = response.state

Returns :

The function returns a OrderStatusResponse object with the following properties:

PropertyData TypeDescription
order_idstrOrder ID created by PhonePe.
statestrState of order, Expected Values – PENDING,
FAILED,
COMPLETED.
amountintOrder amount in paisa.
expire_atintorder expiry time in epoch.
metaInfoMetaInfoMerchant defined meta info passed at the time of order creation
payment_detailslistPaymentDetialContain list of details of each payment attempt made corresponding to this order.

paymentDetail object has the following properties:

PropertyData TypeDescription
payment_modestrMode of payment. Expected Values – UPI_INTENT,
UPI_COLLECT,
UPI_QR, CARD,
TOKEN,
NET_BANKING.
amountintOrder amount in paisa.
transaction_idintinternal transaction id for given payment attempt.
statestrTransaction attempt state. Expected Values = 
PENDING,
COMPLETED,
FAILED
error_codestrError code (Only present when transaction state is failed)
detailed_error_codestrDetailed Error Code (Only present when transaction state is failed)
instrument typestrType of payment instrument. Expected values = 
ACCOUNT,
CREDIT_CARD,
DEBIT_CARD,
NET_BANKING