Order Status

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

Parameters

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

Example:

import com.phonepe.sdk.pg.Env; import com.phonepe.sdk.pg.common.models.response.OrderStatusResponse; import com.phonepe.sdk.pg.subscription.v2.SubscriptionClient; String clientId = "<clientId>"; String clientSecret = "<clientSecret>"; Integer clientVersion = 1; //insert your client version here Env env = Env.SANDBOX; //change to Env.PRODUCTION when you go live SubscriptionClient subscriptionClient = SubscriptionClient.getInstance(clientId, clientSecret, clientVersion, env); String merchantOrderId = "<merchantOrderId>"; OrderStatusResponse orderStatusResponse = subscriptionClient.getOrderStatus(merchantOrderId); String state = orderStatusResponse.getState();

Returns:

The function returns a OrderStatusResponse object with the following properties:

OrderStatusResponse Properties:

Here is the response property table for the given model:

PropertyTypeDescription
orderIdStringUnique order ID generated by PhonePe
stateStringState of the order. It can be in any one of the following states:
1. PENDING
2. FAILED
3. COMPLETED
amountLongOrder amount in Paise
expireAtLongOrder expiry time in epoch
paymentDetailsList<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
paymentModeStringMode 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
timestampLongTimestamp of the attempted transaction in epoch
amountLongOrder amount in Paisa
transactionIdStringTransaction Id generated by the PhonePe
stateStringAttempted transaction state. It can be any one of the following states:
1. PENDING
2. COMPLETED
3. FAILED
errorCodeStringError code (Only present when transaction state is failed)
detailedErrorCodeStringDetailed Error Code (Only present when transaction state is failed)
paymentFlowPaymentFlowResponseShows the flow of the order status
1. SETUP
2. REDEMPTION
splitInstrumentsList<InstrumentCombo>Contains split instrument details of all the transactions made
anchor image
Copied !

1. Subscription Setup

AttributeData TypeDescription
merchantSubscriptionIdString
Unique subscription ID generated by merchant
authWorkflowTypeAuthWorkflowTypeType of setup workflow
1. TRANSACTION
2. PENNY_DROP
amountTypeAmountTypeNature of redemption amount
1. FIXED
2. VARIABLE
maxAmountLongMax 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
expireAtLongSubscription cycle expiry. No operation allowed after subscription expires
subscriptionIdStringId generated by the PhonePe side

2. Subscription Redemption

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

autoDebitBooleanAuto debit redemption 24 hours after notify success
Can’t be true for CUSTOM redemptionRetryStrategy
validAfterLongTime after which redeem can be called (epoch)
validUptoLongTime till redeem can be called (epoch)
notifiedAtLongTime at which notifed was called (epoch)
anchor image
Copied !
PropertyTypeDescription
instrumentPaymentInstrumentV2Instrument used for the payment
railsPaymentRailRail used for the payment
amountLongAmount transferred using the above instrument and rail