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.
Parameters
| Parameter Name | Data Type | Mandatory | Description |
| String | Yes | The unique order ID generated by the merchant. |
Example code
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)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 |
| String | Type of setup workflow • TRANSACTION • PENNY_DROP |
| String | Type of redemption amount: • FIXED • VARIABLE |
| Int | Maximum amount allowed for redemption. |
| Frequency | Subscription frequency: • DAILY • WEEKLY • MONTHLY • YEARLY • FORTNIGHTLY • BIMONTHLY • ON_DEMAND • QUARTERLY • HALFYEARLY |
| Int | Timestamp after which subscription becomes inactive. |
| Int | Present only if subscription is paused. |
| Int | 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.