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.

AttributeData TypeMandatoryDescription
merchant_order_idStringYesUnique 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
 
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)

The function returns a SubscriptionRedeemResponseV2 object with the following properties:

Parameter NameData TypeDescription
stateStringState of the order.
transaction_idLongUnique transaction ID generated by PhonePe.

After initiating a redemption against an active subscription, let’s move on to understand how a subscription can be cancelled.

Is this article helpful?