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
import com.phonepe.sdk.pg.subscription.v2.SubscriptionClient;
import com.phonepe.sdk.pg.subscription.v2.models.response.SubscriptionRedeemResponseV2;
String clientId = "<clientId>";
String clientSecret = "<clientSecret>";
Integer clientVersion = <clientVersion>; //insert your client version here
Env env = Env.SANDBOX; //change to Env.PRODUCTION when you go live
SubscriptionClient subscriptionClient = SubscriptionClient.getInstance(clientId, clientSecret, clientVersion, env);
String merchantOrderId = "<MERCHANT_ORDER_ID>"; //Used at the time of notify()
SubscriptionRedeemResponseV2 subscriptionRedeemResponseV2 = subscriptionClient.redeem(merchantOrderId);Return Values
The function returns a SubscriptionRedeemResponseV2 object with the following properties:
| Parameter Name | Data Type | Description |
| String | State of the order. |
transactionId | 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.