The cancelSubscription() method is used to stop/cancel the subscription by passing the below parameter:
Parameters
Attribute | Data Type | Mandatory | Description |
---|---|---|---|
merchantSubscriptionId | String | Yes | Id generated by the merchant |
Example:
import com.phonepe.sdk.pg.subscription.v2.SubscriptionClient;
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
String merchantSubscriptionId = "<MERCHANT_SUBSCRIPTION_ID>";
SubscriptionClient subscriptionClient = SubscriptionClient.getInstance(clientId, clientSecret, clientVersion, env);
subscriptionClient.cancelSubscripition(merchantSubscriptionId);
The function type is void and hence, does not return anything