Order Status

The get_order_status() method is used to retrieve the status of an order by passing the below parameters:

Parameters

AttributeData TypeMandatoryDescription
merchant_order_idStrYesThe merchant order ID for which the status is fetched.

Example:

from phonepe.sdk.pg.subscription.v2.subscription_client import SubscriptionClient
 
client_id = "<client_id>"
client_secret = "<client_secret>"
client_version = 1          # insert your client version here
env = Env.SANDBOX           # change to Env.PRODUCTION when you go live
 
subscription_client = SubscriptionClient.get_instance(client_id,client_secret,client_version,env)
 
merchant_order_id = "<merchant_order_id>"
 
order_status_response = subscription_client.get_order_status(merchant_order_id)
state = order_status_response.state

Returns:

The function returns a OrderStatusResponse object with the following properties:

OrderStatusResponse Properties:

Here is the response property table for the given model:

PropertyTypeDescription
order_idStrUnique order ID generated by PhonePe
stateStrState of the order. It can be in any one of the following states:
1. PENDING
2. FAILED
3. COMPLETED
amountIntOrder amount in Paise
expire_atIntOrder expiry time in epoch
payment_detailsList<PaymentDetail>Contain list of details of each transaction attempt made corresponding to this particular order

PaymentDetail Properties:

Here is the response property table for the given model:

AttributeData TypeDescription
payment_modeStrMode 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
timestampIntTimestamp of the attempted transaction in epoch
amountIntOrder amount in Paisa
transaction_idStrTransaction Id generated by the PhonePe
stateStrAttempted transaction state. It can be any one of the following states:
1. PENDING
2. COMPLETED
3. FAILED
error_codeStrError code (Only present when transaction state is failed)
detailed_error_codeStrDetailed Error Code (Only present when transaction state is failed)
payment_flowPaymentFlowResponseShows the flow of the order status
1. SETUP
2. REDEMPTION
split_instrumentsList<InstrumentCombo>Contains split instrument details of all the transactions made

PaymentFlow Response

1. Subscription Setup

AttributeData TypeDescription
merchant_subscription_idStr
Unique subscription ID generated by merchant
auth_workflow_typeAuthWorkflowTypeType of setup workflow
1. TRANSACTION
2. PENNY_DROP
amount_typeAmountTypeNature of redemption amount
1. FIXED
2. VARIABLE
max_amountIntMax amount upto which redemptions will be allowed
frequencyFrequencySubscription frequency
1. DAILY
2. WEEKLY
3. MONTHLY
4. YEARLY
5. FORTNIGHTLY
6. BIMONTHLY
7. ON_DEMAND
8. QUATERLY
9. HALFYEARLY
expire_atIntSubscription cycle expiry. No operation allowed after subscription expires
subscription_idStrId generated by the PhonePe side

2. Subscription Redemption

AttributeData TypeDescription
merchant_subscription_idStr
Id generated by the merchant
redemption_retry_strategyRedemptionRetryStrategyRedemption retry strategy in case attempts fail
1. STANDARD – Internal Retries
2. CUSTOM – Merchant needs to retry

auto_debitBoolAuto debit redemption 24 hours after notify success
Can’t be true for CUSTOM redemptionRetryStrategy
valid_afterIntTime after which redeem can be called (epoch)
valid_uptoIntTime till redeem can be called (epoch)
notified_atIntTime at which notifed was called (epoch)

InstrumentCombo

PropertyTypeDescription
instrumentPaymentInstrumentV2Instrument used for the payment
railsPaymentRailRail used for the payment
amountIntAmount transferred using the above instrument and rail