The getOrderStatus() method is used to retrieve the status of an order by passing the below parameters:
Parameters
Attribute | Data Type | Mandatory | Description |
---|---|---|---|
merchantOrderId | String | Yes | The 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:
Property | Type | Description |
---|---|---|
orderId | String | Unique order ID generated by PhonePe |
state | String | State of the order. It can be in any one of the following states: 1. PENDING 2. FAILED 3. COMPLETED |
amount | Long | Order amount in Paise |
expireAt | Long | Order expiry time in epoch |
paymentDetails | 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 |
---|---|---|
| String | 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 |
| Long | Timestamp of the attempted transaction in epoch |
amount | Long | Order amount in Paisa |
transactionId | String | Transaction Id generated by the PhonePe |
| String | Attempted transaction state. It can be any one of the following states: 1. PENDING 2. COMPLETED 3. FAILED |
errorCode | String | Error code (Only present when transaction state is failed) |
detailedErrorCode | String | Detailed Error Code (Only present when transaction state is failed) |
paymentFlow | 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
Copied !
1. Subscription Setup
Attribute | Data Type | Description |
---|---|---|
| String | Unique subscription ID generated by merchant |
| AuthWorkflowType | Type of setup workflow 1. TRANSACTION 2. PENNY_DROP |
amountType | AmountType | Nature of redemption amount 1. FIXED 2. VARIABLE |
maxAmount | Long | 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 |
expireAt | Long | Subscription cycle expiry. No operation allowed after subscription expires |
subscriptionId | String | Id generated by the PhonePe side |
2. Subscription Redemption
Attribute | Data Type | Description |
---|---|---|
| String | Id generated by the merchant |
| RedemptionRetryStrategy | Redemption retry strategy in case attempts fail 1. STANDARD – Internal Retries 2. CUSTOM – Merchant needs to retry |
autoDebit | Boolean | Auto debit redemption 24 hours after notify success Can’t be true for CUSTOM redemptionRetryStrategy |
validAfter | Long | Time after which redeem can be called (epoch) |
validUpto | Long | Time till redeem can be called (epoch) |
notifiedAt | Long | Time at which notifed was called (epoch) |
InstrumentCombo
Copied !
Property | Type | Description |
---|---|---|
instrument | PaymentInstrumentV2 | Instrument used for the payment |
rails | PaymentRail | Rail used for the payment |
amount | Long | Amount transferred using the above instrument and rail |