Subscription Status


The get_subscription_status() 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
merchant_subscription_idStringYesThe unique order ID generated by the merchant.
Code Reference
from phonepe.sdk.pg.subscription.v2.subscription_client import SubscriptionClient
 
client_id = "<client_id>"
client_secret = "<client_secret>"
client_version = 1              # insert your client version here
env = Env.SANDBOX               # change to Env.PRODUCTION when you go live
 
merchant_subscription_id = "<MERCHANT_SUBSCRIPTION_ID>"
 
subscription_client = SubscriptionClient.get_instance(client_id,client_secret,client_version,env)
status = subscription_client.get_subscription_status(merchant_subscription_id)

The function returns a SubscriptionStatusResponseV2 object with the following properties:

AttributeData TypeDescription
merchant_subscription_idStringUnique subscription ID from the merchant.
subscription_idStringUnique subscription ID from the PhonePe.
stateStringType of redemption amount
ACTIVE
CANCELLED
REVOKED
auth_workflow_typeStringType of setup workflow
TRANSACTION
PENNY_DROP
amount_typeStringType of redemption amount:
FIXED
VARIABLE
max_amount IntMaximum amount allowed for redemption.
frequencyFrequencySubscription frequency:
DAILY
WEEKLY
MONTHLY
YEARLY
FORTNIGHTLY
BIMONTHLY
ON_DEMAND
QUARTERLY
HALFYEARLY
expire_atIntTimestamp after which subscription becomes inactive.
pause_start_dateIntPresent only if subscription is paused.
pause_end_dateIntPresent 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?