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 |
---|---|---|---|
merchantOrderId | String | Yes | Same 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:
Property | Type | Description |
---|---|---|
state | String | State of the order |
transactionId | Long | Transaction ID generated by PhonePe side. |