Order Status
Once a subscription setup is initiated, it’s essential to track the state of the associated order. The get_order_status() method allows you to fetch the current status of an order using the merchant_order_id.
Parameters
| Parameter Name | Data Type | Mandatory | Description |
| String | Yes | The unique order ID generated by the merchant. |
Example code
Code Reference
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.stateReturn Values
The function returns a OrderStatusResponse object with the following properties:
| Parameter Name | Data Type | Description |
order_id | String | Unique order ID generated by PhonePe. |
| String | Order status: • PENDING • FAILED • COMPLETED |
amount | Int | Order amount in paise |
expire_at | Int | Order expire date in epoch. |
payment_details | List<PaymentDetail> | Contains information about each payment attempt. |
PaymentDetail Properties:
| Parameter Name | Data Type | Description |
| String | Mode of Payment. It can be anyone of the following modes: • UPI_INTENT• UPI_COLLECT• UPI_QR• CARD• TOKEN• NET_BANKING |
| Long | Timestamp of the transaction (epoch). |
amount | Long | Amount involved in the transaction (paise). |
| String | Unique transaction ID generated by PhonePe |
| String | Transaction state: • PENDING • COMPLETED • FAILED |
| String | Present only if transaction failed |
| String | Additional failure details. |
| PaymentFlowResponse | Shows the flow type: • SETUP • REDEMPTION. |
| List<InstrumentCombo> | Details of instruments used during split transactions. |
PaymentFlow Response
PaymentFlow Response for Subscription Setup
| Attribute | Data Type | Description |
| String | Unique subscription ID from the merchant. |
| AuthWorkflowType | Type of setup workflow • TRANSACTION • PENNY_DROP |
| AmountType | Type of redemption amount • FIXED • VARIABLE |
| Long | Maximum redemption limit. |
| Frequency | Subscription Frequency: • DAILY • WEEKLY • MONTHLY • YEARLY • FORTNIGHTLY • BIMONTHLY • ON_DEMAND • QUATERLY • HALFYEARLY |
| Long | Subscription cycle expiry. No operation allowed after subscription expires. |
| String | Subscription ID generated by PhonePe. |
PaymentFlow Response for Subscription Redemption
| Attribute | Data Type | Description |
| String | Unique subscription ID from the merchant. |
| RedemptionRetryStrategy | Redemption retry strategy if a payment attempt fails: • STANDARD – PhonePe will automatically retry. • CUSTOM – Merchant is responsible for retrying manually. |
| Boolean | With auto-debit enabled, the amount will be deducted automatically 24 hours after a successful notify. This won’t work if you’re using the CUSTOM retry option. |
| Integer | Epoch time after which redemption is valid. |
| Integer | Epoch time until which redemption is valid. |
| Integer | Epoch time when notify was triggered. |
InstrumentCombo
| Attribute | Data Type | Description |
| PaymentInstrumentV2 | Payment instrument used. |
| rails | PaymentRail | Payment rail used. |
| amount | Long | Amount transferred using the specified rail/instrument. |
What’s Next?
Now that you know how to check the status of an order that was created, let’s move on to checking the subscription status.