Subscription Cancellation

The cancelSubscription() method is used to stop/cancel the subscription by passing the below parameter:

Parameters

AttributeData TypeMandatoryDescription
merchantSubscriptionIdStringYesId 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