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

# Update Payment Link

> type and usageType cannot be changed after creation.

Update a payment link's name, pricing, enabled payment methods, expiry, or branding.

<Note>
  `type` and `usageType` cannot be changed after creation — create a new link instead.
</Note>


## OpenAPI

````yaml PATCH /api/v3/payment-links/{id}
openapi: 3.0.0
info:
  title: KOTANI PAY API PLATFORM
  description: ''
  version: '3.0'
  contact: {}
servers:
  - url: https://sandbox-api.kotanipay.io
    description: Sandbox
security: []
tags: []
paths:
  /api/v3/payment-links/{id}:
    patch:
      tags:
        - PAYMENT-LINKS
      summary: Update a payment link
      description: type and usageType cannot be changed after creation.
      operationId: PaymentLinksController_update_api/v3
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePaymentLinkDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Payment link updated successfully
                  data:
                    $ref: '#/components/schemas/PaymentLinkResponseDto'
                    type: object
        '401':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Invalid API Key
                  data:
                    type: object
                    example: {}
      security:
        - JWT: []
components:
  schemas:
    UpdatePaymentLinkDto:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        pricing:
          $ref: '#/components/schemas/PricingConfigDto'
        enabledPaymentMethods:
          type: array
          items:
            type: string
            enum:
              - mobile_money
              - bank
              - card
              - crypto
        paymentMethodConfig:
          $ref: '#/components/schemas/PaymentMethodConfigDto'
        maxUses:
          type: number
        expiresAt:
          type: string
          format: date-time
        collectCustomerInfo:
          $ref: '#/components/schemas/CollectCustomerInfoDto'
        afterPayment:
          $ref: '#/components/schemas/AfterPaymentConfigDto'
        callbackUrl:
          type: string
        branding:
          $ref: '#/components/schemas/BrandingConfigDto'
        metadata:
          type: object
      description: 'Note: type and usageType cannot be changed after creation.'
    PaymentLinkResponseDto:
      type: object
      properties:
        id:
          type: string
        shortCode:
          type: string
          description: Used to build the hosted checkout URL.
        url:
          type: string
          description: Full hosted checkout URL to share with customers.
          example: https://pay.kotanipay.com/abc123
        name:
          type: string
        description:
          type: string
        type:
          type: string
          enum:
            - standard
            - invoice
            - donation
        pricing:
          $ref: '#/components/schemas/PricingConfigDto'
        enabledPaymentMethods:
          type: array
          items:
            type: string
            enum:
              - mobile_money
              - bank
              - card
              - crypto
        paymentMethodConfig:
          $ref: '#/components/schemas/PaymentMethodConfigDto'
        usageType:
          type: string
          enum:
            - single_use
            - multi_use
            - limited_use
        maxUses:
          type: number
        currentUses:
          type: number
        expiresAt:
          type: string
          format: date-time
        isActive:
          type: boolean
        collectCustomerInfo:
          $ref: '#/components/schemas/CollectCustomerInfoDto'
        afterPayment:
          $ref: '#/components/schemas/AfterPaymentConfigDto'
        branding:
          $ref: '#/components/schemas/BrandingConfigDto'
        qrCodeUrl:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        lastUsedAt:
          type: string
          format: date-time
      required:
        - id
        - shortCode
        - url
        - name
        - type
        - pricing
        - enabledPaymentMethods
        - usageType
        - currentUses
        - isActive
        - collectCustomerInfo
        - createdAt
        - updatedAt
    PricingConfigDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - fixed
            - variable
            - package
            - customer_choice
        currency:
          type: string
          description: >-
            Single currency for pricing. If omitted, uses supportedCurrencies
            from paymentMethodConfig.
          example: KES
        referenceCurrency:
          type: string
          description: Reference currency the fixed, min and max amounts are specified in.
          example: KES
        amount:
          type: number
          description: Required when type is fixed.
        minAmount:
          type: number
          description: Used when type is variable.
        maxAmount:
          type: number
          description: Used when type is variable.
        packages:
          type: array
          items:
            $ref: '#/components/schemas/PricingPackageDto'
          description: Used when type is package.
      required:
        - type
    PaymentMethodConfigDto:
      type: object
      description: >-
        Restricts which providers/currencies/networks/countries are offered per
        payment method. All fields optional — omit to allow everything enabled
        on your account.
      properties:
        mobileMoneyProviders:
          type: array
          items:
            type: string
        mobileMoneyCurrencies:
          type: array
          items:
            type: string
          example:
            - KES
            - GHS
        mobileMoneyCountries:
          type: array
          items:
            type: string
        supportedCurrencies:
          type: array
          items:
            type: string
        cryptoNetworks:
          type: array
          items:
            type: string
        cryptoCurrencies:
          type: array
          items:
            type: string
          example:
            - USDT
            - USDC
        cardCurrencies:
          type: array
          items:
            type: string
        cardCountries:
          type: array
          items:
            type: string
        bankCurrencies:
          type: array
          items:
            type: string
        bankCountries:
          type: array
          items:
            type: string
    CollectCustomerInfoDto:
      type: object
      description: >-
        Whether email, phone, name, and address are required, optional, or not
        collected at checkout.
      properties:
        email:
          type: string
          enum:
            - required
            - optional
            - none
        phone:
          type: string
          enum:
            - required
            - optional
            - none
        name:
          type: string
          enum:
            - required
            - optional
            - none
        address:
          type: string
          enum:
            - required
            - optional
            - none
      required:
        - email
        - phone
        - name
    AfterPaymentConfigDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - message
            - redirect
        message:
          type: string
          description: Shown when type is message.
        redirectUrl:
          type: string
          description: Used when type is redirect.
          example: https://yourdomain.com/thank-you
      required:
        - type
    BrandingConfigDto:
      type: object
      properties:
        logoUrl:
          type: string
          example: https://yourdomain.com/logo.png
        primaryColor:
          type: string
          example: '#0084FF'
        backgroundColor:
          type: string
          example: '#FFFFFF'
    PricingPackageDto:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        amount:
          type: number
        currency:
          type: string
          example: KES
      required:
        - id
        - name
        - amount
        - currency
  securitySchemes:
    JWT:
      scheme: bearer
      bearerFormat: JWT
      type: http

````