openapi: 3.1.0
info:
  title: Terminal API
  contact:
    name: API Integration Support
    email: integration@dintero.com
  version: LATEST
  license:
    name: UNLICENSED
    url: https://dintero.com
  x-logo:
    url: https://docs.dintero.com/img/dintero_logo_v2.png
  description: |

    - [Download API Spec](http://docs.dintero.com/specs/spec-terminals.yaml)

    # Changelog

    All notable changes to the API.

    ## 2026-06-15

    > Add `payment_account_reference` to authorization, pre-authorization and sale response `operation_data`.
    >
    > - [POST /transactions/v1/{account_id}/{transaction_id}/authorization](/psp-api/transaction/transactionPost_Authorization)

    # Encryption Overview

    All sensitive data transmitted by the terminal (pin block/emv tags) is
    encrypted using the **DUKPT (Derived Unique Key Per Transaction)** key
    management scheme. This approach ensures that every transaction is
    secured with a unique, transaction-specific encryption key derived from
    a shared Base Derivation Key (BDK) and a per-transaction Key Serial
    Number (KSN).

    Data encryption uses AES in CBC mode, and encrypted ciphertext is encoded
    as a hexadecimal string before transmission. The API payload includes the
    encrypted data fields alongside their respective KSN and BDK identifiers
servers:
  - url: https://payments.psp-test.dintero.com
    description: test server
tags:
  - name: terminals-transactions
    description: Manage terminal transactions
    x-displayName: Transactions
paths:
  /terminal/v1/{account_id}/transactions/{client_transaction_id}:
    post:
      operationId: terminal_v1_post_transaction
      summary: terminal_v1_post_transaction
      security:
        - ApiClient: []
      tags:
        - terminals-transactions
      servers:
        - url: https://payments.psp.dintero.com
      requestBody:
        $ref: '#/components/requestBodies/CreateTerminalTransaction'
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/AccountIdPath'
        - $ref: '#/components/parameters/ClientTransactionIdPath'
      responses:
        '200':
          $ref: '#/components/responses/TerminalTransactionCreated'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-mint:
        metadata:
          title: Create transaction
          sidebarTitle: Create transaction
    get:
      operationId: terminal_v1_get_transaction
      summary: terminal_v1_get_transaction
      security:
        - ApiClient: []
      tags:
        - terminals-transactions
      servers:
        - url: https://payments.psp.dintero.com
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/AccountIdPath'
        - $ref: '#/components/parameters/ClientTransactionIdPath'
      responses:
        '200':
          $ref: '#/components/responses/TerminalTransaction'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-mint:
        metadata:
          title: Get transaction
          sidebarTitle: Get transaction
  /terminal/v1/{account_id}/transactions/{client_transaction_id}/authorization:
    post:
      operationId: terminal_v1_post_transaction_authorization
      summary: terminal_v1_post_transaction_authorization
      security:
        - ApiClient: []
      description: |
        Update a non-final authorization to the specified amount. The operation is
        not allowed if the previous authorization was final
      tags:
        - terminals-transactions
      requestBody:
        $ref: '#/components/requestBodies/CreateTerminalTransactionAuthorizationOperation'
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/AccountIdPath'
        - $ref: '#/components/parameters/ClientTransactionIdPath'
      responses:
        '200':
          $ref: '#/components/responses/TerminalTransactionAuthorized'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-mint:
        metadata:
          title: Post Authorization
          sidebarTitle: Post Authorization
  /terminal/v1/{account_id}/transactions/{client_transaction_id}/capture:
    post:
      operationId: terminal_v1_post_transaction_capture
      summary: terminal_v1_post_transaction_capture
      security:
        - ApiClient: []
      description: Captures the specified amount.
      tags:
        - terminals-transactions
      requestBody:
        $ref: '#/components/requestBodies/CreateTerminalTransactionCaptureOperation'
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/AccountIdPath'
        - $ref: '#/components/parameters/ClientTransactionIdPath'
      responses:
        '200':
          $ref: '#/components/responses/TerminalTransactionCaptured'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-mint:
        metadata:
          title: Post Capture
          sidebarTitle: Post Capture
  /terminal/v1/{account_id}/transactions/{client_transaction_id}/refund:
    post:
      operationId: terminal_v1_post_transaction_refund
      summary: terminal_v1_post_transaction_refund
      security:
        - ApiClient: []
      description: Refund the specified amount.
      tags:
        - terminals-transactions
      requestBody:
        $ref: '#/components/requestBodies/CreateTerminalTransactionRefundOperation'
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/AccountIdPath'
        - $ref: '#/components/parameters/ClientTransactionIdPath'
      responses:
        '200':
          $ref: '#/components/responses/TerminalTransactionRefunded'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-mint:
        metadata:
          title: Post Refund
          sidebarTitle: Post Refund
  /terminal/v1/{account_id}/transactions/{client_transaction_id}/void:
    post:
      operationId: terminal_v1_post_transaction_void
      summary: terminal_v1_post_transaction_void
      security:
        - ApiClient: []
      description: |
        Void the specified amount and cancel the tranaction (prevents new
        authorization). Void has no effect if the transaction is already captured,
        except to prevent new authorization/captures (if applicable)
      tags:
        - terminals-transactions
      requestBody:
        $ref: '#/components/requestBodies/CreateTerminalTransactionVoidOperation'
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/AccountIdPath'
        - $ref: '#/components/parameters/ClientTransactionIdPath'
      responses:
        '200':
          $ref: '#/components/responses/TerminalTransactionVoided'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-mint:
        metadata:
          title: Post Void
          sidebarTitle: Post Void
components:
  securitySchemes:
    ApiClient:
      type: http
      scheme: basic
  parameters:
    Authorization:
      name: authorization
      in: header
      required: true
      schema:
        type: string
        description: API Client
        example: Basic Xdd42...
    AccountIdPath:
      name: account_id
      description: The Dintero merchant account id
      in: path
      required: true
      schema:
        type: string
        pattern: ^[PT]\d{8}
        example: P12345678
        minLength: 9
        maxLength: 9
    ClientTransactionIdPath:
      name: client_transaction_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
        maxLength: 36
        minLength: 36
      description: |
        UUID generated by the client, must be a unique ID per transaction
  schemas:
    ResponseCode:
      type: string
      description: |
        - 1xx — Authorization denied
          - 100 Do Not Honor (General Denial)
          - 101 Expired card
          - 126 Invalid PIN Block
          - 127 Incorrect PIN
      enum:
        - '100'
        - '101'
        - '126'
        - '127'
    TransactionOperationResult:
      type: object
      oneOf:
        - type: object
          description: Operation success
          required:
            - type
            - response_code
            - code
          additionalProperties: false
          properties:
            type:
              type: string
              enum:
                - success
            response_code:
              $ref: '#/components/schemas/ResponseCode'
            code:
              type: string
              description: |
                - **00**: Approved.
                - **08**: Honor With Id.
                - **10**: Partial Approval
                - **85**: Not Declined Valid Transaction
                - **87**: No Cashback Allowed
              enum:
                - '00'
                - '08'
                - '10'
                - '85'
                - '87'
        - type: object
          description: Operation failure
          required:
            - type
            - response_code
            - reason
            - code
            - can_retry
          additionalProperties: false
          properties:
            type:
              type: string
              enum:
                - failure
            reason:
              type: string
            response_code:
              $ref: '#/components/schemas/ResponseCode'
            code:
              type: string
              description: |
                - **01**: Issuer error.
                - **03**: MCC blocked. The MCC is blocked at a product or account level.
                - **04**: Capture card. The merchant must retain the card because fraud is suspected.
                - **05**: Do not honor. This is the default deny code when other deny codes do not apply.
              enum:
                - '01'
                - '03'
                - '04'
                - '05'
            can_retry:
              type: boolean
    CardType:
      type: string
      enum:
        - charge
        - credit
        - debit
        - deferred-debit
        - prepaid
    TerminalOperationData:
      type: object
      required:
        - type
        - amount
        - operation_ref
        - client_operation_ref
        - created_at
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - sale
            - refund
        amount:
          type: number
          description: |
            The amount authorized, note that the amount authorized can
            be lower than requested if the result was **Partial Approval**
          minimum: 1
        operation_ref:
          type: string
          maxLength: 30
        client_operation_ref:
          type: string
          format: uuid
          maxLength: 40
        created_at:
          type: string
          format: date-time
          readOnly: true
        card_last_4:
          type: string
          pattern: ^[0-9]{4}$
          maxLength: 4
          minLength: 4
        expiry_year:
          type: string
          example: 2024
          pattern: ^[0-9]{4}$
          maxLength: 4
          minLength: 4
        expiry_month:
          type: string
          example: 1
          pattern: ^[0-9]{2}$
          maxLength: 2
          minLength: 2
        card_brand:
          type: string
          maxLength: 10
        card_type:
          $ref: '#/components/schemas/CardType'
        payment_account_reference:
          type: string
          description: |
            Payment Account Reference (PAR) is a unique value associated with a
            single PAN and attributed to all tokens associated with that PAN.
        payment_system_type:
          type: string
          enum:
            - card
            - wallet
        network_correlation_id:
          type: string
          description: Reference to the operation, assigned by the card network.
          example: b95b6fa05f68dd9d031ef0c96c225e8e
          maxLength: 32
        network_acquirer_stan:
          type: string
          description: System Trace Audit Number (STAN) is a number Dintero assigns to uniquely identify a transaction on the card network. Present on Mastercard transactions only.
          example: '123456'
          pattern: ^[0-9]{6}$
          maxLength: 6
        network_lifecycle_trace_id:
          type: string
          description: |-
            For Mastercard transactions, this is a reference to the original authorization. The value is assigned to the original authorization, and is present on subsequent incremental authorizations, captures, and reversals.
            For Visa it is the transaction ID assigned by Visa. The transaction ID is the same for some operations, while some get a unique ID.
          example: MCS8WVSXJ
          maxLength: 15
    Authorization:
      type: object
      required:
        - type
        - amount
        - operation_ref
        - client_operation_ref
        - created_at
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - authorization
        amount:
          type: number
          description: |
            The amount authorized, note that the amount authorized can
            be lower than requested if the result was **Partial Approval**
          minimum: 1
        operation_ref:
          type: string
          maxLength: 30
        client_operation_ref:
          type: string
          format: uuid
          maxLength: 40
        created_at:
          type: string
          format: date-time
          readOnly: true
        card_last_4:
          type: string
          pattern: ^[0-9]{4}$
          maxLength: 4
          minLength: 4
        expiry_year:
          type: string
          example: 2024
          pattern: ^[0-9]{4}$
          maxLength: 4
          minLength: 4
        expiry_month:
          type: string
          example: 1
          pattern: ^[0-9]{2}$
          maxLength: 2
          minLength: 2
        card_brand:
          type: string
          maxLength: 10
        card_type:
          $ref: '#/components/schemas/CardType'
        payment_account_reference:
          type: string
          description: |
            Payment Account Reference (PAR) is a unique value associated with a
            single PAN and attributed to all tokens associated with that PAN.
        payment_system_type:
          type: string
          enum:
            - card
            - wallet
        network_correlation_id:
          type: string
          description: Reference to the operation, assigned by the card network.
          example: b95b6fa05f68dd9d031ef0c96c225e8e
          maxLength: 32
        network_acquirer_stan:
          type: string
          description: System Trace Audit Number (STAN) is a number Dintero assigns to uniquely identify a transaction on the card network. Present on Mastercard transactions only.
          example: '123456'
          pattern: ^[0-9]{6}$
          maxLength: 6
        network_lifecycle_trace_id:
          type: string
          description: |-
            For Mastercard transactions, this is a reference to the original authorization. The value is assigned to the original authorization, and is present on subsequent incremental authorizations, captures, and reversals.
            For Visa it is the transaction ID assigned by Visa. The transaction ID is the same for some operations, while some get a unique ID.
          example: MCS8WVSXJ
          maxLength: 15
        final_authorization:
          type: boolean
          description: Indicates if this is the final authorization for the transaction. Always `true` for regular authorization operations (not pre-auth).
    Cancel:
      type: object
      required:
        - type
        - created_at
        - client_operation_ref
        - operation_ref
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - cancel
        created_at:
          type: string
          format: date-time
          readOnly: true
        operation_ref:
          type: string
          maxLength: 30
        client_operation_ref:
          type: string
          format: uuid
          maxLength: 40
        amount:
          type: number
          minimum: 1
        authorization_operation_ref:
          type: string
          maxLength: 30
        authorization_client_operation_ref:
          type: string
          format: uuid
          maxLength: 40
    Capture:
      type: object
      required:
        - type
        - created_at
        - amount
        - client_operation_ref
        - operation_ref
        - authorization_operation_ref
        - authorization_client_operation_ref
        - final_capture
      additionalProperties: false
      properties:
        created_at:
          type: string
          format: date-time
          readOnly: true
        type:
          type: string
          enum:
            - capture
        amount:
          type: number
          minimum: 1
        operation_ref:
          type: string
          maxLength: 30
        client_operation_ref:
          type: string
          format: uuid
          maxLength: 40
        authorization_operation_ref:
          type: string
          maxLength: 30
        authorization_client_operation_ref:
          type: string
          format: uuid
          maxLength: 40
        final_capture:
          type: boolean
          description: Indicates if this is the final capture for the transaction.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            code:
              type: string
              description: The code used to identify the error/warning
            errors:
              type: array
              description: The nested error(s) encountered during validation
              items:
                type: object
            message:
              type: string
              description: The human readable description of the error/warning
    TerminalEntryMode:
      type: string
      description: |
        The method used for PAN entry on the terminal to initiate the
        transaction
      minLength: 4
      maxLength: 18
      enum:
        - contact_chip
        - contactless_chip
        - contact_magstripe
        - contactless_magstripe
        - magstripe_fallback
    AuthorizationOperation:
      type: object
      description: Authorization
      additionalProperties: false
      required:
        - type
        - client_operation_ref
        - terminal_entry_mode
        - final_authorization
      properties:
        type:
          type: string
          maxLength: 13
          enum:
            - authorization
        client_operation_ref:
          type: string
          maxLength: 40
          description: Unique client operation ref for the transaction operation
        terminal_entry_mode:
          $ref: '#/components/schemas/TerminalEntryMode'
        final_authorization:
          type: boolean
        partial_approval_supported:
          description: Allow a partial approval.
          type: boolean
          default: false
    SaleOperation:
      type: object
      description: Authorization
      additionalProperties: false
      required:
        - type
        - client_operation_ref
        - terminal_entry_mode
      properties:
        type:
          type: string
          maxLength: 13
          enum:
            - sale
        client_operation_ref:
          type: string
          maxLength: 40
          description: Unique client operation ref for the transaction operation
        terminal_entry_mode:
          $ref: '#/components/schemas/TerminalEntryMode'
    RefundOperation:
      type: object
      description: Authorization
      additionalProperties: false
      required:
        - type
        - client_operation_ref
        - terminal_entry_mode
      properties:
        type:
          type: string
          maxLength: 13
          enum:
            - refund
        client_operation_ref:
          type: string
          maxLength: 40
          description: Unique client operation ref for the transaction operation
        terminal_entry_mode:
          $ref: '#/components/schemas/TerminalEntryMode'
    TerminalTransactionInput:
      type: object
      required:
        - operation
        - payment
        - payment_instrument
        - merchant
        - terminal
      properties:
        operation:
          type: object
          oneOf:
            - $ref: '#/components/schemas/AuthorizationOperation'
            - $ref: '#/components/schemas/SaleOperation'
            - $ref: '#/components/schemas/RefundOperation'
        payment:
          type: object
          additionalProperties: false
          required:
            - amount
            - currency
          properties:
            amount:
              type: integer
              format: int32
              minimum: 1
            currency:
              type: string
              format: iso-4217
              maxLength: 3
              minLength: 3
              example: NOK
        payment_instrument:
          type: object
          additionalProperties: false
          required:
            - data
          properties:
            pin:
              type: object
              required:
                - ksn
                - bdk_id
                - pin_block_format
                - enc_pin_block
              properties:
                enc_pin_block:
                  type: string
                  format: hex
                  description: |
                    Encrypted PIN block, encrypted using AES-CBC with the session key derived
                    via DUKPT from the provided KSN and BDK. The ciphertext must be hex-encoded.

                    The pin block is a block of data that is used to encapsulate a
                    personal identification number (PIN) during the process.
                    The PIN block format defines the content of the PIN block and
                    how it is processed to retrieve the PIN. A PIN block is composed
                    of the PIN, the length of the PIN, and may contain a subset of the
                    PAN.

                    > It must be sent if the transaction is an online PIN transaction
                    > and must be encrypted with the BDK PIN key shared by Dintero
                    > through the DUKPT protocol.
                  maxLength: 256
                  example: C3A2F9B1D2333E9F
                pin_block_format:
                  type: string
                  maxLength: 5
                  enum:
                    - iso-0
                    - iso-1
                    - iso-4
                ksn:
                  type: string
                  minLength: 20
                  maxLength: 20
                  example: FFFF1111222233E00001
                  description: |
                    Key Serial Number (KSN) used for DUKPT key derivation of the PIN block.
                    Must be provided as a hexadecimal string.

                    - **20-position (10 bytes) Key Serial Number (KSN)**

                    It is required in the DUKPT process to identify which initial key was
                    used to encrypt the information.

                    After reading the pin entered into the POS and sending the pin block,
                    the KSN is incremented by a user-defined amount (usually 1) and then
                    used with the current transaction key to create more future keys.

                    - 3 bytes (6 positions): Issuer Identification Number
                    - 1 byte (2 positions): Customer ID
                    - 1 byte (2 positions): Group ID.
                    - 19 bit: Device ID, its last character must be even
                      (0, 2, 4, 6, 8, A, C, E).
                    - 21 bit: Transaction Counter. This is a 21 bit value. The initial
                      value is all nulls for the initial PIN encryption Key (IPEK).
                bdk_id:
                  type: string
                  example: P12345678-bdk-pin-01
                  minLength: 20
                  maxLength: 20
                  description: |
                    Identifier of the Base Derivation Key (BDK) used to derive the session key
                    for PIN encryption.
            data:
              type: object
              required:
                - ksn
                - bdk_id
                - enc_tlv
              properties:
                enc_tlv:
                  type: string
                  format: hex
                  description: |
                    Encrypted EMV TLV data block, encrypted using AES-CBC with the
                    session key derived via DUKPT from the provided KSN and BDK.

                    The ciphertext must be hex-encoded.

                    It is a field containing encrypted information that comes from the
                    EMV chips of the cards, use tag `57` to include `track_2`data for
                    magstripe entry mode

                    Visa and Mastercard request the sending of certain tags that come
                    from EMV chips.

                    **Tags required by Visa**
                    - `57` Track 2 Equivalent Data
                    - **TBD**

                    **Tags required by Mastercard:**
                    - `57` Track 2 Equivalent Data
                    - `9F26` Application Cryptogram (AC) 
                    - `9F27` Cryptogram Information Data
                    - `9F10` Issuer Application Data (IAD)
                    - `9F37` Unpredictable Number
                    - `9F36` Application Transaction Counter
                    - `95` Terminal Verification Result (TVR) 
                    - `9A` Transaction Date
                    - `9C` Transaction Type
                    - `9F02` Amount Authorized 
                    - `5F2A` Transaction Currency Code
                    - `82` Application Interchange Profile
                    - `9F1A` Terminal Country Code
                    - `9F34` Cardholder Verification Method (CVM) Results
                    - `9F33` Terminal Capabilities (U.S. region only)
                    - `84` Dedicated File Name 
                    - `9F03` Amount Other
                    - `5F34` Application Primary Account Number (PAN) Sequence Number

                    **General tags**
                    - `9F03` Amount Other
                    - `9F27` Cryptogram Information Data
                    - `9C` Transaction Type
                    - `9F02` Amount Authorized 
                    - `9F33` Amount Authorized 
                    - `9F10` Amount Authorized 
                    - `82` Application Interchange Profile
                    - `9F36` Application Transaction Counter
                    - `9F26` Application Cryptogram (AC)
                    - `9A` Transaction Date
                    - `9F1A` Terminal Country Code
                    - `5F2A` Transaction Currency Code
                    - `95` Terminal Verification Result (TVR)
                    - `9F37` Unpredictable Number
                    - `84` Dedicated File Name
                    - `5F34` Application Primary Account Number (PAN) Sequence Number
                    - `57` Track 2 Equivalent Data
                    - `5A` Application Primary Account Number (PAN)
                    - `5F20` Cardholder Name
                    - `50` Application Label
                    - `4F` Application Identifier (AID) – card
                    - `9B` Transaction Status Information
                    - `9F34` Cardholder Verification Method (CVM) Results
                    - `9F06` Application Identifier (AID) – terminal
                    - `9F6E` Form Factor Indicator
                    > Remember to send the tags encoded
                  maxLength: 1000
                  example: 9F2608AABBCCDDEEFF0011229F270180
                ksn:
                  type: string
                  minLength: 20
                  maxLength: 20
                  example: FFFF4444555566E00002
                  description: |
                    Key Serial Number (KSN) used for DUKPT key derivation of the TLV data.
                    Must be provided as a hexadecimal string.
                bdk_id:
                  type: string
                  minLength: 20
                  maxLength: 20
                  example: P12345678-bdk-dat-01
                  description: |
                    Identifier of the Base Derivation Key (BDK) used to derive the session key
                    for TLV data encryption.
        merchant:
          type: object
          additionalProperties: false
          required:
            - merchant_name
            - merchant_category_code
            - merchant_phone_number
            - merchant_address
            - store
          properties:
            merchant_name:
              type: string
              minLength: 1
              maxLength: 150
            merchant_category_code:
              type: string
              pattern: ^\d{1,4}
              maxLength: 4
              minLength: 4
            merchant_phone_number:
              type: string
              pattern: ^\+[1-9]\d{1,14}$
              format: e.164
              description: A phone number in E.164 format
            merchant_address:
              type: object
              required:
                - country_code
              additionalProperties: false
              properties:
                city:
                  type: string
                  maxLength: 50
                country_code:
                  type: string
                  example: 'NO'
                  pattern: ^[A-Z]{2}
                  format: iso3166-1-alpha-2
                line_1:
                  type: string
                  maxLength: 50
                line_2:
                  type: string
                  maxLength: 50
                post_code:
                  type: string
                  maxLength: 16
                state:
                  type: string
                  description: |
                    State, province or other country subdivision
                  format: iso3166-2-alpha-3
            store:
              type: object
              additionalProperties: false
              required:
                - id
                - phone_number
                - address
              properties:
                id:
                  type: string
                  maxLength: 20
                  description: Store's ID
                phone_number:
                  type: string
                  pattern: ^\+[1-9]\d{1,14}$
                  description: A phone number in E.164 format
                  maxLength: 16
                address:
                  type: object
                  additionalProperties: false
                  required:
                    - city
                    - country_code
                    - line_1
                    - post_code
                  properties:
                    city:
                      type: string
                      maxLength: 50
                    country_code:
                      type: string
                      example: 'NO'
                      pattern: ^[A-Z]{2}
                      maxLength: 2
                      format: iso3166-1-alpha-2
                    line_1:
                      type: string
                      maxLength: 50
                    line_2:
                      type: string
                      maxLength: 50
                    line_3:
                      type: string
                      maxLength: 50
                    post_code:
                      type: string
                      maxLength: 16
                    state:
                      type: string
                      maxLength: 3
                      description: |
                        State, province or other country subdivision
                      pattern: ^[A-Z]{3}$
                      format: iso3166-2-alpha-3
        terminal:
          type: object
          additionalProperties: false
          required:
            - id
            - type
            - attended
            - capabilities
          properties:
            id:
              type: string
              maxLength: 20
              description: Terminal's ID
            type:
              type: string
              maxLength: 8
              enum:
                - pos
                - mpos
                - soft_pos
            brand:
              type: string
              maxLength: 100
              description: Terminal brand
            model:
              type: string
              maxLength: 100
              description: Terminal model
            version:
              type: string
              maxLength: 100
              description: Terminal software version
            serial_number:
              type: string
              maxLength: 100
              description: Terminal serial number
            attended:
              type: boolean
            capabilities:
              type: array
              description: |
                The capabilities of the terminal. This can be one or
                multiple, and if more than one is specified it means
                that it is capable of all of those things.
              items:
                type: string
                enum:
                  - contact_chip
                  - contactless_chip
                  - contact_magstripe
                  - contactless_magstripe
                  - offline_enciphered_pin
                  - offline_plaintext_pin
                  - online_pin
                  - signature
                  - key_entry
                  - no_cvm
                  - one_tap
    PreAuthorization:
      type: object
      required:
        - type
        - amount
        - increment_amount
        - operation_ref
        - client_operation_ref
        - created_at
        - final_authorization
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - preAuthorization
        amount:
          type: number
          description: |
            The total amount authorized, note that the amount authorized can
            be lower than requested if the result was **Partial Approval**
          minimum: 1
        increment_amount:
          type: number
          description: |
            The incremental amount authorized on top of the previous authorization(s)
          minimum: 1
        operation_ref:
          type: string
          maxLength: 30
        client_operation_ref:
          type: string
          format: uuid
          maxLength: 40
        created_at:
          type: string
          format: date-time
          readOnly: true
        card_last_4:
          type: string
          pattern: ^[0-9]{4}$
          maxLength: 4
          minLength: 4
        expiry_year:
          type: string
          example: 2024
          pattern: ^[0-9]{4}$
          maxLength: 4
          minLength: 4
        expiry_month:
          type: string
          example: 1
          pattern: ^[0-9]{2}$
          maxLength: 2
          minLength: 2
        card_brand:
          type: string
          maxLength: 10
        card_type:
          $ref: '#/components/schemas/CardType'
        payment_account_reference:
          type: string
          description: |
            Payment Account Reference (PAR) is a unique value associated with a
            single PAN and attributed to all tokens associated with that PAN.
        payment_system_type:
          type: string
          enum:
            - card
            - wallet
        network_correlation_id:
          type: string
          description: Reference to the operation, assigned by the card network.
          example: b95b6fa05f68dd9d031ef0c96c225e8e
          maxLength: 32
        network_acquirer_stan:
          type: string
          description: System Trace Audit Number (STAN) is a number Dintero assigns to uniquely identify a transaction on the card network. Present on Mastercard transactions only.
          example: '123456'
          pattern: ^[0-9]{6}$
          maxLength: 6
        network_lifecycle_trace_id:
          type: string
          description: |-
            For Mastercard transactions, this is a reference to the original authorization. The value is assigned to the original authorization, and is present on subsequent incremental authorizations, captures, and reversals.
            For Visa it is the transaction ID assigned by Visa. The transaction ID is the same for some operations, while some get a unique ID.
          example: MCS8WVSXJ
          maxLength: 15
        final_authorization:
          type: boolean
          description: Indicates if this is the final authorization for the transaction.
    AuthorizationOperationInput:
      type: object
      required:
        - amount
        - client_operation_ref
        - final_authorization
      additionalProperties: false
      properties:
        client_operation_ref:
          type: string
          description: Unique reference for this operation
          maxLength: 40
        amount:
          type: integer
          description: Monetary amount in minor units of currency with all punctuation removed
          example: 12.34 NOK is denoted as 1234
          minimum: 1
        final_authorization:
          type: boolean
    CaptureOperationInput:
      type: object
      required:
        - amount
        - client_operation_ref
        - final_capture
      additionalProperties: false
      properties:
        client_operation_ref:
          type: string
          description: Unique reference for this operation
          maxLength: 40
        amount:
          type: integer
          description: Monetary amount in minor units of currency with all punctuation removed
          example: 12.34 NOK is denoted as 1234
          minimum: 1
        final_capture:
          type: boolean
          description: |
            No more capture operation will be allowed when enabled
    RefundOperationInput:
      type: object
      required:
        - client_operation_ref
        - amount
      additionalProperties: false
      properties:
        client_operation_ref:
          type: string
          description: Unique reference for this operation
          maxLength: 40
        amount:
          type: integer
          description: Monetary amount in minor units of currency with all punctuation removed
          example: 12.34 NOK is denoted as 1234
          minimum: 1
    Refund:
      type: object
      required:
        - type
        - created_at
        - amount
        - operation_ref
        - client_operation_ref
        - created_at
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - refund
        created_at:
          type: string
          format: date-time
          readOnly: true
        amount:
          type: number
          minimum: 1
        operation_ref:
          type: string
          maxLength: 30
        client_operation_ref:
          type: string
          format: uuid
          maxLength: 40
        card_last_4:
          type: string
          pattern: ^[0-9]{4}$
        expiry_year:
          type: string
          example: 2024
          pattern: ^[0-9]{4}$
        expiry_month:
          type: string
          example: 1
          pattern: ^[0-9]{2}$
        card_brand:
          type: string
          maxLength: 10
        card_type:
          $ref: '#/components/schemas/CardType'
        payment_system_type:
          type: string
          enum:
            - card
            - wallet
        network_correlation_id:
          type: string
          description: Reference to the operation, assigned by the card network.
          example: b95b6fa05f68dd9d031ef0c96c225e8e
          maxLength: 32
        network_acquirer_stan:
          type: string
          description: System Trace Audit Number (STAN) is a number Dintero assigns to uniquely identify a transaction on the card network. Present on Mastercard transactions only.
          example: '123456'
          pattern: ^[0-9]{6}$
          maxLength: 6
        network_lifecycle_trace_id:
          type: string
          description: |-
            For Mastercard transactions, this is a reference to the original authorization. The value is assigned to the original authorization, and is present on subsequent incremental authorizations, captures, and reversals.
            For Visa it is the transaction ID assigned by Visa. The transaction ID is the same for some operations, while some get a unique ID.
          example: MCS8WVSXJ
          maxLength: 15
    VoidOperationInput:
      type: object
      required:
        - client_operation_ref
      additionalProperties: false
      properties:
        client_operation_ref:
          type: string
          description: Unique reference for this operation
          maxLength: 40
  responses:
    TerminalTransaction:
      description: Terminal transaction
      content:
        application/json:
          schema:
            additionalProperties: false
            type: object
            required:
              - id
              - client_transaction_id
              - created_at
              - updated_at
              - operations
              - operation_status
            properties:
              id:
                type: string
                format: uuid
              client_transaction_id:
                type: string
                format: uuid
              created_at:
                type: string
                format: date-time
              updated_at:
                type: string
                format: date-time
              operations:
                type: array
                items:
                  type: object
                  required:
                    - result
                    - operation_data
                  additionalProperties: false
                  properties:
                    result:
                      type: object
                      $ref: '#/components/schemas/TransactionOperationResult'
                    operation_data:
                      type: object
                      oneOf:
                        - $ref: '#/components/schemas/TerminalOperationData'
                        - $ref: '#/components/schemas/Authorization'
                        - $ref: '#/components/schemas/Cancel'
                        - $ref: '#/components/schemas/Capture'
              operation_status:
                type: object
                additionalProperties: false
                required:
                  - authorization
                  - cancelled_amount
                  - capture
                  - refund
                  - transaction_amount
                  - pre_authorized_amount
                properties:
                  transaction_amount:
                    type: integer
                    format: int32
                    minimum: 1
                  cancelled_amount:
                    type: integer
                    format: int32
                    minimum: 0
                  pre_authorized_amount:
                    type: integer
                    format: int32
                    minimum: 0
                  authorization:
                    type: object
                    additionalProperties: false
                    required:
                      - amount
                      - remaining
                    properties:
                      amount:
                        type: integer
                        format: int32
                        minimum: 1
                      remaining:
                        type: integer
                        format: int32
                        minimum: 0
                  capture:
                    type: object
                    additionalProperties: false
                    required:
                      - amount
                      - remaining
                    properties:
                      amount:
                        type: integer
                        format: int32
                        minimum: 0
                      remaining:
                        type: integer
                        format: int32
                        minimum: 0
                  refund:
                    type: object
                    additionalProperties: false
                    required:
                      - amount
                      - remaining
                    properties:
                      amount:
                        type: integer
                        format: int32
                        minimum: 0
                      remaining:
                        type: integer
                        format: int32
                        minimum: 0
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TerminalTransactionCreated:
      description: Terminal transaction created
      content:
        application/json:
          schema:
            additionalProperties: false
            type: object
            required:
              - results
            properties:
              results:
                type: array
                minLength: 1
                description: Array of performed operations and results
                items:
                  type: object
                  required:
                    - result
                    - operation_data
                  additionalProperties: false
                  properties:
                    result:
                      $ref: '#/components/schemas/TransactionOperationResult'
                    operation_data:
                      type: object
                      oneOf:
                        - $ref: '#/components/schemas/Authorization'
                        - $ref: '#/components/schemas/PreAuthorization'
                        - $ref: '#/components/schemas/TerminalOperationData'
    TerminalTransactionAuthorized:
      description: Terminal transaction authorization updated
      content:
        application/json:
          schema:
            additionalProperties: false
            type: object
            required:
              - results
            properties:
              results:
                type: array
                minLength: 1
                description: Array of performed operations and results
                items:
                  type: object
                  required:
                    - result
                    - operation_data
                  additionalProperties: false
                  properties:
                    result:
                      type: object
                      $ref: '#/components/schemas/TransactionOperationResult'
                    operation_data:
                      type: object
                      oneOf:
                        - $ref: '#/components/schemas/Authorization'
                        - $ref: '#/components/schemas/PreAuthorization'
    TerminalTransactionCaptured:
      description: Terminal transaction capture created
      content:
        application/json:
          schema:
            additionalProperties: false
            type: object
            required:
              - results
            properties:
              results:
                type: array
                minLength: 1
                description: Array of performed operations and results
                items:
                  type: object
                  required:
                    - result
                    - operation_data
                  additionalProperties: false
                  properties:
                    result:
                      type: object
                      $ref: '#/components/schemas/TransactionOperationResult'
                    operation_data:
                      type: object
                      $ref: '#/components/schemas/Capture'
    TerminalTransactionRefunded:
      description: Terminal transaction refund created
      content:
        application/json:
          schema:
            additionalProperties: false
            type: object
            required:
              - results
            properties:
              results:
                type: array
                minLength: 1
                description: Array of performed operations and results
                items:
                  type: object
                  required:
                    - result
                    - operation_data
                  additionalProperties: false
                  properties:
                    result:
                      type: object
                      $ref: '#/components/schemas/TransactionOperationResult'
                    operation_data:
                      type: object
                      $ref: '#/components/schemas/Refund'
    TerminalTransactionVoided:
      description: Terminal transaction void created
      content:
        application/json:
          schema:
            additionalProperties: false
            type: object
            required:
              - results
            properties:
              results:
                type: array
                minLength: 1
                description: Array of performed operations and results
                items:
                  type: object
                  required:
                    - result
                    - operation_data
                  additionalProperties: false
                  properties:
                    result:
                      type: object
                      $ref: '#/components/schemas/TransactionOperationResult'
                    operation_data:
                      type: object
                      $ref: '#/components/schemas/Cancel'
  requestBodies:
    CreateTerminalTransaction:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TerminalTransactionInput'
    CreateTerminalTransactionAuthorizationOperation:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthorizationOperationInput'
    CreateTerminalTransactionCaptureOperation:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CaptureOperationInput'
    CreateTerminalTransactionRefundOperation:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RefundOperationInput'
    CreateTerminalTransactionVoidOperation:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/VoidOperationInput'
x-tagGroups:
  - name: Terminals
    tags:
      - terminals-transactions
