> ## 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 Payment Request

> Creates a new payment request on the specified terminal.



## OpenAPI

````yaml /openapi-spec-c2c.yaml post /commands/pay
openapi: 3.1.0
info:
  title: Xendit in-person payments API (C2C)
  description: >-
    This specification documents the client-to-client command API for Xendit
    in-person payments. Use it for local-network terminal commands such as pay,
    cancel, receipt, settlement, and transaction history.
  version: 1.3.0
servers:
  - url: http://{IP_ADDRESS}:{PORT}
    description: Client-to-Client Endpoint
    variables:
      IP_ADDRESS:
        default: 172.0.0.1
        description: The IP address displayed on the Terminal Gateway App main screen.
      PORT:
        default: '8189'
        description: The port number configured in the Terminal Gateway App.
  - url: https://{IP_ADDRESS}:{PORT}
    description: Secure Client-to-Client Endpoint
    variables:
      IP_ADDRESS:
        default: 172.0.0.1
        description: The IP address displayed on the Terminal Gateway App main screen.
      PORT:
        default: '8189'
        description: The port number configured in the Terminal Gateway App.
security:
  - ApiKeyAuth: []
tags:
  - name: In-person payments C2C API
    description: Payment operations and transactions
paths:
  /commands/pay:
    post:
      tags:
        - In-person payments C2C API
      summary: Create Payment Request
      description: Creates a new payment request on the specified terminal.
      operationId: createPayment
      parameters:
        - name: provider
          in: header
          required: true
          schema:
            type: string
            enum:
              - BRI
              - NTT
              - CASHUP
              - SHC
          description: Provider name.
        - name: simulation
          in: header
          required: false
          schema:
            type: boolean
          description: Simulation/mock response flag.
          example: false
        - name: pretty-print
          in: header
          required: false
          schema:
            type: boolean
          description: Json Pretty Formatter flag.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentRequest'
            example:
              order_id: test1223323
              terminal_id: '10362517'
              request_amount: 100
              payment_method: QRIS
      responses:
        '200':
          description: Successful payment response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentResponse'
              example:
                order_id: test1223323
                terminal_id: '10362517'
                terminal_reference: 1750407594445|1750407594
                payment_method: QRIS
                amount: 100
                currency: IDR
                transaction_date: '2025-06-20T08:19:54.000Z'
                status: SUCCESS
        '400':
          description: Bad request - invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: INVALREQUEST
                message: Invalid payment amount
        '401':
          description: Unauthorized - invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: INVALCREDENTIAL
                message: Invalid API key
        '404':
          description: Terminal not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: TNOT_FOUND
                message: Terminal not found
        '409':
          description: Terminal busy or transaction in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: TERMINAL_BUSY
                message: Terminal is busy
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: INTERNAL_SERVER_ERROR
                message: Internal server error
        default:
          description: An error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: UNKNOWN_ERROR
                message: An unexpected error occurred
components:
  schemas:
    PaymentRequest:
      allOf:
        - type: object
          required:
            - terminal_id
            - order_id
            - request_amount
            - payment_method
          properties:
            terminal_id:
              type: string
              minLength: 1
              maxLength: 50
              description: Terminal's ID.
              example: '10362517'
            order_id:
              type: string
              minLength: 1
              maxLength: 100
              description: >-
                Merchant's order ID. Use only letters and numbers
                (alphanumeric). Hyphens, underscores, and other special
                characters are not allowed and may cause the transaction to fail
                to execute or complete.
              pattern: ^[A-Za-z0-9]+$
              example: test1223323
            request_amount:
              type: number
              format: double
              minimum: 1
              description: Intended amount to be collected from end user.
              example: 100
            payment_method:
              type: string
              enum:
                - INSERT_CARD
                - CONTACTLESS
                - BRIZZI
                - QRIS
                - CARD
                - QR
                - ALIPAY_PLUS
                - WECHATPAY_CIL
                - WECHATPAY_OCGT
                - TRUEMONEY
                - LINEPAY
                - SHOPEEPAY
                - SABUYMONEY
                - MAXME
                - BBL_QRCS
              description: Available payment methods
              example: QRIS
    PaymentResponse:
      allOf:
        - $ref: '#/components/schemas/BaseResponse'
        - type: object
          required:
            - order_id
            - status
          properties:
            order_id:
              type: string
              description: >-
                Merchant's order ID. Uses only letters and numbers
                (alphanumeric). Hyphens, underscores, and other special
                characters are not allowed and may cause the transaction to fail
                to execute or complete.
              example: test1223323
    Error:
      type: object
      required:
        - error_code
        - message
      properties:
        error_code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: Error message.
          example: Transaction Failed
    BaseResponse:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/TransactionStatus'
        terminal_reference:
          type: string
          description: Reference for Void & Receipt.
          example: 1750407594445|1750407594
        payment_method:
          $ref: '#/components/schemas/PaymentMethod'
        amount:
          type: number
          format: double
          minimum: 0
          description: The transaction amount.
          example: 100
        currency:
          type: string
          minLength: 3
          maxLength: 3
          description: The transaction currency (ISO 4217).
          example: IDR
        transaction_date:
          type: string
          format: date-time
          description: The date and time of the transaction.
          example: '2025-06-20T08:19:54.000Z'
    ErrorCode:
      type: string
      enum:
        - INVALCREDENTIAL
        - INVALREQUEST
        - INTERNAL_SERVER_ERROR
        - UNKNOWN_ERROR
        - KEY_INVALID
        - SEND_FAILED
        - NOT_CONNECTED
        - FAILED_TO_CONNECT
        - UNSUPPORTED
        - TERMINAL_BUSY
        - ENCRYPTION_FAILED
        - DECLINED_BY_READER
        - PAYMENT_UNPAID
        - DUPLICATED
        - CANCELLED
        - TIMEOUT
        - NO_DATA_FOUND
        - VOFAILED
        - REFUNDED
        - NEED_DO_SETTLEMENT
        - CHIP_CARD_DETECTED
        - TRANSACTION_FAILED
        - TNOT_SET
        - TNOT_MATCH
        - TNOT_FOUND
        - AUTHENTICATION_FAILED
        - WRONG_PIN
      description: Error codes returned by the API
      example: INVALREQUEST
    TransactionStatus:
      type: string
      enum:
        - SUCCESS
        - FAILED
      description: Transaction status values
      example: SUCCESS
    PaymentMethod:
      type: string
      enum:
        - CARD
        - EWALLET
        - QRIS
      description: Available payment methods
      example: QRIS
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API key for authentication

````