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

# Create a Terminal Payment Session



## OpenAPI

````yaml /openapi-spec.yaml post /v1/terminal/sessions
openapi: 3.0.3
info:
  title: Xendit in-person payments API (H2H)
  version: 0.5.1
  description: >-
    API specification for Xendit's in-person payments H2H payment sessions and
    command endpoints.
servers:
  - url: https://terminal-dev.xendit.co
    description: Development
  - url: https://terminal.xendit.co
    description: Live
security: []
paths:
  /v1/terminal/sessions:
    post:
      tags:
        - In-person payments H2H API
      summary: Create a Terminal Payment Session
      operationId: createTerminalPaymentSession
      parameters:
        - name: idempotency-key
          in: header
          required: true
          schema:
            type: string
          description: >-
            Idempotency key to ensure the request is not processed multiple
            times
        - name: for-user-id
          in: header
          required: false
          schema:
            type: string
          description: >-
            The sub-account user-id to make this transaction for. This header is
            only used if you have access to xenPlatform. See
            [xenPlatform](https://docs.xendit.co/docs/xenplatform-overview) for
            more information.
        - name: with-split-rule
          in: header
          required: false
          schema:
            type: string
          description: >-
            The XenPlatform split rule ID that will be applied to this
            transaction. This header is only used if you have access to
            xenPlatform.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTerminalPaymentSession'
      responses:
        '200':
          description: Terminal Payment Session created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TerminalPaymentSessionResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BasicAuth: []
components:
  schemas:
    CreateTerminalPaymentSession:
      type: object
      required:
        - session_type
        - mode
        - currency
        - amount
        - country
        - channel_properties
      properties:
        reference_id:
          type: string
          example: ref_123456789
        customer_id:
          type: string
          example: cus_123456789
        customer:
          $ref: '#/components/schemas/Customer'
        currency:
          type: string
          enum:
            - IDR
            - VND
            - THB
            - MYR
        amount:
          type: number
          format: decimal
          minimum: 1
        country:
          type: string
          enum:
            - ID
            - VN
            - TH
            - MY
        session_type:
          type: string
          enum:
            - PAY
        mode:
          type: string
          enum:
            - TERMINAL
        description:
          type: string
          nullable: true
          example: 'Payment for order #123'
        metadata:
          type: object
          additionalProperties: true
        channel_properties:
          $ref: '#/components/schemas/ChannelProperties'
    TerminalPaymentSessionResponse:
      type: object
      required:
        - payment_session_id
        - reference_id
        - business_id
        - session_type
        - mode
        - country
        - currency
        - amount
        - status
        - channel_properties
        - latest_payment_id
        - created
        - updated
      properties:
        payment_session_id:
          type: string
          pattern: >-
            ^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$
        latest_payment_id:
          type: string
          pattern: >-
            ^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$
        business_id:
          type: string
        reference_id:
          type: string
          example: ref_123456789
        customer_id:
          type: string
          example: cus_123456789
        session_type:
          type: string
          enum:
            - PAY
        currency:
          type: string
          enum:
            - IDR
            - VND
            - THB
            - MYR
        amount:
          type: number
          format: decimal
          minimum: 1
        country:
          type: string
          enum:
            - ID
            - VN
            - TH
            - MY
        mode:
          type: string
          enum:
            - TERMINAL
        status:
          type: string
          enum:
            - ACTIVE
            - COMPLETED
            - FAILED
            - CANCELED
        description:
          type: string
          nullable: true
          example: 'Payment for order #123'
        metadata:
          type: object
          additionalProperties: true
        canceled_at:
          type: string
          nullable: true
          format: date-time
        channel_properties:
          $ref: '#/components/schemas/ChannelProperties'
        created:
          type: string
          format: date-time
          example: '2024-11-06T15:32:42Z'
        updated:
          type: string
          format: date-time
          example: '2024-11-06T15:32:42Z'
    ErrorResponse:
      type: object
      required:
        - error_code
        - message
      properties:
        error_code:
          type: string
          enum:
            - INVALID_REQUEST
            - DUPLICATED_REQUEST
            - UNAUTHORIZED
            - CURRENCY_NOT_SUPPORTED
            - TERMINAL_NOT_FOUND
            - COMMAND_NOT_SUPPORTED
          example: INVALID_REQUEST
        message:
          type: string
          example: 'Missing required parameter: terminal_id'
    Customer:
      type: object
      properties:
        type:
          type: string
          enum:
            - INDIVIDUAL
            - BUSINESS
          example: INDIVIDUAL
        reference_id:
          type: string
          example: cus_123456789
        email:
          type: string
          nullable: true
          format: email
          example: test@xendit.co
        mobile_number:
          type: string
          nullable: true
          example: '+62123456789'
        phone_number:
          type: string
          nullable: true
          example: '+62123456789'
        individual_detail:
          type: object
          nullable: true
          properties:
            given_names:
              type: string
              example: John Doe
            surname:
              type: string
              nullable: true
              example: Doe
        business_detail:
          type: object
          nullable: true
          properties:
            business_name:
              type: string
    ChannelProperties:
      type: object
      required:
        - terminal_id
      properties:
        terminal_id:
          type: string
          example: abcd-3254fsd-3242
        order_id:
          type: string
          example: order-12345
          maxLength: 255
        payment_methods:
          type: array
          nullable: true
          items:
            type: string
            enum:
              - ID_INSERT_CARD
              - ID_CONTACTLESS
              - ID_BRIZZI
              - ID_QRIS
              - VN_CARD
              - VN_QR
              - TH_ALIPAY_PLUS
              - TH_WECHATPAY
              - TH_TRUEMONEY
              - TH_LINEPAY
              - TH_SHOPEEPAY
              - TH_SABUYMONEY
              - TH_MAXME
              - TH_CARD
              - TH_BBL_QRCS
              - TH_MULTIIPP
              - TH_QRCODE
              - MY_QR
              - MY_CARD
              - MY_EWALLET
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic

````