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

# Settlement

> Initiates the settlement process on the terminal.



## OpenAPI

````yaml /openapi-spec-c2c.yaml post /commands/settlement
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/settlement:
    post:
      tags:
        - In-person payments C2C API
      summary: Settlement
      description: Initiates the settlement process on the terminal.
      operationId: performSettlement
      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.
          example: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SettlementRequest'
            example:
              terminal_id: '10362517'
              payment_method: QRIS
      responses:
        '200':
          description: Successful settlement response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SettlementResponse'
              example:
                status: SUCCESS
                terminal_id: '10362517'
                payment_method: QRIS
                transaction_date: '2025-06-20T16:59:59.000Z'
        '400':
          description: Bad request - invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: INVALREQUEST
                message: Invalid terminal ID
        '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: Settlement not needed or already performed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: NEED_DO_SETTLEMENT
                message: No settlement needed
        '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'
components:
  schemas:
    SettlementRequest:
      type: object
      required:
        - terminal_id
      properties:
        terminal_id:
          type: string
          minLength: 1
          maxLength: 50
          description: Terminal's ID to perform settlement on.
          example: '10362517'
        payment_method:
          $ref: '#/components/schemas/PaymentMethod'
    SettlementResponse:
      type: object
      required:
        - status
        - terminal_id
        - payment_method
        - transaction_date
      properties:
        status:
          $ref: '#/components/schemas/TransactionStatus'
        payment_method:
          $ref: '#/components/schemas/PaymentMethod'
        terminal_id:
          type: string
          description: Terminal ID where settlement was performed.
          example: '10362517'
        transaction_date:
          type: string
          format: date-time
          description: Settlement date and time.
          example: '2025-06-20T16:59:59.000Z'
    Error:
      type: object
      required:
        - error_code
        - message
      properties:
        error_code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: Error message.
          example: Transaction Failed
    PaymentMethod:
      type: string
      enum:
        - CARD
        - EWALLET
        - QRIS
      description: Available payment methods
      example: QRIS
    TransactionStatus:
      type: string
      enum:
        - SUCCESS
        - FAILED
      description: Transaction status values
      example: SUCCESS
    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
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API key for authentication

````