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

# Create a payment link

> Makes a link that pays the account that owns the API key. Send either `amount` with `description`, or `items`. Give `url` to your customer.

Guide: [payment links](/api-reference/payment-links-overview) and [payment link errors](/api-reference/payment-links-overview#payment-link-errors).




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/payment-links
openapi: 3.1.0
info:
  title: PrimePay API
  version: '1.0'
  description: >-
    Collect mobile money payments, send transfers and make payouts with the
    PrimePay API.
servers:
  - url: https://api.primepay.mw
    description: Live API (live keys, `sk_live_…`)
  - url: https://sandbox-api.primepay.mw
    description: Sandbox API (test keys, `sk_test_…`)
security:
  - bearerAuth: []
tags:
  - name: Operators
  - name: Payments
  - name: Refunds
  - name: Transfers
  - name: Payouts
  - name: Payment links
  - name: Checkout sessions
paths:
  /v1/payment-links:
    post:
      tags:
        - Payment links
      summary: Create a payment link
      description: >
        Makes a link that pays the account that owns the API key. Send either
        `amount` with `description`, or `items`. Give `url` to your customer.


        Guide: [payment links](/api-reference/payment-links-overview) and
        [payment link
        errors](/api-reference/payment-links-overview#payment-link-errors).
      operationId: createPaymentLink
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentLinkRequest'
            examples:
              onePrice:
                summary: One price
                value:
                  name: Instagram orders
                  amount: 15000
                  description: Chitenje dress, size M
                  usage: once
                  expiresIn: 7d
                  collectName: true
                  collectEmail: false
                  redirectUrl: https://shop.example.com/thanks
              items:
                summary: A list of items
                value:
                  items:
                    - name: Chitenje dress
                      quantity: 1
                      unitAmount: 15000
                    - name: Delivery
                      quantity: 1
                      unitAmount: 2500
                  usage: many
      responses:
        '201':
          description: The link.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentLink'
              example:
                id: 0b6f6a51-6f1e-4b0e-9a55-2f4f1c9d7e10
                url: https://checkout.primepay.mw/l/7KQ2M9XW
                code: 7KQ2M9XW
                status: active
                liveMode: true
                name: Instagram orders
                description: Chitenje dress, size M
                amount: 15000
                currency: MWK
                items: []
                usage: once
                timesPaid: 0
                collectName: true
                collectEmail: false
                redirectUrl: https://shop.example.com/thanks
                createdAt: '2026-11-11T10:40:12Z'
                expiresAt: '2026-11-18T10:40:12Z'
                subMerchantAccountCode: null
                subMerchantName: null
        '400':
          $ref: '#/components/responses/Error'
components:
  schemas:
    PaymentLinkRequest:
      type: object
      properties:
        amount:
          type: number
          description: >-
            Required with `description`. Greater than zero, at most 2 decimal
            places, at most MWK 10,000,000. Don't send it with `items`.
          example: 15000
        description:
          type: string
          maxLength: 255
          description: >-
            Required with `amount`. What the customer is paying for. Shown to
            the customer.
          example: Chitenje dress, size M
        items:
          type: array
          minItems: 1
          maxItems: 50
          description: Instead of `amount`. The amount is their total.
          items:
            $ref: '#/components/schemas/PaymentLinkItem'
        name:
          type: string
          maxLength: 100
          description: A label for you only. Customers never see it.
          example: Instagram orders
        usage:
          type: string
          enum:
            - many
            - once
          default: many
          description: >-
            `many`: the link can be paid any number of times. `once`: it closes
            after the first payment.
        expiresIn:
          type: string
          enum:
            - never
            - 24h
            - 7d
            - 30d
          default: never
        collectName:
          type: boolean
          default: true
          description: Ask the customer for their name.
        collectEmail:
          type: boolean
          default: false
          description: Ask the customer for their email.
        redirectUrl:
          type: string
          description: >-
            Where the customer goes after paying. Must be a public `https://`
            address (sandbox also allows `http://localhost`). Without it, the
            customer sees PrimePay's receipt page.
    PaymentLink:
      type: object
      properties:
        id:
          type: string
        url:
          type: string
          description: The checkout address to send to your customer.
        code:
          type: string
        status:
          type: string
          enum:
            - active
            - inactive
            - completed
            - expired
          description: >-
            `active`: can be paid. `inactive`: deactivated by you, can be
            reactivated. `completed`: a `once` link that has been paid (final).
            `expired`: its `expiresAt` has passed (final).
        liveMode:
          type: boolean
        name:
          type: string
        description:
          type: string
        amount:
          type: number
        currency:
          type: string
          example: MWK
        items:
          type: array
          items:
            $ref: '#/components/schemas/PaymentLinkItem'
        usage:
          type: string
          enum:
            - many
            - once
        timesPaid:
          type: integer
          description: The number of completed payments.
        collectName:
          type: boolean
        collectEmail:
          type: boolean
        redirectUrl:
          type:
            - string
            - 'null'
        createdAt:
          type: string
          format: date-time
        expiresAt:
          type:
            - string
            - 'null'
          format: date-time
        subMerchantAccountCode:
          type:
            - string
            - 'null'
        subMerchantName:
          type:
            - string
            - 'null'
    PaymentLinkItem:
      type: object
      required:
        - name
        - unitAmount
      properties:
        name:
          type: string
          maxLength: 200
        quantity:
          type: integer
          minimum: 1
          maximum: 9999
          default: 1
        unitAmount:
          type: number
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: insufficient_funds
            message:
              type: string
              example: Not enough available balance for MWK 25,000.00.
            field:
              type: string
              description: >-
                Payment links only. The field that is missing or wrong, for
                example `items[1].unitAmount`.
  responses:
    Error:
      description: An error. Use `code` in your code; show `message` to people.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Your API key: `sk_live_…` / `sk_test_…` (secret), `pk_live_…` /
        `pk_test_…` (publishable, read-only reference data) or `rk_live_…` /
        `rk_test_…` (payments only).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.