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

# Quote the Krti saving for an amount

> The best offer a new shopper can get at the store for this amount, before any payment
method is chosen: the amount after the saving, whether it may be less ("up to"), the
methods that unlock it, and the words the pop-up uses. Nothing is reserved or recorded.

- `offer` is null when no offer applies (the amount is outside every offer's range, above
  the store's maximum, or the store has no active campaign).
- `nudge` is set only with `source=cart`, when `offer` is null and an offer applies from a
  higher amount: "Save 3.000 KWD on orders from 60.000 KWD".
- `methods` lists the store's country's active payment methods, named in `lang`.
- `popupUrl` is the "Learn more" page for this quote (the checkout app's `/promo`).




## OpenAPI

````yaml /api-reference/openapi.yaml get /public/promo
openapi: 3.1.0
info:
  title: Krti Public API
  version: 1.0.0
  summary: The unauthenticated endpoints behind on-site messaging (`/public/promo`).
  description: >
    What `krti.js` (js.krti.com) reads: the saving for an amount at a store,
    identified by the

    store's public key. No secret, the same answer for every shopper, cacheable
    for a minute.

    Implemented in `internal/promo`; this file is the contract, changed first,
    and copied to

    the docs repo `krti-tech/krti-docs` (`api-reference/openapi.yaml`, its
    `sync-openapi.sh`)

    for docs.krti.com.


    **Conventions**


    - Errors are `application/problem+json` (RFC 9457) with a stable `code`.

    - Money is a decimal **string** with the currency's decimals (KWD has 3),
    never a float.

    - `GET /public/promo` answers `Access-Control-Allow-Origin: *` (no
    credentials) and
      `Cache-Control: public, max-age=60`, `Vary: Accept-Language`.
    - Rate limits: 600/min per key, 60/min per client IP; past them 429 with
    `Retry-After`.
servers:
  - url: https://api.krti.com
    description: Production (pk_live_ keys)
  - url: https://sandbox-api.krti.com
    description: Sandbox (pk_test_ keys)
security: []
tags:
  - name: Promo
    description: The on-site messaging quote.
paths:
  /public/promo:
    get:
      tags:
        - Promo
      summary: Quote the Krti saving for an amount
      description: >
        The best offer a new shopper can get at the store for this amount,
        before any payment

        method is chosen: the amount after the saving, whether it may be less
        ("up to"), the

        methods that unlock it, and the words the pop-up uses. Nothing is
        reserved or recorded.


        - `offer` is null when no offer applies (the amount is outside every
        offer's range, above
          the store's maximum, or the store has no active campaign).
        - `nudge` is set only with `source=cart`, when `offer` is null and an
        offer applies from a
          higher amount: "Save 3.000 KWD on orders from 60.000 KWD".
        - `methods` lists the store's country's active payment methods, named in
        `lang`.

        - `popupUrl` is the "Learn more" page for this quote (the checkout app's
        `/promo`).
      operationId: getPromoQuote
      parameters:
        - name: key
          in: query
          required: true
          description: The store's public key (partners console, Website messaging).
          schema:
            type: string
            pattern: ^pk_(live|test)_[0-9A-Za-z]{22}$
            examples:
              - pk_live_7Qm3kXbN2pLw9ZtRa4Vy8s
        - name: amount
          in: query
          required: true
          description: >
            The product, cart or order amount: plain digits with an optional
            fraction of at most

            the currency's decimals (`45.000` for KWD). No sign, no exponent, at
            most 12 integer

            digits. An amount above the store's maximum answers 200 with `offer`
            null.
          schema:
            type: string
            pattern: ^[0-9]{1,12}(\.[0-9]{1,6})?$
            examples:
              - '45.000'
        - name: currency
          in: query
          required: true
          description: ISO 4217 code; must be the store's currency.
          schema:
            type: string
            examples:
              - KWD
        - name: lang
          in: query
          required: false
          description: >-
            Language of the shopper-facing strings; else `Accept-Language`, else
            `en`.
          schema:
            type: string
            enum:
              - en
              - ar
        - name: sku
          in: query
          required: false
          description: >-
            The product's SKU, so SKU-specific offers apply (at most 64
            characters).
          schema:
            type: string
            maxLength: 64
        - name: source
          in: query
          required: false
          description: Where the message is shown. `cart` enables the nudge.
          schema:
            type: string
            enum:
              - product
              - cart
      responses:
        '200':
          description: The quote.
          headers:
            Cache-Control:
              schema:
                type: string
              description: '`public, max-age=60`'
            Access-Control-Allow-Origin:
              schema:
                type: string
              description: '`*`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromoQuote'
              examples:
                offer:
                  summary: An offer applies
                  value:
                    merchant:
                      name: Qasr Jamal
                      logoUrl: >-
                        https://api.krti.com/assets/merchant-logos/3f2a.../logo.png
                    amount: '45.000'
                    currency: KWD
                    lang: en
                    offer:
                      discount: '3.000'
                      charged: '42.000'
                      upTo: false
                      requiresMethods: []
                      reason: 10% off, up to 5.000 KWD
                    nudge: null
                    methods:
                      - code: knet
                        name: KNET
                      - code: visa_master
                        name: Visa / Mastercard
                      - code: apple_pay
                        name: Apple Pay
                    popupUrl: >-
                      https://checkout.krti.com/promo?key=pk_live_7Qm3kXbN2pLw9ZtRa4Vy8s&amount=45.000&currency=KWD&lang=en
                upTo:
                  summary: The offer needs KNET
                  value:
                    merchant:
                      name: Qasr Jamal
                      logoUrl: null
                    amount: '45.000'
                    currency: KWD
                    lang: en
                    offer:
                      discount: '3.000'
                      charged: '42.000'
                      upTo: true
                      requiresMethods:
                        - knet
                      reason: 10% off with KNET
                    nudge: null
                    methods:
                      - code: knet
                        name: KNET
                      - code: visa_master
                        name: Visa / Mastercard
                    popupUrl: >-
                      https://checkout.krti.com/promo?key=pk_live_7Qm3kXbN2pLw9ZtRa4Vy8s&amount=45.000&currency=KWD&lang=en
                nudge:
                  summary: The cart is under the offer's minimum
                  value:
                    merchant:
                      name: Qasr Jamal
                      logoUrl: null
                    amount: '45.000'
                    currency: KWD
                    lang: en
                    offer: null
                    nudge:
                      discount: '3.000'
                      fromAmount: '60.000'
                    methods:
                      - code: knet
                        name: KNET
                    popupUrl: >-
                      https://checkout.krti.com/promo?key=pk_live_7Qm3kXbN2pLw9ZtRa4Vy8s&amount=45.000&currency=KWD&lang=en&source=cart
                generic:
                  summary: No offer for this amount
                  value:
                    merchant:
                      name: Qasr Jamal
                      logoUrl: null
                    amount: '45.000'
                    currency: KWD
                    lang: ar
                    offer: null
                    nudge: null
                    methods:
                      - code: knet
                        name: كي نت
                    popupUrl: >-
                      https://checkout.krti.com/promo?key=pk_live_7Qm3kXbN2pLw9ZtRa4Vy8s&amount=45.000&currency=KWD&lang=ar
        '404':
          description: >-
            Unknown or revoked key, a key of the other environment, or a store
            that is not active.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: about:blank
                title: Not Found
                status: 404
                code: key_not_found
        '422':
          description: >-
            A missing or malformed parameter (`validation_failed`), or a
            currency that is not the store's (`currency_mismatch`).
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: about:blank
                title: Unprocessable Entity
                status: 422
                code: validation_failed
                detail: amount must be plain digits with at most 6 decimals
        '429':
          description: A rate limit was reached; wait `Retry-After` seconds.
          headers:
            Retry-After:
              schema:
                type: integer
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              example:
                type: about:blank
                title: Too Many Requests
                status: 429
                code: too_many_requests
components:
  schemas:
    PromoQuote:
      type: object
      required:
        - merchant
        - amount
        - currency
        - lang
        - offer
        - nudge
        - methods
        - popupUrl
      properties:
        merchant:
          type: object
          required:
            - name
            - logoUrl
          properties:
            name:
              type: string
              description: The store's name.
            logoUrl:
              type:
                - string
                - 'null'
              format: uri
              description: The store's logo, when it has one.
        amount:
          type: string
          description: The amount asked
          formatted with the currency's decimals.: null
        currency:
          type: string
        lang:
          type: string
          enum:
            - en
            - ar
          description: The language of `reason` and `methods[].name`.
        offer:
          oneOf:
            - $ref: '#/components/schemas/Offer'
            - type: 'null'
          description: The best offer for this amount, or null.
        nudge:
          oneOf:
            - $ref: '#/components/schemas/Nudge'
            - type: 'null'
          description: >-
            Only with `source=cart` and no offer, the closest offer by minimum
            amount.
        methods:
          type: array
          items:
            type: object
            required:
              - code
              - name
            properties:
              code:
                type: string
                description: >-
                  Krti payment method code (`knet`, `visa_master`, `apple_pay`,
                  ...).
              name:
                type: string
                description: The method's name in `lang`.
        popupUrl:
          type: string
          format: uri
          description: The Learn more page for this quote.
    Problem:
      type: object
      required:
        - type
        - title
        - status
        - code
      properties:
        type:
          type: string
        title:
          type: string
        status:
          type: integer
        code:
          type: string
          description: Stable machine-readable code.
        detail:
          type: string
          description: For humans; may change.
        requestId:
          type: string
    Offer:
      type: object
      required:
        - discount
        - charged
        - upTo
        - requiresMethods
        - reason
      properties:
        discount:
          type: string
          description: The shopper's saving.
        charged:
          type: string
          description: What the shopper pays after the saving.
        upTo:
          type: boolean
          description: >-
            True when the shopper may get less, because the offer needs a
            payment method, has a per-customer limit or a holdout. The line then
            says "from".
        requiresMethods:
          type: array
          items:
            type: string
          description: The method codes that unlock the offer; empty when any method does.
        reason:
          type: string
          description: The offer in the shopper's words, e.g. "10% off, up to 5.000 KWD".
    Nudge:
      type: object
      required:
        - discount
        - fromAmount
      properties:
        discount:
          type: string
          description: The saving at the offer's minimum amount.
        fromAmount:
          type: string
          description: The offer's minimum order amount.

````

## Related topics

- [Krti for developers](https://docs.krti.com/index.md)
- [Public keys](https://docs.krti.com/on-site-messaging/keys.md)
- [The pop-up without the script](https://docs.krti.com/on-site-messaging/popup.md)


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