> ## 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

# Quote a payment: fee and total per method

> POST /payments/quote: the Laces fee and the total the buyer pays for an amount, on every payment method available. Creates nothing. Needs payments:write.



## OpenAPI

````yaml api-reference/v1/openapi.json POST /payments/quote
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/quote:
    post:
      tags:
        - Payments
      summary: Quote a payment
      description: >-
        The Laces fee and the total the buyer pays for an amount, for every
        method you may offer. **Creates and charges nothing.** No
        `Idempotency-Key`.


        Bearer token only, scope `payments:write`, about 60 a minute per API
        client. The same switches apply as on create. `null` means a method is
        not available. With `payer_country`, amounts are in the buyer's currency
        and `fx` shows the indicative rate; the create uses a fresh one.


        Guide: [Collect payments](/guides/collect-payments).
      operationId: quotePayment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentQuoteRequest'
            examples:
              home:
                summary: Your own currency
                value:
                  amount: 50000
                  currency: UGX
              other_country:
                summary: A buyer in another country
                value:
                  amount: 50000
                  currency: UGX
                  payer_country: KE
      responses:
        '200':
          description: The quote.
          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/PaymentQuote'
              examples:
                home:
                  summary: Your own currency
                  value:
                    code: 200
                    message: Payment quoted successfully
                    data:
                      currency: UGX
                      price_minor: 50000
                      laces_fee_minor: 2500
                      total_minor: 52500
                      card:
                        laces_fee_minor: 4400
                        total_minor: 54400
                      airtel:
                        laces_fee_minor: 3100
                        total_minor: 53100
                      payment_methods:
                        - momo
                        - card
                        - airtel
                other_country:
                  summary: A buyer in another country
                  value:
                    code: 200
                    message: Payment quoted successfully
                    data:
                      currency: KES
                      price_minor: 172000
                      laces_fee_minor: 6988
                      total_minor: 178988
                      card:
                        laces_fee_minor: 14976
                        total_minor: 186976
                      airtel:
                        laces_fee_minor: 6988
                        total_minor: 178988
                      payment_methods:
                        - momo
                        - card
                        - airtel
                      fx:
                        rate: '0.0344'
                        source_currency: UGX
                        source_price_minor: 50000
                card_only:
                  summary: A USD organization (card only)
                  value:
                    code: 200
                    message: Payment quoted successfully
                    data:
                      currency: USD
                      price_minor: 5000
                      laces_fee_minor: null
                      total_minor: null
                      card:
                        laces_fee_minor: 330
                        total_minor: 5330
                      airtel: null
                      payment_methods:
                        - card
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
        '400':
          description: Invalid request.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                invalid_request:
                  summary: invalid_request
                  value:
                    code: 400
                    message: invalid_request
                    error: The body must be a JSON object
                    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_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
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '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:
    CreatePaymentQuoteRequest:
      type: object
      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
      required:
        - amount
      description: The organization comes from the token. Never send an organization id.
    PaymentQuote:
      type: object
      required:
        - currency
        - price_minor
        - laces_fee_minor
        - total_minor
        - card
        - airtel
        - payment_methods
      description: Amounts are in `currency`, minor units.
      properties:
        currency:
          type: string
          description: What the buyer pays in.
          examples:
            - UGX
        price_minor:
          type: integer
          description: Your amount, before the fee, in `currency`.
        laces_fee_minor:
          type:
            - integer
            - 'null'
          description: The fee by `momo`. `null` where there is no mobile money.
        total_minor:
          type:
            - integer
            - 'null'
          description: The total by `momo`. `null` where there is no mobile money.
        card:
          type:
            - object
            - 'null'
          properties:
            laces_fee_minor:
              type: integer
            total_minor:
              type: integer
          required:
            - laces_fee_minor
            - total_minor
          description: 'The same by card. `null`: not available.'
        airtel:
          type:
            - object
            - 'null'
          properties:
            laces_fee_minor:
              type: integer
            total_minor:
              type: integer
          required:
            - laces_fee_minor
            - total_minor
          description: 'The same by Airtel Money. `null`: not available.'
        payment_methods:
          type: array
          items:
            type: string
            enum:
              - momo
              - card
              - airtel
          description: What you may offer now.
        fx:
          type: object
          required:
            - rate
            - source_currency
            - source_price_minor
          description: >-
            Only when the buyer pays in another currency. An indicative rate:
            the create uses a fresh one.
          properties:
            rate:
              type: string
              description: >-
                Units of `currency` per unit of `source_currency`, as a decimal
                string.
              examples:
                - '0.0344'
            source_currency:
              type: string
              examples:
                - UGX
            source_price_minor:
              type: integer
              description: What you asked for.
    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.
  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.