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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# Crear cotización de promoción

> Calcula el precio de un pago antes de crearlo. Devuelve una cotización firmada cuando se aplica una promoción, o una vista previa del precio de un código promocional.

> [!WARNING]
>
> **Las promociones se habilitan por organización**
>
> Hasta que Yuno habilite las promociones para tu organización, este endpoint responde `204` (no se aplica nada). Pídelo a tu Technical Account Manager o Key Account Manager. Consulta [Promociones](https://docs.y.uno/es/docs/payment-features/promotions#enable-promotions-for-your-organization).

> [!NOTE]
>
> **¿Usas un enlace de pago o el SDK Web? No llamas a este endpoint**
>
> La página de checkout de un enlace de pago solicita la cotización por sí misma en cuanto identifica la tarjeta a partir de los primeros dígitos que escribe el cliente, y actualiza el precio y el descuento en su resumen de la orden. El SDK Web también la solicita por sí mismo, con tu clave pública, y entrega la cotización a tu página. Llama a este endpoint desde una integración directa por API: desde tu servidor con tu clave secreta, o desde el navegador con tu clave pública. Consulta [Promociones](https://docs.y.uno/es/docs/payment-features/promotions).

## Dos formas de llamarlo

* **Clave secreta, desde tu servidor.** Envía `amount` y `account_id`, y no `checkout_session`. Este es el flujo que se describe a continuación.
* **Clave pública, desde el navegador.** Envía `checkout_session` en lugar de `amount`; el monto proviene de la sesión. Yuno toma la cuenta de la sesión de checkout, por lo que `account_id` es opcional aquí, y un valor que envíes debe coincidir con la cuenta de la sesión. `country` se sigue validando contra esa sesión. La sesión no debe haberse usado aún para pagar, debe tener como máximo 2 horas de antigüedad y debe pertenecer a tu organización.

`payment_method` es obligatorio en ambas. Una cotización es válida durante 30 minutos desde que se emite, en ambas. `code` es opcional en ambas: envíalo para calcular el precio de un código promocional. Consulta [Calcular el precio de un código promocional](#price-a-promotion-code).

```json Secret key (server) theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "account_id": "493e9374-510a-4201-9e09-de669d75f256",
    "amount": { "currency": "USD", "value": 250.00 },
    "country": "AR",
    "payment_method": { "type": "CARD", "bin": "457896", "card_type": "CREDIT" }
}
```

```json Public key (browser) theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "checkout_session": "3f0c2b1e-7d5a-4b1c-9e2f-8a6d4c1b0e77",
    "country": "AR",
    "payment_method": { "type": "CARD", "bin": "457896", "card_type": "CREDIT" }
}
```

## Cómo usar la cotización

1. Envía el contexto del pago que estás a punto de crear. `amount` es el monto original, antes de cualquier promoción. Para una tarjeta, envía dentro de `payment_method` su `bin` (los primeros 6 a 8 dígitos) o un token (`token` o `vaulted_token`), nunca ambos.
2. Con `200`, muestra `charge_amount` a tu cliente. Eso es lo que pagará. La respuesta incluye `quote_id`, `promotions` (una entrada por ahora: `id`, `name`, `description`, `discount`, `discount_amount`), los tres totales fuera de la lista (`original_amount`, `discount_amount`, `charge_amount`) y `expires_at`. El `quote_id` es largo, de unos 300 a 730 caracteres: guárdalo completo (hasta 1000 caracteres) y envíalo sin cambios. Una solicitud que lleva un `code` recibe en su lugar una vista previa, sin `quote_id` ni `expires_at`: consulta [Calcular el precio de un código promocional](#price-a-promotion-code).
3. Crea el pago con el mismo `amount` original y `additional_data.order.discounts: [{ "type": "YUNO_PROMOTION", "quote_id": "<quote_id>" }]`. Consulta [Crear pago](https://docs.y.uno/es/reference/payments/create-payment.md) y [Promociones](https://docs.y.uno/es/docs/payment-features/promotions).

Una promoción se aplica **solo** cuando el pago lleva ese `quote_id` en una línea de descuento. Un pago sin él se cobra completo.

## Reglas

* **Gana el mayor ahorro.** Cuando coinciden dos o más promociones, la cotización es para la que más ahorra al cliente, luego la más antigua, luego el `id` más pequeño. Una promoción por pago; no se acumulan. Un `code` compite en la misma selección.
* **30 minutos.** Una cotización es válida hasta `expires_at`, 30 minutos después de emitirse. Dentro de ese tiempo el pago cobra el precio cotizado, aunque la fecha de fin de la promoción haya pasado después de emitirse la cotización, o hayas deshabilitado la promoción después de emitirse la cotización.
* **Todas las condiciones deben cumplirse ya.** Una cotización existe solo cuando todas las condiciones de la promoción se cumplen para el contexto que envías.
* **Precio cotizado o ningún pago.** Si la cotización venció, o el monto, la moneda o la cuenta del pago difieren de lo que cotizaste, o el pago difiere en un detalle al que la cotización está ligada (el país, el método de pago, el tipo de tarjeta y el BIN de la tarjeta cuando las condiciones de la promoción los usan, y la sesión de checkout cuando la cotización se hizo con una), Yuno rechaza el pago con `422` y uno de los códigos `PROMOTION_*` enumerados en [Promociones](https://docs.y.uno/es/docs/payment-features/promotions#the-customer-pays-the-quoted-price-or-the-payment-is-rejected). Nunca vuelve a calcular el precio. Obtén una cotización nueva y envía el reintento con un `X-Idempotency-Key` nuevo.
* **No se consume nada.** Una cotización es una lectura. Preguntar de nuevo da el mismo precio; `expires_at`, y por tanto el `quote_id`, cambian con el momento en que preguntas, así que no uses el id como clave. Una cotización que nunca usas no requiere limpieza, y una cotización puede respaldar varios pagos.
* **Que no haya coincidencia no es un error.** La respuesta es `204` cuando no se aplica nada. Crea el pago como de costumbre, sin `quote_id` en una línea de descuento. Un `204` también significa que las promociones no están habilitadas para tu organización o Yuno las deshabilitó temporalmente, que Yuno no pudo calcular el precio del pago a tiempo, o que una promoción automática dejaría el cobro en cero (una promoción nunca deja un cobro en cero; para un código, consulta [Calcular el precio de un código promocional](#price-a-promotion-code)). Si la solicitud misma falla (`408`, `5xx`, sin respuesta), crea el pago como de costumbre también: una cotización nunca bloquea un pago.
* **BIN o token, nunca ambos, dentro de `payment_method`.** Un servidor que tiene el número de tarjeta envía `payment_method.bin`, los primeros 6 a 8 dígitos. Un servidor que tiene un token envía `payment_method.token` o `payment_method.vaulted_token`, y Yuno resuelve el BIN y el tipo de tarjeta a partir de la tarjeta, exactamente como lo hace en el pago. Cualquier combinación de dos entre `bin`, `token` y `vaulted_token` se rechaza con `400 INVALID_PARAMETERS`, así que no copies el `payment_method` de una solicitud de Crear pago que lleva ambos tokens. Una promoción con una condición `bins` necesita el BIN, y una con una condición `card_types` necesita el `card_type` (no el BIN); sin ellos no se aplica. Las billeteras (Apple Pay, Google Pay) no son un destino compatible en esta versión: no construyas aún sobre una cotización de billetera.
* **Envía el BIN, nunca el número de tarjeta.** `payment_method.bin` son los primeros 6 a 8 dígitos de la tarjeta, solo dígitos. Menos de 6 dígitos, más de 8 (un prefijo de tarjeta más largo o el número completo de la tarjeta incluido), o cualquier cosa que no sean dígitos se rechaza con `400 INVALID_PARAMETERS`.

## Calcular el precio de un código promocional

Una promoción que requiere un código se aplica solo cuando el pago lleva ese código. Para mostrar el descuento antes de que el cliente pague, envía el código en `code` junto con el resto del contexto:

```json Code (server) theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "account_id": "493e9374-510a-4201-9e09-de669d75f256",
    "amount": { "currency": "USD", "value": 250.00 },
    "country": "US",
    "payment_method": { "type": "CARD" },
    "code": "SUMMER10"
}
```

Este endpoint no envía una clave de idempotencia, así que la respuesta es una **vista previa**: los mismos montos que una cotización, sin `quote_id` ni `expires_at`.

```json Preview (200) theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "promotions": [
        {
            "id": "00000000-0000-4000-8000-0000000000b1",
            "name": "Summer 10",
            "description": null,
            "discount": { "type": "PERCENTAGE", "value": 10 },
            "discount_amount": { "currency": "USD", "value": 25.00 }
        }
    ],
    "original_amount": { "currency": "USD", "value": 250.00 },
    "discount_amount": { "currency": "USD", "value": 25.00 },
    "charge_amount": { "currency": "USD", "value": 225.00 }
}
```

* **Una vista previa muestra el precio y nada más.** Muestra `charge_amount` a tu cliente. Yuno no firma, almacena ni cuenta nada. Una vista previa no se puede pagar: no hay `quote_id` que poner en una línea de descuento. El pago lleva el código mismo, `additional_data.order.discounts: [{ "code": "SUMMER10" }]`. Consulta [Códigos promocionales](https://docs.y.uno/es/docs/payment-features/promotion-codes#send-the-code-on-the-payment).
* **El código tiene de 3 a 32 caracteres:** letras, dígitos, `_` y `-`. Yuno lo compara sin distinguir mayúsculas de minúsculas. Un código con otro carácter u otra longitud no encuentra ninguna promoción y responde `404 PROMOTION_NOT_FOUND`.
* **`payment_method.type` sigue siendo obligatorio** en este endpoint, igual que sin un código.
* **La vista previa no cuenta ningún uso del código.** Yuno cuenta un uso cuando un pago lleva el código. Consulta [Códigos promocionales](https://docs.y.uno/es/docs/payment-features/promotion-codes#uses-and-limits).
* **Un código que no se aplica se rechaza, no se muestra en vista previa.** Responde `404` o `422`, no `204`. La respuesta es `404 PROMOTION_NOT_FOUND` cuando ninguna promoción de la cuenta tiene el código o la promoción que lo tiene no ha comenzado, y `422 PROMOTION_NOT_APPLICABLE` con un `reason` cuando la tiene y no se aplica: `EXPIRED`, `DISABLED`, `USAGE_LIMIT_REACHED`, `CONDITIONS_NOT_MET`, `CURRENCY_MISMATCH`, `ZERO_DISCOUNT` o `ZERO_CHARGE`. [Códigos de error de promociones](https://docs.y.uno/es/reference/promotions/promotion-error-codes) tiene el mensaje de cada uno.
* **Un código que deja un cobro en cero responde `ZERO_CHARGE`.** Cuando el código gana y el cobro sería cero o menos (un descuento del 100 %, o un descuento fijo igual o superior al monto), la respuesta es `422 PROMOTION_NOT_APPLICABLE` con el motivo `ZERO_CHARGE`, como en un pago. El motivo va antes que `USAGE_LIMIT_REACHED`.
* **La vista previa puede ser de otra promoción.** Cuando una promoción automática ahorra más al cliente que el código, la vista previa es de esa promoción, y `promotions[0].id` es su id. Una promoción automática que dejaría un cobro en cero responde `204`.
* **Una solicitud sin `code` no cambia.** Recibe una cotización firmada, con `quote_id` y `expires_at`. Un pago que lleva un código se cotiza con su `X-Idempotency-Key`, y esa cotización se firma y cuenta un uso. Consulta [Códigos promocionales](https://docs.y.uno/es/docs/payment-features/promotion-codes#uses-and-limits).

```json Code that leaves a charge of zero (422) theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "code": "PROMOTION_NOT_APPLICABLE",
    "messages": ["The promotion leaves a charge of zero on this amount."],
    "reason": "ZERO_CHARGE"
}
```

## Respuestas

| Estado | Significado |
| - | - |
| `200` | Se aplica una promoción: la cotización. Una solicitud con un `code` recibe una vista previa, sin `quote_id` ni `expires_at`. |
| `204` | No se aplica nada (una solicitud con un `code` recibe un `404` o un `422` en su lugar), las promociones no están habilitadas para tu organización o Yuno las deshabilitó temporalmente, Yuno no pudo calcular el precio del pago a tiempo, o una promoción automática dejaría el cobro en cero. Sin cuerpo. |
| `400` | La solicitud no es válida (`INVALID_PARAMETERS`, `INVALID_ACCOUNT_ID`, `CHECKOUT_SESSION_NOT_EXISTS` o `BAD_REQUEST`, con el motivo en `messages[]`), o la sesión de checkout ya se usó o venció. |
| `401` | Las credenciales faltan o no son válidas. |
| `404` | `PROMOTION_NOT_FOUND`: la solicitud lleva un `code`, y ninguna promoción de la cuenta lo tiene, o la promoción que lo tiene no ha comenzado, o el código tiene un carácter fuera de `A-Z`, `0-9`, `_` y `-` o una longitud fuera de 3 a 32. |
| `422` | `PROMOTION_NOT_APPLICABLE`: la solicitud lleva un `code` que una promoción tiene y que no se aplica. El `reason` es `EXPIRED`, `DISABLED`, `USAGE_LIMIT_REACHED`, `CONDITIONS_NOT_MET`, `CURRENCY_MISMATCH`, `ZERO_DISCOUNT` o `ZERO_CHARGE`. |
| `408` | Yuno tardó demasiado en responder. Trátalo como un `204`. |
| `413` | El cuerpo es mayor que 16 KiB. |


## OpenAPI

````yaml openapi/promotions/create-promotion-quote.json POST /promotions/quote
openapi: 3.1.0
info:
  title: promotions
  version: 1.0.0
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
  - sec0: []
paths:
  /promotions/quote:
    post:
      summary: Create Promotion Quote
      description: >-
        Prices a payment before you create it. Returns a signed quote when a
        promotion applies, or `204` when nothing applies. Nothing is consumed:
        asking again gives the same price, with an `expires_at` (and so a
        `quote_id`) that moves with the time you ask, and one quote can back
        several payments. A quote lives 30 minutes after it is issued, on both
        credentials. A request that carries a `code` gets a preview instead: the
        same amounts, with no `quote_id` and no `expires_at`. Nothing is signed,
        stored or counted, and the code is applied when the payment carries it.
        Every condition of the promotion must already be true for a quote to
        exist. Promotions must be enabled for your organization by Yuno before
        you can use this endpoint. See
        [Promotions](/docs/payment-features/promotions#enable-promotions-for-your-organization).
      operationId: create-promotion-quote
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - country
                - payment_method
              oneOf:
                - required:
                    - amount
                    - account_id
                - required:
                    - checkout_session
              properties:
                account_id:
                  type: string
                  description: >-
                    The account that will create the payment (UUID). Required
                    with the secret key. With the public key and
                    `checkout_session`, it's optional: Yuno takes the account
                    from the checkout session, and a value you send must match
                    it.
                amount:
                  type: object
                  required:
                    - currency
                    - value
                  properties:
                    currency:
                      type: string
                      description: MAX 3; MIN 3; [ISO 4217](/reference/country-reference).
                    value:
                      type: number
                      format: float
                      description: >-
                        The amount in major units (for example 250.00), with no
                        more decimals than the currency has: two for USD, none
                        for JPY. A value with more decimals gets `204`; a
                        zero-decimal currency with decimals is rejected with
                        `400`.
                  description: >-
                    The original amount of the payment, before any promotion. It
                    must be the same `amount` you later send on the payment.
                    Secret key only: send this, not `checkout_session`.
                checkout_session:
                  type: string
                  description: >-
                    Checkout session id (UUID v4). Use it with the public key
                    instead of `amount`; the amount comes from the session. The
                    session must not have been used to pay yet, be at most 2
                    hours old, and belong to your organization. Never send it
                    with the secret key.
                country:
                  type: string
                  description: >-
                    The country of the payment (MAX 2; MIN 2; [ISO
                    3166-1](/reference/country-reference)).
                payment_method:
                  type: object
                  required:
                    - type
                  description: >-
                    The payment method of the payment you are about to create.
                    For a card, identify it in ONE of three ways: send `bin`, or
                    `token`, or `vaulted_token`. Any two of them together are
                    rejected with `400 INVALID_PARAMETERS`.
                  properties:
                    type:
                      type: string
                      description: >-
                        The payment method type the customer chose, for example
                        `CARD`. See [Payment type
                        list](/reference/payment-type-list).
                    token:
                      type: string
                      description: >-
                        Cards only. The one-time token of the card from the Yuno
                        SDK. Yuno resolves the BIN and the card type from it, so
                        you send no `bin`. Never together with `bin` or
                        `vaulted_token`.
                    vaulted_token:
                      type: string
                      description: >-
                        Cards only. The vaulted token of a saved card. Yuno
                        resolves the BIN and the card type from it, so you send
                        no `bin`. Never together with `bin` or `token`.
                    bin:
                      type: string
                      description: >-
                        Cards only. The BIN: the first 6 to 8 digits of the
                        card, digits only. Fewer than 6 digits, more than 8 (a
                        longer card prefix or the full card number included), or
                        anything but digits is rejected with `400
                        INVALID_PARAMETERS`. Never send the full card number.
                        Send `bin` when your server holds the card number; send
                        a token when it holds a token; never both. Needed for
                        promotions with a `bins` condition (values or ranges)
                        when you send no token. A 6-digit BIN matches only
                        conditions that cover its whole 6-digit block, so send 8
                        digits when a promotion lists 8-digit prefixes or
                        narrower ranges.
                    card_type:
                      type: string
                      description: >-
                        Cards only. The card type, for example `CREDIT` or
                        `DEBIT`; it isn't case-sensitive. Send it with `bin`
                        when you know it; needed for promotions with a
                        `card_types` condition. With a token you can leave it
                        out: Yuno resolves it from the card. A card type that
                        the promotion's condition doesn't list gets `204`.
                code:
                  type: string
                  description: >-
                    Optional. A promotion code to price: 3 to 32 characters,
                    `A-Z`, `0-9`, `_` and `-`, in any case. A code with another
                    character or another length finds no promotion. This
                    endpoint sends no idempotency key, so a request with a
                    `code` gets a preview: the same amounts as a quote, with no
                    `quote_id` and no `expires_at`. Yuno signs, stores and
                    counts nothing: the code is applied when the payment carries
                    it, and a preview can't be sent on a payment. When an
                    automatic promotion saves the customer more than the code,
                    the preview is for that promotion. A code that doesn't apply
                    answers `404` or `422`, not `204`, and a code that leaves a
                    charge of zero answers `422` with the reason `ZERO_CHARGE`.
                    See [Promotion
                    codes](/docs/payment-features/promotion-codes).
            examples:
              Card payment with the BIN:
                value:
                  account_id: 493e9374-510a-4201-9e09-de669d75f256
                  amount:
                    currency: USD
                    value: 250
                  country: AR
                  payment_method:
                    type: CARD
                    bin: '457896'
                    card_type: CREDIT
              Public key with checkout session:
                value:
                  checkout_session: 3f0c2b1e-7d5a-4b1c-9e2f-8a6d4c1b0e77
                  country: AR
                  payment_method:
                    type: CARD
                    bin: '457896'
                    card_type: CREDIT
              Card payment with a vaulted token:
                value:
                  account_id: 493e9374-510a-4201-9e09-de669d75f256
                  amount:
                    currency: USD
                    value: 250
                  country: AR
                  payment_method:
                    type: CARD
                    vaulted_token: 330953e7-09d8-47cf-a99c-cfb7968f13f9
              Price a promotion code:
                value:
                  account_id: 493e9374-510a-4201-9e09-de669d75f256
                  amount:
                    currency: USD
                    value: 250
                  country: US
                  payment_method:
                    type: CARD
                  code: SUMMER10
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                A promotion applies:
                  summary: A promotion applies
                  value:
                    quote_id: qte_eyJ2IjoxLCJrIjoi…
                    promotions:
                      - id: b7c1a4f2-6e0d-4a3b-9c55-1f2e7d8a0b31
                        name: 10% off with credit cards - Mother's Day
                        description: 10% off with your credit card.
                        discount:
                          type: PERCENTAGE
                          value: 10
                        discount_amount:
                          currency: USD
                          value: 25
                    original_amount:
                      currency: USD
                      value: 250
                    discount_amount:
                      currency: USD
                      value: 25
                    charge_amount:
                      currency: USD
                      value: 225
                    expires_at: '2026-10-04T18:41:02Z'
                A promotion code (preview):
                  summary: A promotion code (preview)
                  value:
                    promotions:
                      - id: 00000000-0000-4000-8000-0000000000b1
                        name: Summer 10
                        description: null
                        discount:
                          type: PERCENTAGE
                          value: 10
                        discount_amount:
                          currency: USD
                          value: 25
                    original_amount:
                      currency: USD
                      value: 250
                    discount_amount:
                      currency: USD
                      value: 25
                    charge_amount:
                      currency: USD
                      value: 225
              schema:
                type: object
                required:
                  - promotions
                  - original_amount
                  - discount_amount
                  - charge_amount
                properties:
                  quote_id:
                    type: string
                    description: >-
                      Opaque and long: about 300 to 730 characters. Store it
                      whole, up to 1000 characters, and send it unchanged on the
                      payment as `quote_id` on an
                      `additional_data.order.discounts` line with `type:
                      YUNO_PROMOTION`. Never parse or shorten it. Absent when
                      the request carries a `code`: that answer is a preview,
                      and a preview can't be paid.
                  promotions:
                    type: array
                    minItems: 1
                    description: >-
                      The promotions that apply. One entry in this release; a
                      later release may return more than one. The outer
                      `discount_amount` is the sum of each entry's
                      `discount_amount`.
                    items:
                      type: object
                      required:
                        - id
                        - name
                        - description
                        - discount
                        - discount_amount
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        description:
                          type:
                            - string
                            - 'null'
                          description: >-
                            The promotion description. Always present; `null`
                            when the promotion has none.
                        discount:
                          type: object
                          description: >-
                            The promotion's discount: `type` and `value`.
                            `PERCENTAGE`: `value` is the percentage. `FIXED`:
                            `value` is the fixed amount in the currency of the
                            payment, before it is capped at the payment amount.
                          required:
                            - type
                            - value
                          properties:
                            type:
                              type: string
                              enum:
                                - PERCENTAGE
                                - FIXED
                            value:
                              type: number
                        discount_amount:
                          type: object
                          description: What this promotion saves on the quoted payment.
                          properties:
                            currency:
                              type: string
                            value:
                              type: number
                              format: float
                  original_amount:
                    type: object
                    description: The amount you sent, before the discount.
                    properties:
                      currency:
                        type: string
                      value:
                        type: number
                        format: float
                  discount_amount:
                    type: object
                    description: >-
                      Total discount (sum of `promotions[].discount_amount`).
                      Always positive.
                    properties:
                      currency:
                        type: string
                      value:
                        type: number
                        format: float
                  charge_amount:
                    type: object
                    description: 'What the customer pays: original minus discount.'
                    properties:
                      currency:
                        type: string
                      value:
                        type: number
                        format: float
                  expires_at:
                    type: string
                    format: date-time
                    description: >-
                      The quote is valid until this instant: 30 minutes after it
                      was issued. Absent from a preview (a request that carries
                      a `code`).
        '204':
          description: >-
            No promotion applies to this payment context (a request with a
            `code` gets a `404` or a `422` instead), Promotions is not enabled
            for your organization or is temporarily disabled by Yuno, Yuno could
            not price the payment in time, or an automatic promotion would make
            the charge zero. There is no body. Create the payment as usual, with
            no `quote_id` on a discount line.
        '400':
          description: '400'
          content:
            application/json:
              examples:
                BIN not 6 to 8 digits:
                  summary: BIN not 6 to 8 digits
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - >-
                        The field 'payment_method.bin' must contain 6 to 8
                        digits.
                BIN and token together:
                  summary: BIN and token together
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - >-
                        The fields 'payment_method.bin' and
                        'payment_method.token' cannot be sent together.
                Token and vaulted token together:
                  summary: Token and vaulted token together
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - >-
                        The fields 'payment_method.token' and
                        'payment_method.vaulted_token' cannot be sent together.
                amount sent with a public key:
                  summary: amount sent with a public key
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - >-
                        The field 'amount' is not allowed when using the public
                        API key.
                checkout_session sent with a secret key:
                  summary: checkout_session sent with a secret key
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - >-
                        The field 'checkout_session' is not allowed when using
                        the secret key.
                account_id doesn't match the session:
                  summary: account_id doesn't match the session
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - The field 'account_id' must match the checkout session.
                country doesn't match the session:
                  summary: country doesn't match the session
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - The field 'country' must match the checkout session.
                Checkout session already used:
                  summary: Checkout session already used
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - The checkout session has already been used.
                Checkout session expired:
                  summary: Checkout session expired
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - The checkout session has expired.
                account_id is not valid:
                  summary: account_id is not valid
                  value:
                    code: INVALID_ACCOUNT_ID
                    messages:
                      - Account id is invalid
                Field with the wrong data type:
                  summary: Field with the wrong data type
                  value:
                    code: BAD_REQUEST
                    messages:
                      - The field 'payment_method.bin' wrong data type.
                Body is not valid JSON:
                  summary: Body is not valid JSON
                  value:
                    code: BAD_REQUEST
                    messages:
                      - Bad request
                Checkout session not found:
                  summary: Checkout session not found
                  value:
                    code: CHECKOUT_SESSION_NOT_EXISTS
                    messages:
                      - >-
                        session with code 3f0c2b1e-7d5a-4b1c-9e2f-8a6d4c1b0e77
                        not found
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_PARAMETERS
                  messages:
                    type: array
                    items:
                      type: string
        '401':
          description: '401'
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    code: INVALID_CREDENTIALS
                    messages:
                      - Invalid Credentials
                Not authenticated:
                  value:
                    code: NOT_AUTHENTICATED
                    messages:
                      - Not authenticated
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_CREDENTIALS
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid Credentials
        '404':
          description: >-
            404. The request carries a `code`, and no promotion of the account
            holds it, or the promotion holding it has not started, or the code
            has a character outside `A-Z`, `0-9`, `_` and `-` or a length
            outside 3 to 32.
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: PROMOTION_NOT_FOUND
                    messages:
                      - The promotion does not exist on the account.
                  summary: Result
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: PROMOTION_NOT_FOUND
                  messages:
                    type: array
                    items:
                      type: string
        '408':
          description: >-
            408. Yuno took too long to answer. Treat it like a `204`: create the
            payment without a promotion.
          content:
            application/json:
              examples:
                Request timeout:
                  value:
                    code: REQUEST_TIMEOUT
                    messages:
                      - Request Timeout
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: REQUEST_TIMEOUT
                  messages:
                    type: array
                    items:
                      type: string
        '413':
          description: 413. The body is larger than 16 KiB.
          content:
            application/json:
              examples:
                Request too large:
                  value:
                    code: REQUEST_ENTITY_TOO_LARGE
                    messages:
                      - Request entity too large
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: REQUEST_ENTITY_TOO_LARGE
                  messages:
                    type: array
                    items:
                      type: string
        '422':
          description: >-
            422. The request carries a `code` that a promotion of the account
            holds, and the code doesn't apply. The `reason` says why: `EXPIRED`,
            `DISABLED`, `USAGE_LIMIT_REACHED`, `CONDITIONS_NOT_MET`,
            `CURRENCY_MISMATCH`, `ZERO_DISCOUNT` or `ZERO_CHARGE`.
          content:
            application/json:
              examples:
                Code that reached its limit:
                  summary: Code that reached its limit
                  value:
                    code: PROMOTION_NOT_APPLICABLE
                    messages:
                      - The promotion reached its limit of uses.
                    reason: USAGE_LIMIT_REACHED
                Code outside the conditions:
                  summary: Code outside the conditions
                  value:
                    code: PROMOTION_NOT_APPLICABLE
                    messages:
                      - >-
                        The payment does not meet the conditions of the
                        promotion.
                    reason: CONDITIONS_NOT_MET
                Code that expired:
                  summary: Code that expired
                  value:
                    code: PROMOTION_NOT_APPLICABLE
                    messages:
                      - The promotion expired.
                    reason: EXPIRED
                Code that leaves a charge of zero:
                  summary: Code that leaves a charge of zero
                  value:
                    code: PROMOTION_NOT_APPLICABLE
                    messages:
                      - The promotion leaves a charge of zero on this amount.
                    reason: ZERO_CHARGE
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: PROMOTION_NOT_APPLICABLE
                  messages:
                    type: array
                    items:
                      type: string
                  reason:
                    type: string
                    enum:
                      - EXPIRED
                      - DISABLED
                      - USAGE_LIMIT_REACHED
                      - CONDITIONS_NOT_MET
                      - CURRENCY_MISMATCH
                      - ZERO_DISCOUNT
                      - ZERO_CHARGE
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: public-api-key
      x-default: <Your public-api-key>
    sec1:
      type: apiKey
      in: header
      name: private-secret-key
      x-default: <Your private-secret-key>

````

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