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

# Create Payment Link

> Create a hosted page where a customer pays by M-Pesa.

Share the returned `url` by SMS, WhatsApp or email. The customer opens it, enters their number (or confirms a pre-filled one) and pays by STK Push.

* Omit `amount` to let the customer type it.
* Payments appear as STK transactions and are sent to `callbackUrl` like any STK Push.
* `expiry` is one of `1h`, `6h`, `24h`, `72h`, `168h`, `720h` or `never` (the default).
* Live keys only. Test keys get `403 NOT_AVAILABLE_IN_TEST_MODE`. MCP keys need `paylinks:write`.
* An account can have up to **10 payment links** (active or disabled). The 11th returns `400 PAYLINK_LIMIT_REACHED`. [Delete](https://docs.palpluss.com/api-reference/payment-links/disable.md) a link you no longer need to make room.


## OpenAPI

````yaml POST /payment-links
openapi: 3.1.0
info:
  title: PalPluss API
  version: '1.0'
  summary: >-
    Payment infrastructure for Kenya — STK Push, B2C payouts, and wallet
    management.
  description: >
    The PalPluss API gives developers programmatic access to M-Pesa STK Push
    collections,

    B2C payouts, service wallet top-ups, and payment channel management.


    **Base URL:** `https://api.palpluss.com/v1`


    All requests must be authenticated with an API key using HTTP Basic Auth.

    All responses are wrapped in a standard envelope. See [Errors](#tag/errors)
    for error codes.


    Amounts are in **KES (Kenyan Shillings)** unless stated otherwise. Phone
    numbers

    are normalized to the `254XXXXXXXXX` format internally.
  contact:
    name: PalPluss Developer Support
    email: developer@palpluss.com
    url: https://palpluss.com/developers
servers:
  - url: https://api.palpluss.com/v1
    description: Production (live and test keys use the same URL)
security:
  - BasicAuth: []
tags:
  - name: STK Push
    description: >
      Initiate M-Pesa STK Push payment prompts. The customer receives a PIN
      prompt on their

      phone and confirms payment. PalPluss delivers the result asynchronously to
      your webhook URL.
  - name: Transactions
    description: >-
      Query the status of any transaction by ID, or list all transactions with
      filters.
  - name: B2C Payouts
    description: >
      Send money directly to a customer's M-Pesa number. Requires KYC approval
      and sufficient

      B2C wallet balance. Payouts are processed asynchronously.
  - name: Service Wallet
    description: >
      The service wallet holds pre-funded tokens used to pay PalPluss
      transaction fees.

      Top up via STK Push. Balance is deducted with each API call.
  - name: Payment Channels
    description: >
      Payment channels represent the M-Pesa shortcodes (Paybill / Till)
      associated with your

      account. Channels are used to route STK Push requests to a specific
      shortcode.
  - name: Payment Links
    description: >
      Hosted pages where a customer enters their number and pays by STK Push.
      Live keys can

      create and disable links; test keys can only read them.
  - name: Account
    description: The calling API key, fee estimates and wallet history.
  - name: Approvals
    description: >
      Payouts and channel changes made with MCP keys that PalPluss holds until
      the merchant

      approves them in the console.
paths:
  /payment-links:
    post:
      tags:
        - Payment Links
      summary: Create payment link
      description: >
        Creates a hosted payment page. Share the returned `url`; the customer
        enters their

        phone number and pays by STK Push. Payments appear as STK transactions
        and fire your

        `callbackUrl` like any STK Push. Not available with test keys.


        An account can have up to 10 payment links (any status); the 11th
        returns

        `400 PAYLINK_LIMIT_REACHED`. Delete one with `DELETE
        /payment-links/{id}?permanent=true`.
      operationId: createPaymentLink
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentLinkRequest'
            examples:
              fixed:
                summary: Fixed amount
                value:
                  amount: 1500
                  external_reference: INV-2041
                  customer_name: Jane
                  expiry: 72h
                  callbackUrl: https://yourserver.com/webhooks/palpluss
      responses:
        '201':
          description: Payment link created.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/PaymentLink'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    CreatePaymentLinkRequest:
      type: object
      properties:
        amount:
          type: number
          minimum: 1
          description: Fixed amount. Omit to let the customer enter it.
        phone_number:
          type: string
          description: Pre-fill the customer's phone.
        customer_name:
          type: string
          maxLength: 120
        external_reference:
          type: string
          maxLength: 120
        channel_id:
          type: string
          format: uuid
          description: Channel to collect into (default channel if omitted).
        callbackUrl:
          type: string
          format: uri
        expiry:
          type: string
          enum:
            - 1h
            - 6h
            - 24h
            - 72h
            - 168h
            - 720h
            - never
          default: never
    SuccessEnvelope:
      type: object
      required:
        - success
        - data
        - requestId
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          description: Response payload. Shape varies by endpoint.
        requestId:
          type: string
          format: uuid
          description: Unique identifier for this API request. Include in support tickets.
          example: c1b2a3d4-e5f6-7890-abcd-ef1234567890
    PaymentLink:
      type: object
      properties:
        id:
          type: string
          format: uuid
        url:
          type: string
          example: https://link.palpluss.com/8b1f…
        channel_id:
          type: string
          format: uuid
          nullable: true
        amount:
          type: number
          nullable: true
          description: Null when the customer enters the amount.
        currency:
          type: string
          example: KES
        phone_number:
          type: string
          nullable: true
        customer_name:
          type: string
          nullable: true
        external_reference:
          type: string
          nullable: true
        callback_url:
          type: string
          nullable: true
        expires_at:
          type: string
          format: date-time
          nullable: true
        status:
          type: string
          enum:
            - ACTIVE
            - DISABLED
        created_at:
          type: string
          format: date-time
    ErrorEnvelope:
      type: object
      required:
        - success
        - error
        - requestId
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
            - message
            - code
          properties:
            message:
              type: string
              description: Human-readable error description.
              example: Invalid API key
            code:
              type: string
              description: Machine-readable error code.
              example: INVALID_API_KEY
            details:
              type: object
              description: Optional structured details about the error.
        requestId:
          type: string
          format: uuid
          example: c1b2a3d4-e5f6-7890-abcd-ef1234567890
  responses:
    BadRequest:
      description: Validation error — check the request body or parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            invalid_phone:
              value:
                success: false
                error:
                  message: Invalid phone number format.
                  code: INVALID_PHONE
                  details: {}
                requestId: a1b2c3d4-0000-0000-0000-000000000000
    Unauthorized:
      description: Missing, invalid, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            invalid_key:
              value:
                success: false
                error:
                  message: Invalid or revoked API key.
                  code: INVALID_API_KEY
                  details: {}
                requestId: a1b2c3d4-0000-0000-0000-000000000000
    Forbidden:
      description: >
        Refused for this key. `error.details.code` is one of
        `INSUFFICIENT_SCOPE` (MCP key lacks the

        permission), `IP_NOT_ALLOWED` or `NOT_AVAILABLE_IN_TEST_MODE`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: >
        Paste your PalPluss API key in the **username** field and leave the

        **password** field empty — it is ignored.


        Get your key from **console → API Keys**. Live keys start with
        `pp_live_`,

        test keys (simulated money) with `pp_test_`.


        In your own code, send the key directly:

        `Authorization: Basic YOUR_API_KEY`

````

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