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

# Create a checkout session

> Creates a session for the hosted page, the overlay or the inline form. Amounts come from this call only. `return_url`s must be on a website you allowed. Honours `Idempotency-Key`: the same key and body returns the same session with `200`, and a different body with the same key is `409` `idempotency_mismatch`.



## OpenAPI

````yaml /openapi.yaml post /v1/checkout/sessions
openapi: 3.2.0
info:
  title: Easner API
  version: '1'
  summary: Banking, Checkout, Connect and platform routes on the Easner v1 API.
  description: >
    Every route and method under `/v1`. The paths, scopes and fields are taken
    from the route handlers and their

    validators. Amounts are integers in the smallest currency unit (cents).
    Every list uses one cursor shape:

    `limit`, `starting_after`, `ending_before`, and `created[gte]` /
    `created[lte]` where the endpoint is dated.


    Authenticate with a secret key (`easner_sk_test_…` or `easner_sk_live_…`) as
    a bearer token. One key works for

    Banking, Checkout and Connect; scopes decide what each key can call. See
    [Authentication](/authentication) and

    [API keys and scopes](/api-keys). Webhook payloads are described under
    `webhooks`.
  termsOfService: https://www.easner.com
  contact:
    name: Easner support
    url: https://www.easner.com
servers:
  - url: https://api.easner.com
    description: Production (live and test, chosen by the key)
security:
  - bearerAuth: []
tags:
  - name: Customers
    description: Banking customers (`cus_`). Create, list, retrieve and start verification.
  - name: Accounts
    description: Banking accounts (`acct_`), deposit details and card onramp sessions.
  - name: Payment methods
    description: The catalogue of ways to send and receive money.
  - name: Destinations
    description: Where money is sent (`dest_`).
  - name: Quotes
    description: Priced quotes for a send (`qt_`).
  - name: Transfers
    description: Sends of money (`tr_`), with customer authorization.
  - name: Transactions
    description: The ledger of banking movements (`txn_`).
  - name: Checkout sessions
    description: Hosted, overlay and inline checkout sessions (`cs_`).
  - name: Payments
    description: Settled checkout payments.
  - name: Refunds
    description: Refunds of checkout payments (`re_`).
  - name: Subscriptions
    description: Recurring checkout subscriptions (`sub_`).
  - name: Checkout customers
    description: Checkout customers (UUID ids). Not the banking customers above.
  - name: Customer portal
    description: Signed links to the customer portal.
  - name: Products
    description: Products for checkout and payment links.
  - name: Prices
    description: 'Prices on products. A price is immutable: only `active` changes.'
  - name: Promotion codes
    description: >-
      Codes customers type at checkout. A code is immutable: only `active`
      changes.
  - name: Discounts
    description: A discount granted to one email. It applies when that email checks out.
  - name: Publishable keys
    description: Browser check for a publishable key. Not for your server.
  - name: Connect
    description: >-
      Payees (`pye_`), credits, payouts and the ledger. Pay the people on your
      platform into their own Easner accounts.
  - name: API keys
    description: Keys of this mode. Creating a key stays in Console.
  - name: Webhook endpoints
    description: Where Easner sends events. The signing secret is shown once, on create.
  - name: Webhooks
    description: >-
      Events Easner sends to your endpoints. Each is a POST with an
      `easner-signature` header.
