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

> ## Agent Instructions
> Laces is event registration software for every kind of event, not only races. Use the event's own wording.
> There is one environment, production: payments made through the API are real. Money is integer minor units; read the event's currency.
> Collecting payments with no Laces event uses POST /payments, then POST /orders/{orderId}/pay: start at /guides/collect-payments. Never call pay to test: there is no sandbox.
> Never put a client secret in browser code or an LLM chat. Branch on error_code, not on message.
> Overview of Laces: https://laces.run/llms.txt

# Create a payment for a sale on your own site

> POST /payments: create a Laces payment for something sold on your own site, with no event. Nothing is charged until you pay the order. Needs payments:write.



## OpenAPI

````yaml api-reference/v1/openapi.json POST /payments
openapi: 3.1.0
info:
  title: Laces Partner API
  version: 1.0.0
  summary: >-
    Sell tickets, or collect payments for anything you sell, from your own
    website.
  description: >-
    The Laces Partner API, served at `https://connect.laces.run/v1`. Every path
    is relative to that server URL, which already ends in `/v1`.


    Authenticate with a **bearer token** from `POST /oauth/token` (server side)
    or, on the routes that allow it, a **publishable key** in
    `X-Laces-Publishable-Key` (browser side, from an allowed domain). Keys are
    uppercase and case-sensitive: send them exactly as issued.


    There is one environment, production. Payments made through the API are
    real.


    Money is integer minor units. Every route except the token endpoint answers
    in the Laces envelope `{ code, message, data | error, error_code }`; branch
    on `error_code`, never on `message` or `error`.


    Every response carries an `X-Request-Id` header (`req_…`). Quote it to
    support@laces.run when something goes wrong. Browsers can read
    `X-Request-Id` and `Retry-After` (both are CORS-exposed). Rate-limited
    routes also send the standard `RateLimit-Limit`, `RateLimit-Remaining` and
    `RateLimit-Reset` headers.


    Partner credentials are accepted on this host only. Sent to `api.laces.run`
    (the Laces app's own API), any partner credential is refused with `401
    partner_credential_not_accepted`.
  contact:
    name: Laces support
    email: support@laces.run
    url: https://docs.laces.run
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
servers:
  - url: https://connect.laces.run/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: OAuth 2.0 client credentials.
  - name: Events
    description: >-
      Your organization's events that are on sale, and, with `events:write`,
      creating and publishing them.
  - name: Checkout sessions
    description: 'Laces-hosted checkout: redirect or embedded.'
  - name: Payments
    description: >-
      Collect payments on your own site, with no Laces event. Paid and read as
      orders.
  - name: Orders
    description: Create, pay and read orders from your own UI.
  - name: Webhook events
    description: Requests Laces sends to your webhook endpoint.
  - name: Health
    description: Liveness probe.
paths:
  /payments:
    post:
      tags:
        - Payments
      summary: Create a payment
      description: >-
        Creates a payment for something sold on **your own site**, with no Laces
        event. **Nothing is charged** until you call
        [pay](/api-reference/v1/orders/pay) with the returned `order.id` (that
        call needs `orders:write` too).


        Bearer token only, scope `payments:write`. Laces staff must have turned
        payments on for your organization (`403 shop_payments_not_enabled`). The
        organization comes from the token: never send an organization id.


        - The buyer pays the Laces fee **on top of** `amount`. `order.total` is
        what they pay. Never calculate it: use the
        [quote](/api-reference/v1/payments/quote).

        - `Idempotency-Key` is required, scoped to your API client. The same key
        and body answers `200` with the **original** answer, not the current
        status; a different body is `422 idempotency_key_reuse`.

        - The payment window is 15 minutes (`hold_expires_at`). There is no
        route to change a payment's amount or method: create a new one with a
        new key.

        - Fulfil only on a verified `order.paid` webhook or a `paid` order read.


        Guide: [Collect payments](/guides/collect-payments).
      operationId: createPayment
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            Any unique string you generate (a UUID is ideal), stored with your
            cart and **reused on every retry** of the same action. Scoped to
            your API client.
          schema:
            type: string
            maxLength: 255
          example: 6f1c3c9e-2f4b-4c64-9a2f-0d1c5a8b7e11
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentRequest'
            examples:
              product:
                summary: A product, mobile money
                value:
                  amount: 50000
                  currency: UGX
                  payment_method: momo
                  partner_reference: SHOP-ORDER-8812
                  description: Club jersey, size L
                  product: jersey
                  customer:
                    name: Amina Nakato
                    email: amina@example.com
                    phone: '+256763494235'
                  metadata:
                    cart_id: c-8812
                    size: L
                  source_url: https://shop.example.com/jerseys/home
                  on_success_url: https://shop.example.com/thanks
                  on_failure_url: https://shop.example.com/cart
              card:
                summary: Card, with return URLs
                value:
                  amount: 50000
                  currency: UGX
                  payment_method: card
                  partner_reference: SHOP-ORDER-8813
                  description: Club jersey, size M
                  product: jersey
                  customer:
                    name: Amina Nakato
                    email: amina@example.com
                    phone: '+256763494235'
                  metadata:
                    cart_id: c-8813
                    size: M
                  source_url: https://shop.example.com/jerseys/home
                  on_success_url: https://shop.example.com/thanks
                  on_failure_url: https://shop.example.com/cart
              own_event:
                summary: Several places at an event on your own site
                value:
                  amount: 225000
                  currency: UGX
                  payment_method: momo
                  partner_reference: REG-20417
                  description: 'Camp 2026: 1 adult and 2 children'
                  product: camp-2026
                  customer:
                    name: Amina Nakato
                    email: amina@example.com
                    phone: '+256763494235'
                  metadata:
                    registration_id: reg-20417
                    adults: '1'
                    children: '2'
                  source_url: https://camp.example.org/register
              other_country:
                summary: A buyer in another country
                value:
                  amount: 50000
                  currency: UGX
                  payer_country: KE
                  payment_method: momo
                  partner_reference: SHOP-ORDER-8814
                  description: Club jersey, size S
                  product: jersey
                  customer:
                    name: Amina Nakato
                    email: amina@example.com
                  metadata:
                    cart_id: c-8814
                  source_url: https://shop.example.com/jerseys/home
      responses:
        '200':
          description: 'Idempotent replay: the original payment.'
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - data
                properties:
                  code:
                    type: integer
                    description: HTTP status, repeated in the body.
                    examples:
                      - 200
                  message:
                    type: string
                  data:
                    $ref: '#/components/schemas/CreatePaymentData'
              examples:
                replay:
                  value:
                    code: 200
                    message: Payment already created (idempotent replay)
                    data:
                      order:
                        id: Pm4xT9cL
                        order_code: LC-3N8V5K
                        order_type: partner_payment
                        status: cart
                        currency: UGX
                        subtotal: 50000
                        discount_total: 0
                        donation_total: 0
                        laces_fee: 2500
                        total: 52500
                        failure_kind: null
                        partner_reference: SHOP-ORDER-8812
                        description: Club jersey, size L
                        product: jersey
                        metadata:
                          cart_id: c-8812
                          size: L
                        source_url: https://shop.example.com/jerseys/home
                        source_site: shop.example.com
                        requested_amount: 50000
                        requested_currency: UGX
                        buyer:
                          name: Amina Nakato
                          email: amina@example.com
                          phone: '+256763494235'
                        attribution:
                          channel: partner_api
                          api_client_id: LCSCLI-EXAMPLECLNT2345EXAMP
                          checkout_session_id: null
                          partner_reference: SHOP-ORDER-8812
                        hold_expires_at: '2026-11-25T08:29:03.000Z'
                        prompt_expires_at: null
                        created_at: '2026-11-25T08:14:03.000Z'
                      checkout_lines:
                        - label: Subtotal
                          amount: 50000
                        - label: Laces Service Fee
                          amount: 2500
                        - label: Total
                          amount: 52500
                      is_free: false
                      is_test_mode: false
                      fee_rate:
                        flat_fee: 500
                        percent_fee: 4
                        currency: UGX
                        payment_method: momo
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
        '201':
          description: Payment created.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - data
                properties:
                  code:
                    type: integer
                    description: HTTP status, repeated in the body.
                    examples:
                      - 201
                  message:
                    type: string
                  data:
                    $ref: '#/components/schemas/CreatePaymentData'
              examples:
                product:
                  summary: A product, mobile money
                  value:
                    code: 201
                    message: Payment created successfully
                    data:
                      order:
                        id: Pm4xT9cL
                        order_code: LC-3N8V5K
                        order_type: partner_payment
                        status: cart
                        currency: UGX
                        subtotal: 50000
                        discount_total: 0
                        donation_total: 0
                        laces_fee: 2500
                        total: 52500
                        failure_kind: null
                        partner_reference: SHOP-ORDER-8812
                        description: Club jersey, size L
                        product: jersey
                        metadata:
                          cart_id: c-8812
                          size: L
                        source_url: https://shop.example.com/jerseys/home
                        source_site: shop.example.com
                        requested_amount: 50000
                        requested_currency: UGX
                        buyer:
                          name: Amina Nakato
                          email: amina@example.com
                          phone: '+256763494235'
                        attribution:
                          channel: partner_api
                          api_client_id: LCSCLI-EXAMPLECLNT2345EXAMP
                          checkout_session_id: null
                          partner_reference: SHOP-ORDER-8812
                        hold_expires_at: '2026-11-25T08:29:03.000Z'
                        prompt_expires_at: null
                        created_at: '2026-11-25T08:14:03.000Z'
                      checkout_lines:
                        - label: Subtotal
                          amount: 50000
                        - label: Laces Service Fee
                          amount: 2500
                        - label: Total
                          amount: 52500
                      is_free: false
                      is_test_mode: false
                      fee_rate:
                        flat_fee: 500
                        percent_fee: 4
                        currency: UGX
                        payment_method: momo
                card:
                  summary: Card
                  value:
                    code: 201
                    message: Payment created successfully
                    data:
                      order:
                        id: Qd7rW2yB
                        order_code: LC-6H2J9P
                        order_type: partner_payment
                        status: cart
                        currency: UGX
                        subtotal: 50000
                        discount_total: 0
                        donation_total: 0
                        laces_fee: 4400
                        total: 54400
                        failure_kind: null
                        partner_reference: SHOP-ORDER-8813
                        description: Club jersey, size M
                        product: jersey
                        metadata:
                          cart_id: c-8813
                          size: M
                        source_url: https://shop.example.com/jerseys/home
                        source_site: shop.example.com
                        requested_amount: 50000
                        requested_currency: UGX
                        buyer:
                          name: Amina Nakato
                          email: amina@example.com
                          phone: '+256763494235'
                        attribution:
                          channel: partner_api
                          api_client_id: LCSCLI-EXAMPLECLNT2345EXAMP
                          checkout_session_id: null
                          partner_reference: SHOP-ORDER-8813
                        hold_expires_at: '2026-11-25T08:29:03.000Z'
                        prompt_expires_at: null
                        created_at: '2026-11-25T08:14:03.000Z'
                      checkout_lines:
                        - label: Subtotal
                          amount: 50000
                        - label: Laces Service Fee
                          amount: 4400
                        - label: Total
                          amount: 54400
                      is_free: false
                      is_test_mode: false
                      fee_rate:
                        flat_fee: 1500
                        percent_fee: 5.8
                        currency: UGX
                        payment_method: card
                own_event:
                  summary: Several places, own event
                  value:
                    code: 201
                    message: Payment created successfully
                    data:
                      order:
                        id: Zs5kF8nA
                        order_code: LC-4T7X2M
                        order_type: partner_payment
                        status: cart
                        currency: UGX
                        subtotal: 225000
                        discount_total: 0
                        donation_total: 0
                        laces_fee: 9500
                        total: 234500
                        failure_kind: null
                        partner_reference: REG-20417
                        description: 'Camp 2026: 1 adult and 2 children'
                        product: camp-2026
                        metadata:
                          registration_id: reg-20417
                          adults: '1'
                          children: '2'
                        source_url: https://camp.example.org/register
                        source_site: camp.example.org
                        requested_amount: 225000
                        requested_currency: UGX
                        buyer:
                          name: Amina Nakato
                          email: amina@example.com
                          phone: '+256763494235'
                        attribution:
                          channel: partner_api
                          api_client_id: LCSCLI-EXAMPLECLNT2345EXAMP
                          checkout_session_id: null
                          partner_reference: REG-20417
                        hold_expires_at: '2026-11-25T08:29:03.000Z'
                        prompt_expires_at: null
                        created_at: '2026-11-25T08:14:03.000Z'
                      checkout_lines:
                        - label: Subtotal
                          amount: 225000
                        - label: Laces Service Fee
                          amount: 9500
                        - label: Total
                          amount: 234500
                      is_free: false
                      is_test_mode: false
                      fee_rate:
                        flat_fee: 500
                        percent_fee: 4
                        currency: UGX
                        payment_method: momo
                other_country:
                  summary: A buyer in another country
                  value:
                    code: 201
                    message: Payment created successfully
                    data:
                      order:
                        id: Tb6vC3hN
                        order_code: LC-8M4D7Q
                        order_type: partner_payment
                        status: cart
                        currency: KES
                        subtotal: 172000
                        discount_total: 0
                        donation_total: 0
                        laces_fee: 6988
                        total: 178988
                        failure_kind: null
                        partner_reference: SHOP-ORDER-8814
                        description: Club jersey, size S
                        product: jersey
                        metadata:
                          cart_id: c-8814
                        source_url: https://shop.example.com/jerseys/home
                        source_site: shop.example.com
                        requested_amount: 50000
                        requested_currency: UGX
                        payer_country: KE
                        buyer:
                          name: Amina Nakato
                          email: amina@example.com
                        attribution:
                          channel: partner_api
                          api_client_id: LCSCLI-EXAMPLECLNT2345EXAMP
                          checkout_session_id: null
                          partner_reference: SHOP-ORDER-8814
                        hold_expires_at: '2026-11-25T08:29:03.000Z'
                        prompt_expires_at: null
                        created_at: '2026-11-25T08:14:03.000Z'
                      checkout_lines:
                        - label: Subtotal
                          amount: 172000
                        - label: Laces Service Fee
                          amount: 6988
                        - label: Total
                          amount: 178988
                      is_free: false
                      is_test_mode: false
                      fee_rate:
                        flat_fee: 2000
                        percent_fee: 2.9
                        currency: KES
                        payment_method: momo
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
        '400':
          description: Invalid request. `bank_transfer` is not offered in any country.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                idempotency_key_required:
                  summary: idempotency_key_required
                  value:
                    code: 400
                    message: idempotency_key_required
                    error: An Idempotency-Key header is required on this endpoint
                    error_code: idempotency_key_required
                invalid_request:
                  summary: invalid_request
                  value:
                    code: 400
                    message: invalid_request
                    error: description is required
                    error_code: invalid_request
                invalid_amount:
                  summary: invalid_amount
                  value:
                    code: 400
                    message: invalid_amount
                    error: amount must be a positive integer in minor units
                    error_code: invalid_amount
                amount_too_large:
                  summary: amount_too_large
                  value:
                    code: 400
                    message: amount_too_large
                    error: amount must be at most 5000000
                    error_code: amount_too_large
                currency_mismatch:
                  summary: currency_mismatch
                  value:
                    code: 400
                    message: currency_mismatch
                    error: currency must be UGX
                    error_code: currency_mismatch
                unsupported_country:
                  summary: unsupported_country
                  value:
                    code: 400
                    message: unsupported_country
                    error: 'payer_country must be one of: UG, KE, GH, RW, ZM'
                    error_code: unsupported_country
                invalid_payment_method:
                  summary: invalid_payment_method
                  value:
                    code: 400
                    message: invalid_payment_method
                    error: >-
                      payment_method must be one of: momo, card, airtel,
                      bank_transfer
                    error_code: invalid_payment_method
                rail_unavailable:
                  summary: rail_unavailable
                  value:
                    code: 400
                    message: rail_unavailable
                    error: >-
                      Card payments aren't available for events in Zambia yet.
                      Please pay with mobile money.
                    error_code: rail_unavailable
                invalid_metadata:
                  summary: invalid_metadata
                  value:
                    code: 400
                    message: invalid_metadata
                    error: metadata must be an object of string values
                    error_code: invalid_metadata
                invalid_source_url:
                  summary: invalid_source_url
                  value:
                    code: 400
                    message: invalid_source_url
                    error: >-
                      source_url must be an https URL (at most 2048 characters)
                      whose origin is in this client's return_url_origins
                    error_code: invalid_source_url
                invalid_return_url:
                  summary: invalid_return_url
                  value:
                    code: 400
                    message: invalid_return_url
                    error: >-
                      on_success_url must be an https URL (at most 2048
                      characters with the order id and status added) whose
                      origin is in this client's return_url_origins
                    error_code: invalid_return_url
                invalid_json:
                  summary: invalid_json
                  value:
                    code: 400
                    message: Validation failed
                    error: The request body is not valid JSON
                    error_code: invalid_json
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            Payments are off or stopped for the organization, or the credential
            may not call this.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                shop_payments_not_enabled:
                  summary: shop_payments_not_enabled
                  value:
                    code: 403
                    message: shop_payments_not_enabled
                    error: Payments are not enabled for this organization
                    error_code: shop_payments_not_enabled
                shop_payments_blocked:
                  summary: shop_payments_blocked
                  value:
                    code: 403
                    message: shop_payments_blocked
                    error: Payments are not available for this organization
                    error_code: shop_payments_blocked
                payments_disabled:
                  summary: payments_disabled
                  value:
                    code: 403
                    message: payments_disabled
                    error: This organizer is not set up to accept payments yet
                    error_code: payments_disabled
                insufficient_scope:
                  summary: insufficient_scope
                  value:
                    code: 403
                    message: Forbidden
                    error: 'Missing scope: payments:write'
                    error_code: insufficient_scope
                credential_not_permitted:
                  summary: credential_not_permitted
                  value:
                    code: 403
                    message: Forbidden
                    error: This endpoint does not accept a publishable key
                    error_code: credential_not_permitted
        '404':
          description: The token's organization no longer exists.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                org_not_found:
                  summary: org_not_found
                  value:
                    code: 404
                    message: org_not_found
                    error: Organization not found
                    error_code: org_not_found
        '409':
          description: Can't be created now.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                idempotency_in_progress:
                  summary: idempotency_in_progress
                  value:
                    code: 409
                    message: idempotency_in_progress
                    error: >-
                      A request with this idempotency key is still being
                      processed
                    error_code: idempotency_in_progress
                sale_closed:
                  summary: sale_closed
                  value:
                    code: 409
                    message: sale_closed
                    error: Payments are closed for this organization
                    error_code: sale_closed
                shop_event_conflict:
                  summary: shop_event_conflict
                  value:
                    code: 409
                    message: shop_event_conflict
                    error: Payments are unavailable for this organization
                    error_code: shop_event_conflict
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '422':
          description: >-
            The key was used with a different body, or the method has no price
            there.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                idempotency_key_reuse:
                  summary: idempotency_key_reuse
                  value:
                    code: 422
                    message: idempotency_key_reuse
                    error: >-
                      This idempotency key was already used with different
                      parameters
                    error_code: idempotency_key_reuse
                no_rate_for_method:
                  summary: no_rate_for_method
                  value:
                    code: 422
                    message: no_rate_for_method
                    error: That payment method is not available for this payment.
                    error_code: no_rate_for_method
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
        '503':
          description: No exchange rate right now. Retry shortly.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                fx_unavailable:
                  summary: fx_unavailable
                  value:
                    code: 503
                    message: fx_unavailable
                    error: >-
                      We cannot price this in KES right now. Please try again in
                      a moment.
                    error_code: fx_unavailable
      security:
        - bearerAuth: []
        - oauth2:
            - payments:write
components:
  schemas:
    CreatePaymentRequest:
      type: object
      required:
        - amount
        - partner_reference
        - description
        - customer
      description: >-
        The organization comes from the token. Never send an organization id or
        an event id.
      properties:
        amount:
          type: integer
          minimum: 1
          description: >-
            The item price **before the Laces fee**, a whole number in minor
            units of your organization's currency (UGX has none, so `50000` is
            UGX 50,000). The whole payment: send one summed amount.
          examples:
            - 50000
        currency:
          type: string
          description: >-
            Optional. If sent, must be your organization's currency, else `400
            currency_mismatch`.
          examples:
            - UGX
        payer_country:
          type: string
          description: >-
            Optional. The country the buyer pays from: one of `UG`, `KE`, `GH`,
            `RW`, `ZM` today. Sets the currency, fee and methods. Left out: your
            organization's country. Anything else is `400 unsupported_country`.
          examples:
            - KE
        payment_method:
          type: string
          enum:
            - momo
            - airtel
            - card
          description: >-
            Sets the fee, and can't be changed later. `momo` is mobile money (in
            Uganda: MTN), `airtel` is Airtel Money in Uganda (elsewhere the same
            price as `momo`). Left out: `momo`, or `card` for a US, GB or EU
            organization. Use only what the quote's `payment_methods` lists.
        partner_reference:
          type: string
          minLength: 1
          maxLength: 128
          description: Your own id. One line. Laces does not check that it is unique.
          examples:
            - SHOP-ORDER-8812
        description:
          type: string
          minLength: 1
          maxLength: 200
          description: >-
            What was bought. One line, shown to the buyer in emails. No web
            address (`://` or `www.`).
          examples:
            - Club jersey, size L
        product:
          type: string
          maxLength: 80
          description: >-
            A grouping label: the same value for everything you want totalled
            together. No web address.
          examples:
            - jersey
        customer:
          type: object
          required:
            - name
            - email
          description: The buyer.
          properties:
            name:
              type: string
              minLength: 1
              maxLength: 120
              description: One line. No web address.
              examples:
                - Amina Nakato
            email:
              type: string
              format: email
              maxLength: 254
              description: The receipt goes here.
            phone:
              type: string
              maxLength: 32
              description: >-
                A contact, not the number charged. Send the country code
                (`+256763494235`): required for US, GB and EU organizations. A
                local number is read in `payer_country`, else in your
                organization's country.
              examples:
                - '+256763494235'
        metadata:
          type: object
          maxProperties: 20
          propertyNames:
            pattern: ^[A-Za-z0-9_.-]{1,40}$
          additionalProperties:
            type: string
            maxLength: 500
          description: >-
            Your own data, flat, strings only, at most 4096 bytes of JSON. A key
            may not start and end with `__`. Returned on the order and webhooks,
            never shown to the buyer. Send ids, not personal data.
          examples:
            - cart_id: c-8812
              size: L
        source_url:
          type: string
          format: uri
          maxLength: 2048
          description: >-
            The page on your site the buyer came from. Emails link to it.
            `https`, origin in the key's Return URL domains, not a link
            shortener or shared host. Without it, the key's default site is
            used.
        on_success_url:
          type: string
          format: uri
          maxLength: 2048
          description: >-
            Where a card buyer returns after paying. Origin in the key's Return
            URL domains; at most 2048 characters with the order id and status
            added. `{LACES_ORDER_ID}` and `{LACES_STATUS}` are filled in;
            otherwise `laces_order_id` and `laces_status` are added to the
            query. Without it, the key's default is used. **Never proof of
            payment.**
        on_failure_url:
          type: string
          format: uri
          maxLength: 2048
          description: >-
            Where a card buyer returns when the payment failed or they give up.
            Same rules as `on_success_url`.
    CreatePaymentData:
      type: object
      required:
        - order
        - checkout_lines
        - is_free
        - is_test_mode
        - fee_rate
      properties:
        order:
          $ref: '#/components/schemas/PaymentOrder'
        checkout_lines:
          type: array
          description: 'Display lines: Subtotal, Laces Service Fee, Total.'
          items:
            type: object
            properties:
              label:
                type: string
              amount:
                type: integer
            required:
              - label
              - amount
        is_free:
          type: boolean
          description: 'Always `false`: a payment is at least 1.'
        is_test_mode:
          type: boolean
          description: 'Always `false` for partner integrations: every order is real.'
        fee_rate:
          type: object
          properties:
            flat_fee:
              type: integer
            percent_fee:
              type: number
            currency:
              type: string
            payment_method:
              type: string
              enum:
                - momo
                - card
                - airtel
          required:
            - flat_fee
            - percent_fee
            - currency
        payment_gateway:
          type: string
          description: Internal routing hint. Omitted when unknown; ignore it.
    Error:
      type: object
      properties:
        code:
          type: integer
          description: HTTP status, repeated in the body.
        message:
          type: string
          description: Short outcome. Do not branch on it; it may be reworded.
        error:
          type: string
          description: Human-readable detail. May be reworded; never parse it.
        error_code:
          type: string
          description: >-
            Stable machine-readable code. **Branch on this.** Present on every
            Partner API error, including `429 rate_limited`, `404 not_found` for
            unknown routes and `500 server_error`. See the [error
            reference](/concepts/errors).
        details:
          type: object
          properties:
            retry_after_seconds:
              type: integer
            masked_msisdn:
              type: string
              description: >-
                `charge_pending_same_number` only: the number, masked to its
                last digits.
            network:
              type: string
              description: '`charge_pending_same_number` only, when known.'
          description: >-
            Only on `409 prompt_in_progress`, `409 charge_pending_same_number`
            and `429 payer_prompt_limit`.
        request_id:
          type: string
          description: >-
            On `500 server_error` only: the same id as the `X-Request-Id`
            header. A 500 carries a generic `error` message, never the
            underlying cause, so quote this id to support.
        error_details:
          type: object
          additionalProperties:
            type: string
          description: >-
            Extra detail on some refusals, as string values: `field` names the
            offending body field on `unknown_field`, `validation_failed` and the
            `invalid_*` codes; `price_below_minimum` carries
            `minimum_price_minor` and `currency`; `registration_external`
            carries `registration_url`.
      required:
        - code
        - message
        - error
        - error_code
      description: The Laces error envelope.
    PaymentOrder:
      type: object
      properties:
        id:
          type: string
          description: Order id. Pass it to pay and read.
          examples:
            - Hk2mQ8vR
        order_code:
          type: string
          description: Human-readable order code shown to the buyer.
          examples:
            - LC-7K2M9X
        order_type:
          type: string
          const: partner_payment
          description: Always `partner_payment`. Ticket orders have no `order_type`.
        status:
          type: string
          description: Order status. Fulfil only on `paid`.
          enum:
            - cart
            - payment_initiated
            - prompt_sent
            - paid
            - failed
            - expired
            - cancelled
            - refunded
            - partially_refunded
            - chargeback_flagged
        currency:
          type: string
          description: >-
            What the buyer pays in. Differs from `requested_currency` when they
            pay from another country.
          examples:
            - UGX
        subtotal:
          type: integer
          description: The price before the fee, in `currency`, minor units.
        discount_total:
          type: integer
          description: Always 0 on a payment.
        donation_total:
          type: integer
          description: Always 0 on a payment.
        laces_fee:
          type: integer
          description: The Laces fee the buyer pays on top, minor units.
        total:
          type: integer
          description: >-
            **Authoritative** amount the buyer pays, in `currency`, minor units.
            It can change if the buyer changes how they pay on the Laces card
            page: compare `requested_amount` with your price instead.
        failure_kind:
          type:
            - string
            - 'null'
          enum:
            - provider_not_reached
            - timed_out
            - declined
            - other
            - null
          description: >-
            Why the latest payment attempt failed, as a sanitized bucket; `null`
            unless the order is `failed` or `expired`. Never the payment
            provider's own wording.


            - `provider_not_reached`: the charge never reached the payment
            provider. **Nothing was charged**; the buyer can try again.

            - `timed_out`: the payer didn't approve in time, or the prompt
            expired.

            - `declined`: the payer declined or cancelled, or can't pay
            (balance, PIN, limit).

            - `other`: anything else.


            Treat an unknown value as `other`. See [When it
            fails](/payments/mobile-money#step-5-when-it-fails).
          examples:
            - null
        partner_reference:
          type:
            - string
            - 'null'
          description: Your reference. Also in `attribution.partner_reference`.
          examples:
            - SHOP-ORDER-8812
        description:
          type:
            - string
            - 'null'
          description: What was bought, as you sent it.
          examples:
            - Club jersey, size L
        product:
          type: string
          description: Your grouping label. Absent when you sent none.
          examples:
            - jersey
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Exactly what you sent. Absent when you sent none.
          examples:
            - cart_id: c-8812
        source_url:
          type: string
          format: uri
          description: The page you sent. Absent when you sent none.
        source_site:
          type: string
          description: >-
            The host of `source_url`, else of the key's default site. Absent
            when there is neither. Declared by you: attribution, not proof.
          examples:
            - shop.example.com
        requested_amount:
          type:
            - integer
            - 'null'
          description: >-
            The `amount` you asked for, in `requested_currency`, whatever the
            buyer is charged in. **Compare this with your price.** `null` only
            when the stored record can't be read: check by hand.
          examples:
            - 50000
        requested_currency:
          type:
            - string
            - 'null'
          description: Your organization's currency.
          examples:
            - UGX
        payer_country:
          type: string
          description: Present when you sent it.
          examples:
            - KE
        buyer:
          type: object
          properties:
            name:
              type: string
            email:
              type: string
              format: email
            phone:
              type: string
              description: E.164, for example `+256763494235`.
              examples:
                - '+256763494235'
          description: >-
            The buyer. `phone` is E.164, absent when you sent none. **Personal
            data.**
        attribution:
          type: object
          properties:
            channel:
              type:
                - string
                - 'null'
              description: >-
                `partner_api` (custom UI), `partner_hosted` (hosted or embedded
                checkout), or null for an order that did not come through the
                Partner API.
              enum:
                - partner_api
                - partner_hosted
                - null
            api_client_id:
              type:
                - string
                - 'null'
              description: The API client that created the order.
              examples:
                - LCSCLI-EXAMPLECLNT2345EXAMP
            checkout_session_id:
              type:
                - string
                - 'null'
              description: The checkout session the order came from.
              examples:
                - null
            partner_reference:
              type:
                - string
                - 'null'
              description: Your `partner_reference` from order creation.
              examples:
                - cart-8841
          required:
            - channel
            - api_client_id
            - checkout_session_id
            - partner_reference
          description: How the order came in.
        hold_expires_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the payment window ends if the order is not paid (15 minutes
            after creation).
        prompt_expires_at:
          type:
            - string
            - 'null'
          description: >-
            When the "approve on your phone" window of the order's newest live
            mobile money prompt ends: the start of that prompt attempt plus 180
            seconds (the window the Laces payment page counts down for MTN and
            Airtel). ISO 8601 UTC. `null` for free, card and bank transfer
            orders, when no prompt is live, and once the order is finished.


            - A conservative **lower bound**: it can end a few seconds before
            the prompt reaches the phone (it is stamped when the pay request
            starts), never after.

            - **Not a failure signal.** When it passes, don't declare the
            payment failed: re-read the order or wait for `order.paid` /
            `order.failed`. A late approval can still arrive.

            - It can be **later than `hold_expires_at`**: a prompt started
            before the hold ended can still be approved and paid after it, so
            keep the timer running until `prompt_expires_at`.

            - A retry on a new prompt gives a new value.

            - Compare with your own clock allowing for skew, or count down from
            when you received the response.


            See [Show the buyer a
            timer](/guides/custom-ui#show-the-buyer-a-timer).
          format: date-time
        created_at:
          type: string
          format: date-time
      required:
        - id
        - order_code
        - order_type
        - status
        - currency
        - subtotal
        - discount_total
        - donation_total
        - laces_fee
        - total
        - failure_kind
        - partner_reference
        - description
        - requested_amount
        - requested_currency
        - attribution
        - hold_expires_at
        - prompt_expires_at
        - created_at
        - buyer
      description: >-
        A payment, as the Partner API shows it: an order with no `event_id`,
        `ticket_count` or `registrations`. Tell it apart by `order_type`.
  headers:
    X-Request-Id:
      description: >-
        Unique id of this request (`req_…`). On every response, readable from
        browsers. Quote it to support.
      schema:
        type: string
      example: req_V1StGXR8Z5jdHi6BmyTq
    Retry-After:
      description: Whole seconds to wait before retrying. Readable from browsers.
      schema:
        type: integer
    RateLimit-Limit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
    RateLimit-Reset:
      description: Seconds until the window resets.
      schema:
        type: integer
  responses:
    Unauthorized:
      description: >-
        No credential, an invalid or expired token, or an invalid publishable
        key. Comes with `WWW-Authenticate: Bearer realm="laces-partner"`.
        Revoking or regenerating keys can take up to a minute to reach every
        server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthorized:
              summary: unauthorized
              value:
                code: 401
                message: Unauthorized
                error: Missing credentials
                error_code: unauthorized
            invalid_token:
              summary: invalid_token
              value:
                code: 401
                message: Unauthorized
                error: Invalid or expired access token
                error_code: invalid_token
            invalid_key:
              summary: invalid_key
              value:
                code: 401
                message: Unauthorized
                error: Invalid publishable key
                error_code: invalid_key
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
    PayloadTooLarge:
      description: The body is over 1 MB.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            payload_too_large:
              summary: payload_too_large
              value:
                code: 413
                message: Validation failed
                error: The request body is too large
                error_code: payload_too_large
    RateLimited:
      description: >-
        Rate limited. Wait `Retry-After` seconds. Limits are per API client
        (reads about 300 a minute, writes about 60) and, for publishable keys,
        also per IP (about 120 a minute).
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 429
            message: Too many requests, please slow down
            error: rate_limited
            error_code: rate_limited
    ServerError:
      description: >-
        Unexpected failure. Retry with backoff, reusing the same
        `Idempotency-Key`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            server_error:
              summary: server_error
              value:
                code: 500
                message: An unexpected error occurred
                error: Something went wrong
                error_code: server_error
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: LCSTOK-…-X (opaque)
      description: >-
        A token from `POST /oauth/token`, valid 1 hour. Paste it as `LCSTOK-…-X`
        (without the word Bearer).
    oauth2:
      type: oauth2
      description: >-
        OAuth 2.0 client credentials. The token it yields is the `bearerAuth`
        token.
      flows:
        clientCredentials:
          tokenUrl: https://connect.laces.run/v1/oauth/token
          scopes:
            events:read: List and read events
            orders:write: Create and pay orders
            orders:read: >-
              List and read orders, including buyer personal data (off by
              default)
            checkout_sessions:write: Create and read checkout sessions
            events:write: >-
              Create, price and publish events, and set a registration URL (off
              by default)
            payments:write: >-
              Create and quote payments for sales on your own site (off by
              default; Laces must also turn payments on for the organization)

````

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