The redeem() method is used to initiate/redeem the subscription and can only be made 24 hours after the notify() function is called.
Parameters
Attribute | Data Type | Mandatory | Description |
---|---|---|---|
merchant_order_id | Str | Yes | Same merchantOrderId passed in corresponding notify request |
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
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)
Returns:
The function returns a SubscriptionRedeemResponseV2
object with the following properties:
SubscriptionRedeemResponseV2 Properties:
Here is the response property table for the given model:
Property | Type | Description |
---|---|---|
state | String | State of the order |
transaction_id | Long | Transaction ID generated by PhonePe side. |