> ## 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 method session

> Create a new payment method session.



## OpenAPI

````yaml openapi-payments.json POST /v1/payment_method_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_method_sessions:
    post:
      tags:
        - Payment Method Sessions
      summary: Create a payment method session
      description: Create a new payment method session.
      operationId: payment_method_sessions_create
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                customer:
                  type: string
                  description: The ID of the customer the payment method session is for.
                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.
                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.
                return_url:
                  type: string
                  format: uri
                  description: The URL to return to after the session is complete.
                send_email:
                  type: boolean
                  description: >-
                    Whether to send an email to the customer with a link to the
                    payment method session.
                subscription:
                  type: string
                  description: >-
                    The ID of the subscription to associate the payment method
                    with.
              required:
                - customer
                - payment_method_types
      responses:
        '200':
          description: Returns the payment method 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_method_session
                  customer:
                    anyOf:
                      - type: string
                      - type: object
                        additionalProperties: {}
                    description: The customer the payment method session is for.
                  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
                      method 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.
                  payment_method:
                    anyOf:
                      - type: string
                      - type: object
                        additionalProperties: {}
                      - type: 'null'
                    description: The payment method created or selected during the session.
                  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
                    description: The payment method types allowed for this session.
                  return_url:
                    type:
                      - string
                      - 'null'
                    format: uri
                    description: The URL to return to after the session is complete.
                  status:
                    type: string
                    enum:
                      - requires_payment_method
                      - succeeded
                    description: The current status of the payment method session.
                  subscription:
                    anyOf:
                      - type: string
                      - type: object
                        additionalProperties: {}
                      - type: 'null'
                    description: >-
                      The subscription associated with the payment method
                      session, if any.
                  url:
                    type:
                      - string
                      - 'null'
                    format: uri
                    description: The hosted URL of the payment method session.
                required:
                  - id
                  - created
                  - object
                  - customer
                  - payment_method
                  - payment_method_types
                  - return_url
                  - status
                  - subscription
                  - url
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: API Key authentication. Use "Bearer YOUR_API_KEY".

````