> ## Documentation Index
> Fetch the complete documentation index at: https://yuno-3979e326-docs-agent-readable-descriptions.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Checkout Session

> Create a checkout session for a customer and optionally attach additional_data.

This request creates a checkout session using the unique identifier generated when the `customer` resource was created.

<Note>
  If your workflow requires sending the `additional_data` object, it can be sent as part of the checkout session.
</Note>


## OpenAPI

````yaml /openapi/checkout-sessions/create-checkout-session.json POST /checkout/sessions
openapi: 3.1.0
info:
  title: checkout-api
  version: 1.0.2
servers:
  - url: https://api-sandbox.y.uno/v1
security:
  - sec0: []
    sec1: []
paths:
  /checkout/sessions:
    post:
      summary: Create Checkout Session
      operationId: create-checkout-session
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - merchant_order_id
                - payment_description
                - country
                - account_id
              properties:
                customer_id:
                  type: string
                  description: >-
                    The unique identifier of the customer, created using the
                    [Create
                    Customer](https://docs.y.uno/reference/create-customer)
                    endpoint (UUID, 36 chars).
                merchant_order_id:
                  type: string
                  description: >-
                    The unique identifier of the customer's order (MAX 255; MIN
                    3).
                payment_description:
                  type: string
                  description: The description of the payment (MAX 255; MIN 3).
                callback_url:
                  type: string
                  description: >-
                    The URL where we will redirect your customer after making
                    the purchase. Required for alternative payment methods with
                    redirection. (MAX 526; MIN 3)
                country:
                  type: string
                  description: >-
                    The customer's country (MAX 2; MIN 2; [ISO
                    3166-1](country-reference)).
                  enum:
                    - AR
                    - BO
                    - BR
                    - CL
                    - CO
                    - CR
                    - EC
                    - SV
                    - GT
                    - HN
                    - MX
                    - NI
                    - PA
                    - PY
                    - PE
                    - US
                    - UY
                account_id:
                  type: string
                  description: >-
                    The unique identifier of the account. You find this
                    information on [the Yuno
                    dashboard](https://dashboard.y.uno/) (UUID, 36 chars).
                amount:
                  type: object
                  description: >-
                    Specifies the payment amount object, with the value and
                    currency.
                  required:
                    - currency
                    - value
                  properties:
                    currency:
                      type: string
                      description: >-
                        The currency used to make the payment. For a full list
                        of currency codes, see [Country
                        reference](/reference/country-reference) (MAX 3; MIN 3;
                        ISO 4217).
                    value:
                      type: number
                      description: The payment amount (multiple of 0.0001).
                      format: float
                alternative_amount:
                  type: object
                  description: >-
                    Alternative currency representation of the transaction
                    amount.
                  required:
                    - currency
                    - value
                  properties:
                    currency:
                      type: string
                      description: >-
                        The alternative currency code. For a full list of
                        currency codes, see [Country
                        reference](/reference/country-reference) (MAX 3; MIN 3;
                        ISO 4217).
                      nullable: true
                    value:
                      type: number
                      description: The alternative amount value (multiple of 0.0001).
                      format: float
                metadata:
                  type: array
                  description: >-
                    Specifies a list of metadata objects. You can add up to 120
                    metadata objects.
                  items:
                    properties:
                      key:
                        type: string
                        description: The metadata key (MAX 48)
                      value:
                        type: string
                        description: The metadata key value (MAX 512)
                    required:
                      - key
                      - value
                    type: object
                workflow:
                  type: string
                  description: Checkout workflow type.
                  enum:
                    - SDK_CHECKOUT
                    - CHECKOUT
                    - SDK_SEAMLESS
                installments:
                  type: object
                  description: >-
                    The object to send the installment plan created in Yuno to
                    show your customers and let them choose from. This optional
                    field is used in case a particular installments plan needs
                    to be used in the session. if not sent, we will display the
                    installment plan created for the account for each scenario,
                    if any.
                  properties:
                    plan_id:
                      type: string
                      description: Plan Id of the installment plan created in Yuno
                    plan:
                      type: array
                      description: >-
                        Installments to show the customer in with the
                        checkout_session. This optional struct is used in case a
                        particular installments plan needs to be used in the
                        session and does not have an installments plan created
                        for it. if not sent, we will display the installment
                        plan created for the account for each scenario, if any.
                      items:
                        properties:
                          installment:
                            type: integer
                            description: >-
                              The number of monthly installments shoppers can
                              choose
                            format: int32
                          rate:
                            type: number
                            description: >-
                              The rate that will be applied to the final amount
                              of the transaction by the payment provider after
                              using installments. Expressed in percentage.
                            format: float
                        required:
                          - installment
                          - rate
                        type: object
                recurring_payment:
                  type: object
                  description: >-
                    Optional object to enable and configure recurring payments
                    (subscriptions).
                  properties:
                    description:
                      type: string
                      description: Description of the subscription plan.
                    management_url:
                      type: string
                      description: URL where the user can manage their subscription.
                    billing_agreement:
                      type: string
                      description: Billing agreement identifier.
                    regular_billing:
                      type: object
                      description: Configuration for the recurring billing cycle.
                      required:
                        - label
                        - amount
                        - interval_unit
                        - interval_count
                      properties:
                        label:
                          type: string
                          description: >-
                            Descriptive label for the billing cycle (e.g.
                            "Monthly").
                        amount:
                          type: string
                          description: Billing amount (e.g. "9.99").
                        interval_unit:
                          type: string
                          description: Unit of the billing interval.
                          enum:
                            - year
                            - month
                            - day
                            - hour
                            - minute
                        interval_count:
                          type: integer
                          description: Number of units between each billing cycle.
                    trial_billing:
                      type: object
                      description: (Optional) Trial period configuration.
                      required:
                        - label
                        - amount
                        - interval_unit
                        - interval_count
                      properties:
                        label:
                          type: string
                          description: >-
                            Descriptive label for the trial billing cycle (e.g.
                            "Free trial").
                        amount:
                          type: string
                          description: Billing amount for trial (e.g. "0.00").
                        interval_unit:
                          type: string
                          description: Unit of the trial billing interval.
                          enum:
                            - year
                            - month
                            - day
                            - hour
                            - minute
                        interval_count:
                          type: integer
                          description: Number of units for the trial period.
            examples:
              Checkout Session (full data):
                value:
                  account_id: '{{account_id}}'
                  merchant_order_id: '1717681150'
                  payment_description: Test Cards
                  country: CO
                  customer_id: '{{customer_id}}'
                  callback_url: https://www.example.com
                  amount:
                    currency: COP
                    value: 8000
                  alternative_amount:
                    currency: USD
                    value: 2
                  metadata:
                    - key: ID
                      value: '123456'
                  recurring_payment:
                    description: Monthly subscription
                    management_url: https://example.com/manage
                    billing_agreement: BA-123
                    regular_billing:
                      label: Monthly
                      amount: '9.99'
                      interval_unit: month
                      interval_count: 1
                    trial_billing:
                      label: Free trial
                      amount: '0.00'
                      interval_unit: month
                      interval_count: 1
              Checkout Session (min data):
                value:
                  country: US
                  amount:
                    currency: USD
                    value: 100
                  alternative_amount:
                    currency: ARS
                    value: '140000'
                  account_id: '{{account_id}}'
                  merchant_order_id: '1717681150'
                  payment_description: Test Cards
                  customer_id: '{{customer_id}}'
              Checkout Session (alternative currency omitted):
                value:
                  account_id: '{{account_id}}'
                  merchant_order_id: '1717681150'
                  payment_description: Test Cards
                  country: CO
                  customer_id: '{{customer_id}}'
                  amount:
                    currency: COP
                    value: 8000
                summary: Checkout Session (alternative currency omitted)
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Checkout Session (min. data):
                  value:
                    merchant_order_id: '1717681150'
                    checkout_session: d313047b-4f96-44ef-bbad-caf1d7ba4c2b
                    country: US
                    payment_description: Test Cards
                    customer_id: a577ad8f-08f1-4590-9cf1-e7679b15ee84
                    callback_url: https://www.example.com/callback
                    amount:
                      currency: USD
                      value: 520
                    created_at: '2024-06-06T13:39:10.932297Z'
                    metadata: null
                    workflow: SDK_CHECKOUT
                    installments:
                      plan_id: null
                      plan: null
                Checkout Session (full data):
                  value:
                    merchant_order_id: '1717681150'
                    checkout_session: c437f4cc-7d66-40e6-a8df-7c3cde1ddca7
                    country: US
                    payment_description: Test Cards
                    customer_id: 55006822-7c79-490b-bea1-81798b9afc74
                    callback_url: >-
                      https://www.example.com/?checkoutSession=c437f4cc-7d66-40e6-a8df-7c3cde1ddca7
                    amount:
                      currency: USD
                      value: 520
                    created_at: '2023-07-20T17:06:17.232130Z'
                    metadata:
                      - key: ID
                        value: '123456'
                    workflow: SDK_CHECKOUT
                    installments:
                      plan_id: null
                      plan: null
              schema:
                oneOf:
                  - title: Checkout Session (min. data)
                    type: object
                    properties:
                      merchant_order_id:
                        type: string
                        example: '1717681150'
                      checkout_session:
                        type: string
                        example: d313047b-4f96-44ef-bbad-caf1d7ba4c2b
                      country:
                        type: string
                        example: US
                      payment_description:
                        type: string
                        example: Test Cards
                      customer_id:
                        type: string
                        example: a577ad8f-08f1-4590-9cf1-e7679b15ee84
                      callback_url:
                        type: string
                        example: https://www.example.com/callback
                      amount:
                        type: object
                        properties:
                          currency:
                            type: string
                            example: USD
                          value:
                            type: integer
                            example: 520
                            default: 0
                      created_at:
                        type: string
                        example: '2024-06-06T13:39:10.932297Z'
                      metadata: {}
                      workflow:
                        type: string
                        example: SDK_CHECKOUT
                      installments:
                        type: object
                        properties:
                          plan_id: {}
                          plan: {}
                  - title: Checkout Session (full data)
                    type: object
                    properties:
                      merchant_order_id:
                        type: string
                        example: '1717681150'
                      checkout_session:
                        type: string
                        example: c437f4cc-7d66-40e6-a8df-7c3cde1ddca7
                      country:
                        type: string
                        example: US
                      payment_description:
                        type: string
                        example: Test Cards
                      customer_id:
                        type: string
                        example: 55006822-7c79-490b-bea1-81798b9afc74
                      callback_url:
                        type: string
                        example: >-
                          https://www.example.com/?checkoutSession=c437f4cc-7d66-40e6-a8df-7c3cde1ddca7
                      amount:
                        type: object
                        properties:
                          currency:
                            type: string
                            example: USD
                          value:
                            type: integer
                            example: 520
                            default: 0
                      created_at:
                        type: string
                        example: '2023-07-20T17:06:17.232130Z'
                      metadata:
                        type: array
                        items:
                          type: object
                          properties:
                            key:
                              type: string
                              example: ID
                            value:
                              type: string
                              example: '123456'
                      workflow:
                        type: string
                        example: SDK_CHECKOUT
                      installments:
                        type: object
                        properties:
                          plan_id: {}
                          plan: {}
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Bad Request:
                  value:
                    code: INVALID_REQUEST
                    messages:
                      - Invalid request
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_REQUEST
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid request
        '401':
          description: '401'
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    code: INVALID_CREDENTIALS
                    messages:
                      - Invalid credentials
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_CREDENTIALS
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid credentials
        '403':
          description: '403'
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    code: AUTHORIZATION_REQUIRED
                    messages:
                      - The merchant has no authorization to use this API.
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: AUTHORIZATION_REQUIRED
                  messages:
                    type: array
                    items:
                      type: string
                      example: The merchant has no authorization to use this API.
      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>

````