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

# Create a checkout



## OpenAPI

````yaml POST /v1/checkouts
openapi: 3.0.0
info:
  description: Stan Client API
  version: 1.0.0
  title: Stan API
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.stan-app.fr
security: []
externalDocs:
  description: Find out more about Stan
  url: https://doc.stan-app.fr
paths:
  /v1/checkouts:
    post:
      tags:
        - checkout
      summary: Create a new checkout
      operationId: create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutRequestBody'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Checkout'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '500':
          $ref: '#/components/responses/500'
      security:
        - stan_basic_auth: []
components:
  schemas:
    CheckoutRequestBody:
      title: A checkout request body
      type: object
      required:
        - name
        - email
        - address
      properties:
        return_url:
          type: string
          format: uri
          description: >-
            It's where the user will be redirected at the end of the checkout,
            whether it's success, cancelled or failed
        total_amount:
          type: integer
          format: int64
          description: Defines the total cost of the checkout (subtotal + shipping + tax)
        session_id:
          type: string
          description: >-
            An ID for the checkout session, it can be the cart ID or anything
            else
        order_id:
          type: string
          description: The ID of the current order if created
        subtotal_amount:
          type: integer
          format: int64
          description: >-
            Defines the total cost of the checkout before taxes and without
            discounts
        discount_amount:
          type: integer
          format: int64
          description: Defines the absolute discount amount
        tax_rate:
          type: integer
          format: int64
          description: Defines the percent of taxes (express as integer)
        tax_cost:
          type: integer
          format: int64
        discount_code:
          type: string
          description: Defines the code used for the discount
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/LineItem'
    Checkout:
      title: A checkout is the starting point of a checkout flow
      type: object
      properties:
        id:
          type: string
          format: uuid
        total_amount:
          type: integer
          format: int64
          description: Total amount to pay
        total_amount_before_discount:
          type: integer
          format: int64
          description: Total amount to pay before any discount
        subtotal_amount:
          type: integer
          format: int64
          description: Subtotal amount of this checkout
        discount_amount:
          type: integer
          format: int64
          description: Total discount applied to this checkout
        tax_rate:
          type: integer
          format: int64
          description: Tax rate
        discount_code:
          type: string
          description: Discount code applied to this checkout
        is_testmode:
          type: boolean
          description: Wether the checkout is in testmode or not
        line_items:
          type: array
          description: Items included in the checkout
          items:
            $ref: '#/components/schemas/LineItem'
        merchant:
          $ref: '#/components/schemas/Merchant'
        session_id:
          type: string
          description: Defines a session for the current user
        order_id:
          type: string
          description: Order id associated to this checkout
    LineItem:
      title: A line item
      type: object
      properties:
        product_id:
          type: string
        quantity:
          type: integer
        unit_price:
          type: integer
        discount_amount:
          type: integer
        description:
          type: string
        sku:
          type: string
        image_url:
          type: string
          format: uri
        product_url:
          type: string
          format: uri
    Merchant:
      title: Merchant's infos
      type: object
      properties:
        name:
          type: string
        website:
          type: string
        privacy_policy_url:
          type: string
          format: uri
        general_terms_url:
          type: string
          format: uri
        logo_url:
          type: string
          format: uri
  responses:
    '400':
      description: Bad data format
    '401':
      description: >-
        Unauthorized, please provided api client_id and client_secret as Basic
        auth
    '500':
      description: The servers encountered an alien
  securitySchemes:
    stan_basic_auth:
      type: http
      scheme: basic

````