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.

Parameter NameData TypeMandatoryDescription
merchantSubscriptionIdStringYesThe unique order ID generated by the merchant.
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);

The function returns a SubscriptionStatusResponseV2 object with the following properties:

AttributeData TypeDescription
merchantSubscriptionIdStringUnique subscription ID from the merchant.
subscriptionIdStringUnique subscription ID from the PhonePe.
stateStringType of redemption amount
ACTIVE
CANCELLED
REVOKED
authWorkflowTypeAuthWorkflowTypeType of setup workflow
TRANSACTION
PENNY_DROP
amountTypeAmountTypeType of redemption amount:
FIXED
VARIABLE
maxAmountLongMaximum amount allowed for redemption.
frequencyFrequencySubscription frequency:
DAILY
WEEKLY
MONTHLY
YEARLY
FORTNIGHTLY
BIMONTHLY
ON_DEMAND
QUARTERLY
HALFYEARLY
expireAtLongTimestamp after which subscription becomes inactive.
pauseStartDateLongPresent only if subscription is paused.
pauseEndDateLongPresent only if subscription is paused.

Now that you know how to check the status of an Subscription, let’s move on to learn how to notify about the subscription.

Is this article helpful?