Create Payment Link


The Create Payment Link API allows you to generate a unique payment link that you can share with your customers. This link takes them to a secure checkout page where they can complete the transaction using UPI, cards, or NetBanking.

Use this API to initiate a payment request by providing transaction details like the payment amount, a unique Merchant order ID, and other relevant information needed to generate the payment link.

EnvironmentHTTP MethodAPI
SandboxPOSThttps://api-preprod.phonepe.com/apis/pg-sandbox/paylinks/v1/pay
ProductionPOSThttps://api.phonepe.com/apis/pg/paylinks/v1/pay
Request Headers
Header NameHeader Value
Content-Typeapplication/json
AuthorizationO-Bearer <merchant-auth-token>

⚠️ For Partner Integrations!


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

Sample Request
{
    "merchantOrderId": "<merchant_order_id>",
    "description": "Early Bird Ticket: 2026 Annual Tech Conference",
    "amount": 10000,
    "paymentFlow":
    {
        "type": "PAYLINK",
        "customerDetails":
        {
            "name": "Arjun",
            "phoneNumber": "+9199231XXXXX",
            "email": "[email protected]"
        },
        "notificationChannels":
        {
            "SMS": false,
            "EMAIL": false
        },
        "expireAt": 1734109588000
    },
    "metaInfo":
    {
        "udf1": "<additional-information-1>",
        "udf2": "<additional-information-2>",
        "udf3": "<additional-information-3>",
        "udf4": "<additional-information-4>",
        "udf5": "<additional-information-5>",
        "udf6": "<additional-information-6>",
        "udf7": "<additional-information-7>",
        "udf8": "<additional-information-8>",
        "udf9": "<additional-information-9>",
        "udf10": "<additional-information-10>",
        "udf11": "<additional-information-11>",
        "udf12": "<additional-information-12>",
        "udf13": "<additional-information-13>",
        "udf14": "<additional-information-14>",
        "udf15": "<additional-information-15>"
    }
}
Request Parameters
Parameter NameData TypeDescriptionMandatory (Yes/No)Constraints
merchantOrderIdStringUnique merchant order ID generated by you.YesMaximum length is 63 characters. Only underscore (_) and hyphen (-) are allowed as special characters.
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
amountLongOrder amount specified in paisa.YesMinimum amount = 1.
metaInfoObjectMerchant defined meta info to store additional information.
Same data will be returned in status and callback response.
NoFor 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.
paymentFlowObjectAdditional details required by this flow.Yes
paymentFlow.typeStringType of payment flow.YesValued allowed = [PAYLINK]
paymentFlow.customerDetailsObjectStores Customers details.Yes
paymentFlow.customerDetails.nameObjectStores different merchant Urls.No
paymentFlow.customerDetails.phoneNumberStringCustomer Phone number.YesAllowed values: [“+9197xxxxxx89”, “97xxxxxx89”]
Note: Hyphens (-) or spaces are not allowed.
paymentFlow.customerDetails.emailStringCustomer E-mail IDNoThe email ID should follow a valid format, such as [email protected].
paymentFlow.expireAtLongThe expiry time of a payment link or transaction, given as an epoch timestamp (in milliseconds).No• The default expiry time is set to 30 days from the current moment.
• You cannot set expireAt to a time before now, and it must not exceed 45 days from the current time.
Case 1: Response for Payment Link Created Successfully
{
    "orderId": "OMOxx",
    "state": "ACTIVE",                         
    "expireAt": 1734109588000,
    "paylinkUrl": "https://phon.pe/some-key"            
}
Case 2: Response for Payment Link already Exists with Same Merchant Order ID (Not in ACTIVE State)
{
    "code": "BAD_REQUEST",
    "message": "Please check the inputs you have provided."
}
Case 3: Response for Invalid Expiry Timestamp Provided (In the Past)
{
  "code": "INVALID_EXPIRY",
  "message": "Expiry cannot be greater than 30 days"
}
Case 4: Response for Internal Server Error
{
    "code": "INTERNAL_SERVER_ERROR",
    "message": "There is an error trying to process your transaction at the moment. Please try again in a while."
}
Response Parameters
Field NameData TypeDescription
orderIdStringPayment Gateway generated internal order ID.
stateStringState of the order created, expected value is CREATED.
expiryAtLongOrder expiry date in epoch.
paylinkUrlStringThe URL where the customer can access the payment page and complete the transaction.
Error Response Parameters
Field NameData TypeDescription
codeStringError Code
messageStringError Description
headers
body params

After successfully creating a payment link request, the next step is to check the status of the payment.

Head over to the next section to learn how to check the status of payment.

Is this article helpful?