Subscription Status
The getSubscriptionStatus() method is used to check the current status of a subscription using the merchant-generated subscription ID. It helps you track whether a subscription is active, cancelled, or revoked.
Parameters
| Parameter Name | Data Type | Mandatory | Description |
| String | Yes | The unique order ID generated by the merchant. |
Example code
Code Reference
import com.phonepe.sdk.pg.subscription.v2.SubscriptionClient;
import com.phonepe.sdk.pg.subscription.v2.models.response.SubscriptionStatusResponseV2;
String clientId = "";
String clientSecret = "";
Integer clientVersion = 1; //insert your client version here
Env env = Env.SANDBOX; //change to Env.PRODUCTION when you go live
String merchantSubscriptionId = "";
SubscriptionClient subscriptionClient = SubscriptionClient.getInstance(clientId, clientSecret, clientVersion, env);
SubscriptionStatusResponseV2 status = subscriptionClient.getSubscriptionStatus(merchantSubscriptionId);Return Values
The function returns a SubscriptionStatusResponseV2 object with the following properties:
| Attribute | Data Type | Description |
| String | Unique subscription ID from the merchant. |
| String | Unique subscription ID from the PhonePe. |
| String | Type of redemption amount • ACTIVE • CANCELLED • REVOKED |
| AuthWorkflowType | Type of setup workflow • TRANSACTION • PENNY_DROP |
| AmountType | Type of redemption amount: • FIXED • VARIABLE |
| Long | Maximum amount allowed for redemption. |
| Frequency | Subscription frequency: • DAILY • WEEKLY • MONTHLY • YEARLY • FORTNIGHTLY • BIMONTHLY • ON_DEMAND • QUARTERLY • HALFYEARLY |
expireAt | Long | Timestamp after which subscription becomes inactive. |
pauseStartDate | Long | Present only if subscription is paused. |
pauseEndDate | Long | Present only if subscription is paused. |
What’s Next?
Now that you know how to check the status of an Subscription, let’s move on to learn how to notify about the subscription.