The get_order_status() method is used to retrieve the status of an order by passing the below parameters:
Parameters
Attribute | Data Type | Mandatory | Description |
---|---|---|---|
merchant_order_id | Str | Yes | The 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:
Property | Type | Description |
---|---|---|
order_id | Str | Unique order ID generated by PhonePe |
state | Str | State of the order. It can be in any one of the following states: 1. PENDING 2. FAILED 3. COMPLETED |
amount | Int | Order amount in Paise |
expire_at | Int | Order expiry time in epoch |
payment_details | List<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:
Attribute | Data Type | Description |
---|---|---|
| Str | Mode 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 |
| Int | Timestamp of the attempted transaction in epoch |
amount | Int | Order amount in Paisa |
transaction_id | Str | Transaction Id generated by the PhonePe |
| Str | Attempted transaction state. It can be any one of the following states: 1. PENDING 2. COMPLETED 3. FAILED |
error_code | Str | Error code (Only present when transaction state is failed) |
detailed_error_code | Str | Detailed Error Code (Only present when transaction state is failed) |
payment_flow | PaymentFlowResponse | Shows the flow of the order status 1. SETUP 2. REDEMPTION |
| List<InstrumentCombo> | Contains split instrument details of all the transactions made |
PaymentFlow Response
1. Subscription Setup
Attribute | Data Type | Description |
---|---|---|
| Str | Unique subscription ID generated by merchant |
| AuthWorkflowType | Type of setup workflow 1. TRANSACTION 2. PENNY_DROP |
amount_type | AmountType | Nature of redemption amount 1. FIXED 2. VARIABLE |
max_amount | Int | Max amount upto which redemptions will be allowed |
frequency | Frequency | Subscription frequency 1. DAILY 2. WEEKLY 3. MONTHLY 4. YEARLY 5. FORTNIGHTLY 6. BIMONTHLY 7. ON_DEMAND 8. QUATERLY 9. HALFYEARLY |
expire_at | Int | Subscription cycle expiry. No operation allowed after subscription expires |
subscription_id | Str | Id generated by the PhonePe side |
2. Subscription Redemption
Attribute | Data Type | Description |
---|---|---|
| Str | Id generated by the merchant |
| RedemptionRetryStrategy | Redemption retry strategy in case attempts fail 1. STANDARD – Internal Retries 2. CUSTOM – Merchant needs to retry |
auto_debit | Bool | Auto debit redemption 24 hours after notify success Can’t be true for CUSTOM redemptionRetryStrategy |
valid_after | Int | Time after which redeem can be called (epoch) |
valid_upto | Int | Time till redeem can be called (epoch) |
notified_at | Int | Time at which notifed was called (epoch) |
InstrumentCombo
Property | Type | Description |
---|---|---|
instrument | PaymentInstrumentV2 | Instrument used for the payment |
rails | PaymentRail | Rail used for the payment |
amount | Int | Amount transferred using the above instrument and rail |