Create Order Token for Autopay Mobile SDK


This API allows you to simultaneously create a user subscription and set up its payment mandate. Use the Order Token API to generate a unique orderToken. Pass this token to the Mobile SDK to allow the user to authorize the mandate via their preferred UPI app.

Implementation Step

In your mobile application (Android, iOS, Flutter, etc.), call the startTransaction method. This method acts as the entry point for the user to authorize the UPI Mandate.

Basic Logic Flow:

  • Backend: Calls /sdk/order → receives token.
  • App: call startTransaction() by passing the received token in the mobile SDK.
  • User: Enters UPI PIN to confirm the subscription mandate.
EnvironmentHTTP MethodAPI
SandboxPOSThttps://api-preprod.phonepe.com/apis/pg-sandbox/checkout/v2/sdk/order
ProductionPOSThttps://api.phonepe.com/apis/pg/checkout/v2/sdk/order
Header NameHeader ValueDescription
Content-Typeapplication/json
AuthorizationO-Bearer <access_token>Pass access_token received in Authorization call

⚠️ For Partner Integrations!


It is mandatory to include the X-MERCHANT-ID header with the MerchantID of the end merchant.

Sample Request
{
    "merchantOrderId": "TXAB12345",
    "amount": 47900,
    "paymentFlow": {
        "type": "SUBSCRIPTION_CHECKOUT_SETUP",
        "subscriptionDetails": {
            "subscriptionType": "RECURRING",
            "merchantSubscriptionId": "TXSRD12341223",
            "authWorkflowType": "TRANSACTION",
            "amountType": "FIXED",
            "maxAmount": 47900,
            "frequency": "ON_DEMAND",
			"productType": "UPI_MANDATE",
            "expireAt": 1779689282000
        }
    },
    "expireAfter": 3000,
    "metaInfo": {
        "udf1": "some meta info of max length 256",
        "udf2": "some meta info of max length 256",
        "udf3": "some meta info of max length 256",
        "udf4": "some meta info of max length 256",
        "udf5": "some meta info of max length 256",
        "udf6": "some meta info of max length 256",
        "udf7": "some meta info of max length 256",
        "udf8": "some meta info of max length 256",
        "udf10": "some meta info of max length 256",
        "udf11": "some meta info of max length 50",
        "udf12": "some meta info of max length 50",
        "udf13": "some meta info of max length 50",
        "udf14": "some meta info of max length 50",
        "udf15": "some meta info of max length 50"
    }
}
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.
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)
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”
paymentFlow.subscriptionDetailsObjectContains all configuration details related to the subscription setup.Yes
paymentFlow.subscriptionDetails.subscriptionTypeStringSpecifies the type of subscription being created.YesAllowed value: “RECURRING”
paymentFlow.subscriptionDetails.merchantSubscriptionIdStringUnique ID for the subscription, generated by the merchant.YesMax Length: 63 characters.
paymentFlow.subscriptionDetails.authWorkflowTypeStringSpecifies the setup flow to be used (e.g., TRANSACTION or PENNY_DROP).YesAllowed values: “TRANSACTION” or “PENNY DROP”
paymentFlow.subscriptionDetails.amountTypeStringDefines how the debit amount is determined throughout the subscription lifecycle.YesAllowed values: “FIXED” or “VARIABLE”
paymentFlow.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
paymentFlow.subscriptionDetails.productTypeStringSpecifies the type of mandate or payment instrument being used.YesAllowed value: UPI_MANDATE
paymentFlow.subscriptionDetails.expireAtepochDefines the expiry time of the subscription.NoMax value: 30 Years.
expireAfterLongTime(in seconds) after which the order expires. If not provided, a default value is applied.No• Min Value: 300
• Max Value: 3600
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": "OMO123456789",
    "state": "PENDING",
    "expireAt": 1703756259307,
    "token": "<order-token>"
}
Response Parameters
Parameter NameData TypeDescription
orderIdStringUnique internal orderId generated by PhonePe Payment Gateway.
stateStringCurrent status of the order (e.g., PENDING).
expiryAtLongExpiry time of the order represented as an epoch timestamp.
tokenStringToken required to initiate the payment via SDK.

In the next section, you will learn how to check the status of a mandate after a subscription has been successfully set up. 

Is this article helpful?