The get_subscription_status() method is used to retrieve the status of the subscription by passing the below parameters:
Parameters
Attribute | Data Type | Mandatory | Description |
---|---|---|---|
merchant_subscription_id | Str | Yes | Id generated by the merchant |
Example:
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)
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 |
---|---|---|
| Str | Unique order ID generated by PhonePe |
| Str | Unique Subscription Id generated by PhonePe |
state | Str | State of the subscription 1. ACTIVE 2. CANCELLED 3. REVOKED |
auth_workflow_type | AuthWorkflowType | Type of setup workflow 1. TRANSACTION 2. PENNY_DROP |
| AmountType | Nature of redemption amount 1. FIXED 2. VARIABLE |
max_amount | Int | 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 |
expire_at | Int | Subscription cycle expiry. No operation allowed after subscription expires |
pause_start_date | Int | If state is paused, then the field will be present |
| Int | If state is paused, then the field will be present |