> ## 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.

# Prepare an oncoming payment



## OpenAPI

````yaml post /v1/payments
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/payments:
    post:
      tags:
        - payment
      summary: Prepare an oncoming payment
      operationId: create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentRequestBody'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreparedPayment'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '500':
          $ref: '#/components/responses/500'
      security:
        - stan_basic_auth: []
components:
  schemas:
    PaymentRequestBody:
      title: A payment request body
      type: object
      required:
        - order_id
        - amount
        - return_url
      properties:
        order_id:
          type: string
          format: string
        amount:
          type: integer
          description: Amount in cents
          format: int32
        subtotal_amount:
          type: integer
          description: >-
            The subtotal amount in cents. This amount is optionnal, it's useful
            to give information to the user.
          format: int32
        shipping_amount:
          type: integer
          description: >-
            The shipping cost in cents. This amount is optionnal, it's useful to
            give information to the user.
          format: int32
        discount_amount:
          type: integer
          description: >-
            The discount amount in cents. This amount is optionnal, it's useful
            to give information to the user.
          format: int32
        tax_amount:
          type: integer
          description: >-
            The tax amount in cents. This amount is optionnal, it's useful to
            give information to the user.
          format: int32
        return_url:
          type: string
          format: uri
          description: >-
            The return URL where the user will land after the payment has been
            complete. The URL will be appended with a URI query payment_status
            with the value corresponding to the Payment status and state with
            the value you provided in state.
        cancel_url:
          type: string
          format: uri
          description: The redirect URL used in case of payment cancel or fail.
        customer_id:
          type: string
          description: UUID of the customer
          format: uuid
        state:
          type: string
          description: >-
            Payment state that will be used to preserve the state after the
            redirection to the provided return_url or cancel_url. If not state
            is provided Stan will generate one and transmit it to the return_url
            or cancel_url.
    PreparedPayment:
      title: A prepared payment
      type: object
      properties:
        payment_id:
          type: string
          format: uuid
        state:
          type: string
          format: string
        redirect_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

````