> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xpaycheckout.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Payments Links

> This API can be used to generate payment links programmatically. Payments links are basically standalone webpages where your customer can make a one time payment.

<Info>
  **These APIs generate payment links.** For proper integration, refer to [Create Intent](/developer-resources/endpoints/payments/create-intent). To learn more about the link, refer to the [Payment Links](/products/payment-links/payment-links) page in the Products section.
</Info>


## OpenAPI

````yaml POST /link/merchant/generate-link
openapi: 3.0.1
info:
  title: xPay API Store
  description: ''
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.xpaycheckout.com
security:
  - basicAuth: []
paths:
  /link/merchant/generate-link:
    post:
      description: >-
        This API can be used to generate payment links programmatically.
        Payments links are basically standalone webpages where your customer can
        make a one time payment.
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        description: Generate Payment Link
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/generate-link'
        required: true
      responses:
        '200':
          description: Generate Payment Link
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/generate-link-response'
        '400':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
        pattern: ^[a-zA-Z0-9\-_:\.]+$
      description: >-
        A unique key for making the request idempotent. Must match pattern:
        `^[a-zA-Z0-9\-_:\.]+$`. See [Idempotent
        Requests](/developer-resources/idempotency) for more details.
      example: KG5LxwFBepaKHyUD
  schemas:
    generate-link:
      required:
        - amount
        - currency
        - customerDetails
        - expiryDate
      type: object
      properties:
        amount:
          description: >-
            The amount in lowest count unit. e.g.: For USD 1, amount is 100
            representing 100 cents (The minimum amount should be greater than 1
            USD)
          type: integer
          format: int64
          example: 100
        currency:
          type: string
          description: >-
            Three letter abbreviation of the currency. Refer [supported
            currencies](/get-started/currencies-supported)
          example: USD
        receiptId:
          type: string
          description: Your identifier of the order
          example: order123
        customerDetails:
          $ref: '#/components/schemas/BillingDetails'
        description:
          description: The description of the order, if any
          type: string
          example: Order for 2 items
        expiryDate:
          description: >-
            Timestamp in epoch milliseconds, indicating the expiration time of
            the link
          type: integer
          format: int64
          example: 32526868154000
        callbackUrl:
          description: The URL we will callback to with the xIntentId once it finishes.
          type: string
          example: https://example.com/callback
        cancelUrl:
          description: >-
            The URL to redirect the customer to when they cancel the payment. If
            not provided, the callbackUrl will be used as fallback.
          type: string
          example: https://example.com/cancel
        paymentMethods:
          type: array
          items:
            type: string
          description: >-
            List of payment methods to be enabled for the link. [supported
            payment
            methods](/get-started/payment-methods-supported#payment-method-enums)


            💡 If a selected payment method is unavailable, the system will
            automatically fallback to card payments to ensure a smooth checkout
            experience.
          example:
            - CARD
            - GOOGLE_PAY
            - APPLE_PAY
        storeFrontId:
          type: string
          description: >-
            🔵 **Beta Feature** - The unique identifier for your storefront.
            This ID is used to associate the payment link with a specific
            storefront in your account. When provided, it will replace the
            default DBA and logo with the corresponding storefront's branding.
            This feature is currently in beta testing and may be subject to
            changes.


            To enable this feature, please contact
            [hello@xpaycheckout.com](mailto:hello@xpaycheckout.com)
          example: sf_sK8d3Jq1tZxPjYVhRQW2rf
        multiUseLimit:
          type: integer
          format: int64
          description: >-
            The maximum number of times this payment link can be used. If null,
            the link can be used only once. Must be greater than 0 if provided.
          minimum: 1
          example: 5
        productPage:
          $ref: '#/components/schemas/ProductPage'
          description: Product Page - showcases more about the product in the payment links
        phoneNumberRequired:
          type: boolean
          description: >-
            Flag to indicate whether phone number is required from the customer
            during checkout. By default, this is false.
          example: false
        allowedCardInstallmentTenures:
          $ref: '#/components/schemas/AllowedCardInstallmentTenures'
    generate-link-response:
      type: object
      properties:
        shortUrl:
          type: string
          description: >-
            The shortened URL generated by the xPay API. This link can be shared
            with customers for completing payments.
          example: https://api.xpaycheckout.com/link/pcTrro7D
        disclaimer:
          type: string
          description: >-
            A message highlighting unsupported currency and payment method
            pairs. You may use this information to communicate these limitations
            to your users and set expectations.
          example: GBP is not supported on Klarna. The payment will default to USD.
    Error:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          type: string
          example: bad_request
        errorDescription:
          type: string
          example: Failed to read request
    BillingDetails:
      type: object
      description: Billing details for the customer.
      required:
        - name
        - email
        - contactNumber
      properties:
        name:
          type: string
          description: Customer's name
          example: John Doe
        email:
          type: string
          description: Customer's email address
          example: john.doe@example.com
        contactNumber:
          type: string
          description: >-
            Customer's contact number ([E.164
            format](https://en.wikipedia.org/wiki/E.164)), including the country
            code (e.g., +1 for US, +44 for UK, +91 for India).
          example: '+919123456789'
        customerAddress:
          $ref: '#/components/schemas/CustomerAddress'
    ProductPage:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Product name. Must be between 2 and 100 characters long.
          minLength: 2
          maxLength: 100
          example: Premium Subscription
        description:
          type: string
          description: Product description. Must be less than 500 characters long.
          maxLength: 500
          example: Access to premium features and content
    AllowedCardInstallmentTenures:
      type: array
      description: >-
        Optional. Restricts which Card Installment (EMI) tenures (in months) are
        offered at checkout. If omitted, all tenures enabled on your account are
        offered.
      items:
        type: string
        enum:
          - three
          - six
          - nine
          - twelve
      example:
        - three
        - six
    CustomerAddress:
      type: object
      properties:
        addressLine1:
          type: string
          description: Line 1 of the customer's address
          example: 123 Main St
        addressLine2:
          type: string
          description: Line 2 of the customer's address
          example: Apt 1
        city:
          type: string
          description: City of the customer's address
          example: New York
        state:
          type: string
          description: State of the customer's address
          example: NY
        country:
          type: string
          description: >-
            Two-letter country code ([ISO 3166-1
            alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
          example: US
        postalCode:
          type: string
          description: Postal code
          example: '2424'
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````