The getSubsctiptionStatus() method is used to retrieve the status of the subscription by passing the below parameters:
Parameters
Attribute | Data Type | Mandatory | Description |
---|---|---|---|
merchantSubscriptionId | String | Yes | Id generated by the merchant |
Example:
import com.phonepe.sdk.pg.subscription.v2.SubscriptionClient;
import com.phonepe.sdk.pg.subscription.v2.models.response.SubscriptionStatusResponseV2;
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
String merchantSubscriptionId = "<MERCHANT_SUBSCRIPTION_ID>";
SubscriptionClient subscriptionClient = SubscriptionClient.getInstance(clientId, clientSecret, clientVersion, env);
SubscriptionStatusResponseV2 status = subscriptionClient.getSubscriptionStatus(merchantSubscriptionId);
Returns:
The function returns a SubscriptionStatusResponseV2
object with the following properties:
SubscriptionStatusResponseV2 Properties:
Here is the response property table for the given model:
Response Parameters
Attribute | Data Type | Description |
---|---|---|
| String | Unique order ID generated by PhonePe |
| String | Unique Subscription Id generated by PhonePe |
state | String | State of the subscription 1. ACTIVE 2. CANCELLED 3. REVOKED |
authWorkflowType | AuthWorkflowType | Type of setup workflow 1. TRANSACTION 2. PENNY_DROP |
| 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 |
pauseStartDat e | Long | If state is paused, then the field will be present |
| Long | If state is paused, then the field will be present |