Subscription Redeem

The redeem() method is used to initiate/redeem the subscription and can only be made 24 hours after the notify() function is called.

Parameters

AttributeData TypeMandatoryDescription
merchantOrderIdStringYesSame merchantOrderId passed in corresponding notify request

Example:

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 = 1;                      //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);

Returns:

The function returns a SubscriptionRedeemResponseV2 object with the following properties:

SubscriptionRedeemResponseV2 Properties:

Here is the response property table for the given model:

PropertyTypeDescription
stateStringState of the order
transactionIdLongTransaction ID generated by PhonePe side.