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

# Generate Checkout Link

> Generates a link for receiving payments via Hosted Checkout. After payment, customers are redirected to the Return URL configured on your hosted application in the dashboard. For payment status updates, use application webhooks and/or an optional callbackUrl on the request body (see Payment notifications in the Checkout Link API guide).



## OpenAPI

````yaml POST /checkout-link/generate-checkout-url
openapi: 3.0.1
info:
  title: CORE API OpenAPI Specification
  description: This is the API documentation for the ClickPesa CORE API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.clickpesa.com/third-parties
security:
  - bearerAuth: []
paths:
  /checkout-link/generate-checkout-url:
    post:
      description: >-
        Generates a link for receiving payments via Hosted Checkout. After
        payment, customers are redirected to the Return URL configured on your
        hosted application in the dashboard. For payment status updates, use
        application webhooks and/or an optional callbackUrl on the request body
        (see Payment notifications in the Checkout Link API guide).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              oneOf:
                - title: Body With Total Amount
                  required:
                    - totalPrice
                    - orderReference
                    - orderCurrency
                  properties:
                    totalPrice:
                      type: string
                      description: Your order amount
                    orderReference:
                      type: string
                      description: Your unique Order reference
                    orderCurrency:
                      type: string
                      enum:
                        - TZS
                        - USD
                      description: >-
                        Your order payment currency to receive in(e.g., TZS,
                        USD)
                    customerName:
                      type: string
                      description: Your customer name
                    customerEmail:
                      type: string
                      description: Your customer email
                    customerPhone:
                      type: string
                      description: >-
                        Your customer phone number, starting with country code
                        and without the plus sign, e.g., 255712345678
                    description:
                      type: string
                      description: Your order description
                    callbackUrl:
                      type: string
                      description: >-
                        Optional URL that receives an HTTP POST when a payment
                        for this checkout link succeeds. Separate from
                        application webhooks configured in the dashboard.
                    wooCommerceCallbackURL:
                      type: string
                      description: >-
                        Optional WooCommerce order callback URL for this
                        checkout link.
                    checksum:
                      type: string
                      description: >-
                        If enabled, this is the generated checksum of the
                        payload. Refer to the [documentation](/home/checksum)
                        for more details.
                - title: Body With Order Items
                  required:
                    - orderItems
                    - orderReference
                    - orderCurrency
                  properties:
                    orderItems:
                      type: array
                      description: Your order items
                      items:
                        type: object
                        required:
                          - name
                          - price
                          - quantity
                        properties:
                          name:
                            type: string
                            description: Item name
                          price:
                            type: string
                            description: Item Amount
                          quantity:
                            type: integer
                            description: Items Quantity
                    orderReference:
                      type: string
                      description: Your unique Order reference
                    orderCurrency:
                      type: string
                      enum:
                        - TZS
                        - USD
                      description: >-
                        Your order payment currency to receive in(e.g., TZS,
                        USD)
                    customerName:
                      type: string
                      description: Your customer name
                    customerEmail:
                      type: string
                      description: Your customer email
                    customerPhone:
                      type: string
                      description: >-
                        Your customer phone number, starting with country code
                        and without the plus sign, e.g., 255712345678
                    description:
                      type: string
                      description: Your order description
                    callbackUrl:
                      type: string
                      description: >-
                        Optional URL that receives an HTTP POST when a payment
                        for this checkout link succeeds. Separate from
                        application webhooks configured in the dashboard.
                    wooCommerceCallbackURL:
                      type: string
                      description: >-
                        Optional WooCommerce order callback URL for this
                        checkout link.
                    checksum:
                      type: string
                      description: >-
                        If enabled, this is the generated checksum of the
                        payload. Refer to the [documentation](/home/checksum)
                        for more details.
      responses:
        '200':
          description: Generate Checkout Link Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response'
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Invalid or Expired Token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '404':
          description: Not Found Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
        '409':
          description: Conflict Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictError'
components:
  schemas:
    Response:
      type: object
      properties:
        checkoutLink:
          type: string
          description: Hosted Checkout Link
        clientId:
          type: string
          description: Application Client ID associated with the checkoutLink
    ValidationError:
      type: object
      properties:
        message:
          type: string
          enum:
            - Valid Client ID is required
            - Application has no access to checkout link feature.
            - Order reference is required
            - All items must have a name
            - All items must have a price
            - All items must have a quantity
            - Total Price is required
            - >-
              Invalid Order Reference, should only contain alphanumeric
              characters and cannot be blank
          example: >-
            Invalid Order Reference, should only contain alphanumeric characters
            and cannot be blank
    UnauthorizedError:
      type: object
      properties:
        message:
          type: string
          description: Unauthorized Error
          example: Unauthorized
    NotFoundError:
      type: object
      properties:
        message:
          type: string
          enum:
            - Checkout is not available for this merchant
          example: Checkout is not available for this merchant
    ConflictError:
      type: object
      properties:
        message:
          type: string
          description: Conflict message when an order reference is already used
          example: >-
            Order reference {Your reference} already used: Create a different
            reference
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authorization header containing the JWT access token returned from the
        generate token endpoint. The token already includes the Bearer prefix.
        Example: `Authorization: Bearer eyJhbGciOi...`
      bearerFormat: JWT

````