Subscription Notify
The notify() method is used to send a subscription notification request. This initiates a debit request from a previously set up subscription by passing the required parameters using PgPaymentRequest.SubscriptionNotifyRequestBuilder().
Required Parameters
| Attribute | Data Type | Mandatory | Description | Default Value |
| String | Yes | Unique order ID generated by the merchant. | |
| String | Yes | Unique subscription ID generated by the merchant. | |
| Long | Yes | Amount in Paisa (FULL auth – first debit amount, PENNY auth – 200). | |
| Long | No | Epoch timestamp; the order will automatically fail if not completed within the given time (default is 10 minutes). | 48hrs |
| RedemptionRetryStrategy | No | STANDARD or CUSTOM | STANDARD |
| Boolean | No | true or false | False |
meta_info | MetaInfo | No | User-defined fields for status checks and callbacks |
Example Code
Code Reference
import com.phonepe.sdk.pg.common.models.request.PgPaymentRequest;
import com.phonepe.sdk.pg.common.models.response.PgPaymentResponse;
import com.phonepe.sdk.pg.subscription.v2.SubscriptionClient;
import com.phonepe.sdk.pg.subscription.v2.models.request.RedemptionRetryStrategy;
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 = UUID.randomUUID().toString();
String merchantSubscriptionId = "<MERCHANT_SUBSCRIPTION_ID>"; //Use same subscription ID created at the time of setup
RedemptionRetryStrategy redemptionRetryStrategy = RedemptionRetryStrategy.STANDARD;
boolean autoDebit = false;
long amount = 100;
PgPaymentRequest notifyRequest = PgPaymentRequest.SubscriptionNotifyRequestBuilder()
.merchantOrderId(merchantOrderId)
.merchantSubscriptionId(merchantSubscriptionId)
.autoDebit(autoDebit)
.redemptionRetryStrategy(redemptionRetryStrategy)
.amount(amount)
.build();
PgPaymentResponse notifyResponse = subscriptionClient.notify(notifyRequest);
String state = notifyResponse.getState(); //state will be NOTIFICATION_IN_PROGRESSReturn Values
The function returns a PgPaymentResponse object with the following properties:
| Parameter Name | Data Type | Description |
| String | Unique order ID generated by PhonePe. |
| String | State of the order. It will be NOTIFICATION_IN_PROGRESS. |
| expireAt | Long | Epoch time when the order will expire. |
What’s Next ?
Now that the subscription has been notified, let’s explore how to redeem it. Head to the next section to understand the redemption process.