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

# Create a payment session

> Creates a new payment session.



## OpenAPI

````yaml openapi-payments.json POST /v1/payment_sessions
openapi: 3.1.0
info:
  title: Yorlet Payments API
  description: APIs for managing transactions, payment initiations, and external accounts.
  version: 1.0.0
servers:
  - url: https://api.yorlet.com
    description: Production
  - url: https://api.yorlet.io
    description: Sandbox
security: []
paths:
  /v1/payment_sessions:
    post:
      tags:
        - Payment Sessions
      summary: Create a payment session
      description: Creates a new payment session.
      operationId: payment_sessions_create
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: integer
                  minimum: 100
                  maximum: 99999900
                  description: >-
                    The amount to charge. Should be a positive integer in the
                    smallest currency unit (e.g. 100 for £1.00).
                currency:
                  type: string
                  enum:
                    - gbp
                    - eur
                    - usd
                  description: >-
                    Three-letter ISO currency code, in lowercase. Must be a
                    supported currency.
                customer:
                  type: string
                  description: The ID of the customer the transaction is for.
                description:
                  type: string
                  description: >-
                    An arbitrary string attached to the object. Often useful for
                    displaying to users.
                metadata:
                  type:
                    - object
                    - 'null'
                  additionalProperties:
                    type: string
                  description: >-
                    Set of key-value pairs that you can attach to an object.
                    This can be useful for storing additional information about
                    the object in a structured format.
                mode:
                  type: string
                  enum:
                    - payment
                  description: The mode of the payment session.
                payment_method_options:
                  type: object
                  properties: {}
                  description: Payment method configuration options.
                payment_method_types:
                  type: array
                  items:
                    type: string
                    enum:
                      - autogiro
                      - bacs_debit
                      - card
                      - card_present
                      - bank_transfer
                      - direct_transfer
                      - gbp_credit_transfer
                      - pay_by_bank
                      - sepa_debit
                  minItems: 1
                  description: The payment method types allowed for this session.
                reporting_type:
                  type:
                    - string
                    - 'null'
                  enum:
                    - advance_rent
                    - charge
                    - deposit
                    - holding_fee
                    - rent
                    - null
                  description: The reporting type of the transaction.
                return_url:
                  type: string
                  format: uri
                  description: >-
                    The URL to redirect the user to after the transaction is
                    complete.
                send_email:
                  type: boolean
                  description: Send the URL to the customer email address.
                statement_descriptor:
                  type:
                    - string
                    - 'null'
                  description: >-
                    The statement descriptor that will appear on customers bank
                    statement.
                transaction_data:
                  type: object
                  properties:
                    customer_balance:
                      type: object
                      properties:
                        apply:
                          type: boolean
                          description: >-
                            Whether to apply the transaction amount to the
                            customer's balance.
                        description:
                          type: string
                          description: >-
                            A description of the transaction to be applied to
                            the customer's balance.
                      required:
                        - apply
                      description: >-
                        A hash containing information about the customer balance
                        options.
                    transfer_data:
                      type: object
                      properties:
                        use_unit_ownership:
                          type: boolean
                          description: >-
                            If a unit ID is supplied, transfers will be created
                            based on the unit's ownership.
                      description: >-
                        Configuration for how transfers are created for this
                        transaction.
                    unit:
                      type:
                        - string
                        - 'null'
                      description: The ID of the unit.
                  description: A subset of parameters to be passed to transaction creation.
              required:
                - amount
                - currency
                - customer
                - mode
                - payment_method_types
      responses:
        '200':
          description: Returns the payment session object if the request succeeded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Unique identifier for the object.
                  created:
                    type: number
                    description: >-
                      Time at which the object was created. Measured in seconds
                      since the Unix epoch.
                  account:
                    type: string
                    description: >-
                      The account that the object belongs to. Only returned if
                      the request is made with a valid Yorlet-Context header.
                  deleted:
                    type: boolean
                    default: false
                    description: Only returned if the object has been deleted.
                  object:
                    type: string
                    enum:
                      - payment_session
                  amount:
                    type: number
                    description: >-
                      The amount of the payment session, in the smallest
                      currency unit.
                  currency:
                    type: string
                    description: >-
                      Three-letter ISO currency code, in lowercase. Must be a
                      supported currency.
                  customer:
                    anyOf:
                      - type: string
                      - type: object
                        additionalProperties: {}
                    description: The customer the payment session is for.
                  description:
                    type:
                      - string
                      - 'null'
                    description: >-
                      An arbitrary string attached to the object. Often useful
                      for displaying to users.
                  merchant:
                    type: object
                    properties:
                      business_name:
                        type:
                          - string
                          - 'null'
                        description: The legal business name of the merchant.
                      color:
                        type:
                          - string
                          - 'null'
                        description: The merchant's brand color, as a hex code.
                      country:
                        type:
                          - string
                          - 'null'
                        description: The ISO 3166-1 alpha-2 country code of the merchant.
                      display_name:
                        type:
                          - string
                          - 'null'
                        description: The display name shown on hosted pages.
                      icon:
                        type:
                          - string
                          - 'null'
                        description: The URL of the merchant icon shown on hosted pages.
                      id:
                        type: string
                        description: The ID of the merchant.
                      support_email:
                        type:
                          - string
                          - 'null'
                        description: The support email address shown on hosted pages.
                      support_phone:
                        type:
                          - string
                          - 'null'
                        description: The support phone number shown on hosted pages.
                      support_website:
                        type:
                          - string
                          - 'null'
                        description: The support website URL shown on hosted pages.
                    required:
                      - business_name
                      - color
                      - country
                      - display_name
                      - icon
                      - id
                      - support_email
                      - support_phone
                      - support_website
                    description: >-
                      Information about the merchant operating the payment
                      session.
                  metadata:
                    type:
                      - object
                      - 'null'
                    additionalProperties:
                      type: string
                    description: >-
                      Set of key-value pairs that you can attach to an object.
                      This can be useful for storing additional information
                      about the object in a structured format.
                  mode:
                    type: string
                    enum:
                      - payment
                    description: The mode of the payment session.
                  payment_method_types:
                    type: array
                    items:
                      type: string
                    description: The payment method types allowed for this session.
                  reporting_type:
                    type:
                      - string
                      - 'null'
                    description: >-
                      The reporting type used to categorize this payment
                      session.
                  return_url:
                    type:
                      - string
                      - 'null'
                    description: >-
                      The URL to redirect to after the payment session is
                      complete.
                  status:
                    type: string
                    enum:
                      - paid
                      - unpaid
                      - canceled
                    description: The status of the payment session.
                  transaction:
                    anyOf:
                      - type: string
                      - type: object
                        additionalProperties: {}
                    description: The transaction created for this payment session.
                  url:
                    type:
                      - string
                      - 'null'
                    description: The hosted URL of the payment session.
                required:
                  - id
                  - created
                  - object
                  - amount
                  - currency
                  - customer
                  - description
                  - mode
                  - payment_method_types
                  - reporting_type
                  - return_url
                  - status
                  - transaction
                  - url
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: API Key authentication. Use "Bearer YOUR_API_KEY".

````