paths:
  /v1/checkout/sessions:
    post:
      tags:
        - Checkout sessions
      summary: Create a checkout session
      description: >-
        Creates a session for the hosted page, the overlay or the inline form.
        Amounts come from this call only. `return_url`s must be on a website you
        allowed. Honours `Idempotency-Key`: the same key and body returns the
        same session with `200`, and a different body with the same key is `409`
        `idempotency_mismatch`.
      operationId: createCheckoutSession
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCheckoutSessionBody'
      responses:
        '200':
          description: The session stored by an earlier call with the same Idempotency-Key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSessionCreated'
        '201':
          description: The session. A replay with the same key answers `200`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSessionCreated'
        default:
          $ref: '#/components/responses/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Up to 255 characters. Keys are scoped to your business and mode. Longer
        is `400` `invalid_idempotency_key`. Honoured only on the operations
        marked idempotent.
      schema:
        type: string
        maxLength: 255
  schemas:
    CreateCheckoutSessionBody:
      type: object
      example:
        mode: payment
        amount: 2500
        currency: usd
        customer_email: customer@example.com
        success_url: https://example.com/thanks?session={CHECKOUT_SESSION_ID}
      description: >-
        One of `amount` (single line), `line_items` (up to 20), or a catalog
        `price`. Amounts are cents and come from this call only.
      properties:
        mode:
          type: string
          enum:
            - payment
            - subscription
          default: payment
        amount:
          type: integer
          minimum: 1
          description: Amount in cents, for one line without line_items.
        currency:
          type: string
          pattern: ^[A-Za-z]{3}$
          default: usd
        line_items:
          type: array
          maxItems: 20
          items:
            type: object
            properties:
              price:
                type: string
                description: >-
                  A price id of this business (catalog). Its amount and currency
                  are used.
              name:
                type: string
                maxLength: 250
              description:
                type: string
              amount:
                type: integer
                minimum: 1
                description: Unit amount in cents, when not using a catalog price.
              quantity:
                type: integer
                minimum: 1
                maximum: 999
                default: 1
              image_url:
                type: string
                format: uri
              adjustable_quantity:
                type: object
                properties:
                  enabled:
                    type: boolean
                  minimum:
                    type: integer
                    minimum: 1
                  maximum:
                    type: integer
                    maximum: 999
        customer:
          type: string
          format: uuid
          description: A checkout customer id of this mode.
        customer_email:
          type: string
          format: email
        customer_name:
          type: string
        recurring:
          type: object
          description: >-
            Subscription billing. Needed for subscription mode without a catalog
            price.
          properties:
            interval:
              type: string
              enum:
                - day
                - week
                - month
                - year
            interval_count:
              type: integer
              minimum: 1
              maximum: 52
        interval:
          type: string
          enum:
            - day
            - week
            - month
            - year
          description: Older form of recurring.interval.
        interval_count:
          type: integer
          minimum: 1
          maximum: 52
        trial_days:
          type: integer
          minimum: 0
          maximum: 730
          description: Subscription mode only.
        payment_method_collection:
          type: string
          enum:
            - always
            - if_required
          default: always
          description: >-
            `if_required` starts a trial without a card. Needs `mode:
            subscription` and a trial.
        trial_end_behavior:
          type: string
          enum:
            - pause
            - cancel
          default: pause
          description: >-
            With `payment_method_collection: if_required`, what happens when the
            trial ends and no card was added.
        allow_promotion_codes:
          type: boolean
        automatic_tax:
          oneOf:
            - type: boolean
            - type: object
              properties:
                enabled:
                  type: boolean
        collect:
          type: object
          properties:
            address:
              type: string
              enum:
                - none
                - billing
                - shipping
            phone:
              type: boolean
            terms_url:
              type: string
              format: uri
            custom_fields:
              type: array
              maxItems: 3
              items:
                type: object
                additionalProperties: true
            shipping_countries:
              type: array
              items:
                type: string
                pattern: ^[A-Za-z]{2}$
        success_url:
          type: string
          format: uri
          description: >-
            A full https address on an allowed website. May contain
            {CHECKOUT_SESSION_ID}.
        cancel_url:
          type: string
          format: uri
        expires_in:
          type: integer
          minimum: 1800
          maximum: 86400
          description: Seconds until the session expires.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: >-
            String values only. Returned on the session and on checkout
            webhooks.
    CheckoutSessionCreated:
      type: object
      description: >-
        The session as it was created. `client_secret` is for the embedded
        checkout.
      required:
        - object
        - id
        - checkout_session_id
        - client_secret
        - url
        - status
        - mode
        - amount
        - amount_total
        - amount_due_today
        - currency
        - line_items
        - customer
        - customer_email
        - customer_name
        - metadata
        - expires_at
        - livemode
      properties:
        object:
          const: checkout.session
        id:
          type: string
          pattern: ^cs_
        checkout_session_id:
          type: string
          pattern: ^cs_
        client_secret:
          type: string
        url:
          type: string
          format: uri
        status:
          type: string
        mode:
          type: string
          enum:
            - payment
            - subscription
        amount:
          type: integer
        amount_total:
          type: integer
        amount_due_today:
          type: integer
        currency:
          type: string
        line_items:
          type: array
          items:
            type: object
            additionalProperties: true
        trial_days:
          type:
            - integer
            - 'null'
        payment_method_collection:
          type: string
          enum:
            - always
            - if_required
        trial_end_behavior:
          type:
            - string
            - 'null'
          enum:
            - pause
            - cancel
            - null
        customer:
          type:
            - string
            - 'null'
          format: uuid
        customer_email:
          type:
            - string
            - 'null'
        customer_name:
          type:
            - string
            - 'null'
        metadata:
          type: object
          additionalProperties:
            type: string
        expires_at:
          type: string
          format: date-time
        livemode:
          type: boolean
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
    Error:
      type: object
      required:
        - type
        - code
        - message
      properties:
        type:
          type: string
          enum:
            - authentication
            - permission
            - invalid_request
            - rate_limit
            - api_error
          description: >-
            authentication is 401. permission is 403. invalid_request is 400,
            404 or 409. rate_limit is 429. api_error is 5xx.
        code:
          type: string
          description: >-
            The stable code, for example invalid_api_key, key_forbidden,
            invalid_amount or rate_limit.
        message:
          type: string
        fields:
          type: array
          description: The fields that are wrong, on validation errors.
          items:
            type: object
            required:
              - name
              - message
            properties:
              name:
                type: string
              message:
                type: string
  responses:
    Error:
      description: >-
        An error. Branch on `error.type` and `error.code`. Do not parse
        `error.message`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-default: easner_sk_test_…
      description: >-
        A secret key, easner_sk_test_… or easner_sk_live_…, as Authorization:
        Bearer. Each key has one business, one mode and fixed scopes. Transfer
        routes also accept a transfer's easner_ta_… secret for the customer.

````

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