Setup Subscription


This API allows you to simultaneously create a user subscription and set up its payment mandate.

EnvironmentHTTP MethodAPI
SandboxPOSThttps://api-preprod.phonepe.com/apis/pg-sandbox/paylinks/v1/pay
ProductionPOSThttps://api.phonepe.com/apis/pg/paylinks/v1/pay
Header NameHeader ValueDescription
Content-Typeapplication/json
AuthorizationO-Bearer <access_token>Pass access_token received in Authorization call
Sample Request for Transaction
{
  "merchantOrderId": "MO110222000493",
  "description": "some message",
  "currency": "INR",
  "amount": 47900,
  "expireAt": 2592000,
  "constraints": [
    {
      "type": "ACCOUNT",
      "accountNumber": "1234567890",
      "ifsc": "HDFC13434"
    }
  ],
  "paymentFlow": {
    "type": "SUBSCRIPTION_PAYLINK_SETUP",
    "customerDetails": {
      "name": "Nikhil",
      "phoneNumber": "+919845******",
      "email": "[email protected]"
    },
    "subscriptionDetails": {
      "subscriptionType": "RECURRING",
      "merchantSubscriptionId": "MS10022200000483",
      "authWorkflowType": "TRANSACTION",
      "amountType": "VARIABLE",
      "maxAmount": 47900,
      "productType": "UPI_MANDATE",
      "frequency": "ON_DEMAND",
      "expireAt": 2889689282000
    },
    "metaInfo": {
      "udf1": "string",
      "udf2": "string",
      "udf3": "string",
      "udf4": "string",
      "udf5": "string",
      "udf6": "string",
      "udf7": "string",
      "udf8": "string",
      "udf9": "string",
      "udf10": "string",
      "udf11": "string",
      "udf12": "string",
      "udf13": "string",
      "udf14": "string",
      "udf15": "string"
    }
  }
}
Sample Request for Penny drop
{
  "merchantOrderId": "MO11022210010493",
  "description": "some message",
  "currency": "INR",
  "amount": 200,
  "expireAt": 2592000,
  "constraints": [
    {
      "type": "ACCOUNT",
      "accountNumber": "1234567890",
      "ifsc": "HDFC13434"
    }
  ],
  "paymentFlow": {
    "type": "SUBSCRIPTION_PAYLINK_SETUP",
    "customerDetails": {
      "name": "Nikhil",
      "phoneNumber": "+919845******",
      "email": "[email protected]"
    },
    "subscriptionDetails": {
      "subscriptionType": "RECURRING",
      "merchantSubscriptionId": "MS100120483",
      "authWorkflowType": "PENNY_DROP",
      "amountType": "VARIABLE",
      "maxAmount": 47900,
      "productType": "UPI_MANDATE",
      "frequency": "ON_DEMAND",
      "expireAt": 2889689282000
    },
    "metaInfo": {
      "udf1": "string",
      "udf2": "string",
      "udf3": "string",
      "udf4": "string",
      "udf5": "string",
      "udf6": "string",
      "udf7": "string",
      "udf8": "string",
      "udf9": "string",
      "udf10": "string",
      "udf11": "string",
      "udf12": "string",
      "udf13": "string",
      "udf14": "string",
      "udf15": "string"
    }
  }
}
Request Parameters
Parameter NameData TypeDescriptionMandatoryConstraints
merchantOrderIdStringUnique orderId generated by the merchant to track the transactions.Yes• Max Length: 63 characters.
• Only Alphanumeric characters, underscore “_” and hyphen “-“ are allowed.
descriptionStringA brief description of what the payment is for, and this message will be shown in the checkout page for your customers.Nomax size 150 characters
currencyStingRepresents the currency of the subscription amount (e.g., INR, USD).Yes
amountLongTransaction order amount in paise. This value is used to set up the mandate based on the selected authWorkflowType.Yes• For PENNY_DROP flow, the amount should be equal to 200 (In Paise)

• For TRANSACTION flow, the amount should be greater than or equal to 100 or the first debit amount(In Paise)
expireAtepochSpecifies the timestamp when the payment link will expire.Yes
paymentFlowObjectContains additional details required to process the selected payment flow.Yes
paymentFlow.typeStringSpecifies the type of payment flow to be executed.YesAllowed value: “SUBSCRIPTION_CHECKOUT_SETUP”
subscriptionDetailsObjectContains all configuration details related to the subscription setup.Yes
subscriptionDetails.subscriptionTypeStringSpecifies the type of subscription being created.YesAllowed value: “RECURRING”
subscriptionDetails.merchantSubscriptionIdStringUnique ID for the subscription, generated by the merchant.YesMax Length: 63 characters.
subscriptionDetails.authWorkflowTypeStringSpecifies the setup flow to be used (e.g., TRANSACTION or PENNY_DROP).YesAllowed values: “TRANSACTION” or “PENNY DROP”
subscriptionDetails.amountTypeStringDefines how the debit amount is determined throughout the subscription lifecycle.YesAllowed values: “FIXED” or “VARIABLE”
subscriptionDetails.maxAmountLongMaximum amount that can be debited during the subscription cycle. Value should be in paise.YesMax Limit: 1500000 paisa(i.e., ₹15,000)
paymentFlow.subscriptionDetails.frequencyStringSpecifies how often the subscription amount will be debited.YesAllowed values:
• DAILY
• WEEKLY
• MONTHLY
• FORTNIGHTLY
• BIMONTHLY
• QUARTERLY
• HALFYEARLY
• YEARLY
• ON_DEMAND
subscriptionDetails.productTypeStringSpecifies the type of mandate or payment instrument being used.YesAllowed value: UPI_MANDATE
subscriptionDetails.expireAtepochDefines the expiry time of the subscription.NoMax value: 30 Years.
metaInfoObjectAdditional information defined by merchant. This data is returned in both status and callback responses.No• For udf1 to udf10, there is no constraint. Maximum length: 256 characters
• For udf11 to udf15, alphanumeric values with _-+@. are allowed. Maximum length: 50 characters
Note: It is mandatory to keep the parameter names udf1, udf2, etc., exactly as they are in the metainfo block. Renaming these key values will result in a production error.
Sample Response
{
    "orderId": "OMO2606111408417110362689BW",
    "state": "ACTIVE",
    "paylinkUrl": "https://stg.phon.pe/t5oy9p6k",
    "expireAt": 1783759121079
}
Response Parameters
Field NameData TypeDescription
orderIdStringUnique internal orderId generated by PhonePe Payment Gateway.
stateStringState of the order created, expected value is Active.
expiryAtLongExpiry time of the order represented as an epoch timestamp.
paylinkUrlStringThe URL where the customer can access the payment page and complete the transaction.

Is this article helpful?