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

# Create Payment Link

> Create a new payment link to collect payments from customers.

## Overview

The Create Payment Link endpoint allows you to generate a unique URL that you can share with your customers to collect payments. This is ideal for businesses that don't have a full website integration or want to collect payments via chat, email, or SMS.

## Key Features

* **Customizable Expiry**: Set how long the link remains valid.
* **Buyer Information**: Pre-fill buyer details to simplify their checkout experience.
* **Product Details**: Include what the payment is for.
* **Instant Sharing**: Get a link that can be shared immediately.

## Request Parameters

The request body follows the same structure as the [Create Order](/api-reference/order/create) API, but it's specifically optimized for generating shareable links.

### Required Fields

* `amount`: The amount to collect.
* `currency`: Currently supports `INR`.
* `reference_id`: Your internal reference for this payment.
* `buyer`: Customer details (name, email, phone, address).
* `product`: Details of the item or service.
* `invoice`: Invoice number and date.

### Optional Fields

* `expiry_date`: When the link should expire (ISO 8601 format). Defaults to 1 year if not provided.


## OpenAPI

````yaml POST /pg/payment-links/
openapi: 3.0.0
info:
  title: Eximpe Payment Gateway API
  description: >-
    API for payment processing and order management through Eximpe payment
    gateway. This specification includes v1, v2, and v3 API versions.
  license:
    name: Proprietary
  version: 2.0.0
servers:
  - url: https://api-pacb-uat.eximpe.com
    description: Payment Gateway Sandbox URL
security:
  - clientAuth: []
    clientSecretAuth: []
    apiVersionHeader: []
tags:
  - name: Card Tokens
  - name: Merchants
  - name: Orders
  - name: Payment Links
  - name: Payments
  - name: Refunds
  - name: Settlements
  - name: Subscriptions
paths:
  /pg/payment-links/:
    post:
      tags:
        - Payment Links
      summary: Create Payment Link
      description: Create a new payment link to collect payments from customers.
      operationId: v1_post_pg_payment-links_
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1_CreatePaymentLinkRequest'
      responses:
        '201':
          description: Payment link created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_CreatePaymentLinkResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_ErrorResponse'
      security:
        - clientAuth: []
          clientSecretAuth: []
          merchantAuth: []
          apiVersionHeader: []
components:
  schemas:
    v1_CreatePaymentLinkRequest:
      type: object
      required:
        - amount
        - reference_id
        - buyer
        - product
        - invoice
      properties:
        amount:
          type: number
          format: float
        reference_id:
          type: string
          description: Unique identifier for the order
        expiry_date:
          type: string
          format: date-time
          description: Expiry date in UTC
        buyer:
          type: object
          required:
            - name
            - email
            - phone
            - address
          properties:
            name:
              type: string
            email:
              type: string
              format: email
            phone:
              type: string
              description: Phone number with country code
            send_sms:
              type: boolean
              default: false
            send_email:
              type: boolean
              default: false
            address:
              $ref: '#/components/schemas/v1_Address'
        product:
          type: object
          required:
            - name
            - type_of_goods
          properties:
            name:
              type: string
            description:
              type: string
            type_of_goods:
              type: string
              enum:
                - physical_goods
                - digital_goods
                - service
            hs_code:
              type: string
              description: Harmonized System code, required for physical goods
            hs_code_description:
              type: string
              description: Description of the HS code
        invoice:
          type: object
          required:
            - number
          properties:
            number:
              type: string
              description: Alphanumeric invoice number
    v1_CreatePaymentLinkResponse:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          type: object
          properties:
            payment_id:
              type: string
            payment_link:
              type: string
              format: uri
            amount:
              type: string
            currency:
              type: string
    v1_ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
          description: >-
            Indicates if the request was successful. Always false for error
            responses.
        error:
          $ref: '#/components/schemas/v1_ErrorDetails'
    v1_Address:
      type: object
      required:
        - line_1
        - city
        - state
        - postal_code
      properties:
        line_1:
          type: string
          description: Address line 1
        line_2:
          type: string
          description: Address line 2
        city:
          type: string
          description: City name
        state:
          type: string
          description: State name
        postal_code:
          type: string
          description: Postal/ZIP code
    v1_ErrorDetails:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code (e.g., ERR_ORDER_002)
        message:
          type: string
          description: Error message
        details:
          type: object
          description: Detailed validation error information with field-specific errors
          additionalProperties:
            type: string
            description: Error message for the specific field
  securitySchemes:
    clientAuth:
      type: apiKey
      name: X-Client-ID
      in: header
      description: >-
        **Client Application ID** - Your unique application identifier used to
        authenticate API requests. You can find your Client ID in the Developer
        Settings section of the merchant dashboard.
      x-displayName: Client ID
      x-example: your-client-id
    clientSecretAuth:
      type: apiKey
      name: X-Client-Secret
      in: header
      description: >-
        **Client Secret Key** - Your secret key used alongside the Client ID for
        secure authentication. Keep this confidential and never expose it in
        client-side code. Available in the Developer Settings section of the
        merchant dashboard.
      x-displayName: Client Secret
      x-example: your-client-secret
    apiVersionHeader:
      type: apiKey
      name: X-API-Version
      in: header
      description: >-
        **API Version** - Specifies which version of the API to use (e.g.,
        '1.X.X', '2.X.X', or '3.X.X'). This header allows you to control which
        API version your integration uses. Default version information is
        available in the Developer Settings.
      x-displayName: API Version
      x-example: 3.0.0
    merchantAuth:
      type: apiKey
      name: X-Merchant-ID
      in: header
      description: >-
        **Merchant Identifier** - The unique ID for the merchant account. This
        is required for PSP (Payment Service Provider) merchants who manage
        multiple merchant accounts. You can find merchant IDs in the Merchant
        Management section of the dashboard.
      x-displayName: Merchant ID
      x-example: your-merchant-id

````