Subscription Redeem
The redeem() method is used to initiate a redemption against an active subscription. This action can only be performed after 24 hours have passed since the notify() method was called.
Required Parameters
| Attribute | Data Type | Mandatory | Description |
| String | Yes | 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
subscription_client = SubscriptionClient.get_instance(client_id,client_secret,client_version,env)
merchant_order_id = "<MERCHANT_ORDER_ID>" # Used at the time of notify()
subscription_redeem_response_v2 = subscription_client.redeem(merchant_order_id)Return Values
The function returns a SubscriptionRedeemResponseV2 object with the following properties:
| Parameter Name | Data Type | Description |
| String | State of the order. |
transaction_id | Long | Unique transaction ID generated by PhonePe. |
What’s Next ?
After initiating a redemption against an active subscription, let’s move on to understand how a subscription can be cancelled.