{
  "openapi": "3.1.0",
  "info": {
    "title": "Nexi POS API",
    "version": "0.0.1",
    "contact": {
      "name": "Partner Integration Team",
      "email": "MSPartnerIntegrations@nexigroup.com"
    }
  },
  "servers": [
    {
      "url": "https://api.npay.eu/pos/v1",
      "description": "Production server"
    }
  ],
  "security": [
    {
      "BasicAuth": []
    }
  ],
  "tags": [
    {
      "name": "Transactions",
      "x-displayName": "Transaction operations",
      "description": "Operations where the main object to be managed is a\n[transaction](#object-transaction).\n\nThe transaction object contains all the information about the current state\nof a single transaction. A transaction is updated multiple times during\nits lifecycle, which means the transaction object is a snapshot of the\ntransaction at a specific point in time.\n\n[Identifiers](docs/concepts/identifiers/) explains the\nprimary transaction identifiers.\n"
    },
    {
      "name": "Terminals",
      "x-displayName": "Terminal operations",
      "description": "Operations where the main object to be managed is a terminal.\n"
    },
    {
      "name": "Events",
      "x-displayName": "Event operations",
      "description": "Operations where the main object to be managed is an [event](#object-event).\nAn event is a notification about a change in the state of a transaction or\nterminal. The event object contains all the information about the event,\nincluding the type of event, the time it occurred, and the data associated\nwith it.\n"
    }
  ],
  "paths": {
    "/transaction/purchase": {
      "post": {
        "operationId": "createPurchaseTransaction",
        "summary": "Create purchase transaction",
        "description": "Starts the processing of a new purchase transaction.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePurchaseTransactionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processing succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transaction": {
                      "description": "Current state of the transaction after creation.\n",
                      "$ref": "#/components/schemas/Transaction"
                    }
                  },
                  "required": [
                    "transaction"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "tags": [
          "Transactions"
        ]
      }
    },
    "/transaction/refund": {
      "post": {
        "operationId": "createRefundTransaction",
        "summary": "Create refund transaction",
        "description": "Starts the processing of a new refund transaction.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRefundTransactionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processing succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transaction": {
                      "description": "Current state of the transaction after creation.\n",
                      "$ref": "#/components/schemas/Transaction"
                    }
                  },
                  "required": [
                    "transaction"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "tags": [
          "Transactions"
        ]
      }
    },
    "/transaction/confirm": {
      "post": {
        "operationId": "confirmTransaction",
        "summary": "Confirm transaction",
        "description": "Confirms a transaction that is awaiting confirmation, see [transactional\nreliability](/docs/concepts/transactional-reliability/). The body of the\nrequest specifies if the transaction is to be confirmed as successful or\nfailed.\n\n* Only transactions that are currently awaiting confirmation as success\ncan be confirmed to success.\n* All transactions can be confirmed as failed.\n\nIf the confirmation as failed arrives for a transaction the server has\nnot seen, a new transaction will be created.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmTransactionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processing succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transaction": {
                      "description": "Current state of the transaction after confirmation.\n",
                      "$ref": "#/components/schemas/Transaction"
                    }
                  },
                  "required": [
                    "transaction"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "tags": [
          "Transactions"
        ]
      }
    },
    "/transaction/get": {
      "post": {
        "operationId": "getTransaction",
        "summary": "Get transaction",
        "description": "Returns the transaction object for a specific transaction. A transaction is\nupdated multiple times during its lifecycle, which means the transaction\nobject is a snapshot of the transaction at a particular point in time\n(specified by the `updated_at` response field).\n\nNote: the freshness of this snapshot is best-effort only. Any flows that\nneed to react to strictly ordered state changes should consider long polling\nfor events instead, see [Events](/docs/concepts/events/#long-polling).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetTransactionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processing succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transaction": {
                      "description": "Current state of the transaction.\n",
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Transaction"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "extra_amounts": {
                              "description": "Amounts that are calculated across multiple transactions, such as the available refundable amount.\n",
                              "type": "object",
                              "properties": {
                                "refundable_amount": {
                                  "description": "The amount that is still refundable for this transaction,\nsee [Refundable amount](/docs/concepts/amounts-and-currency.md/#refundable-amount).\n",
                                  "$ref": "#/components/schemas/Amount"
                                }
                              }
                            }
                          }
                        }
                      ]
                    }
                  },
                  "required": [
                    "transaction"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "tags": [
          "Transactions"
        ]
      }
    },
    "/transaction/continue": {
      "post": {
        "operationId": "continueTransaction",
        "summary": "Continue transaction",
        "description": "Continues a transaction that is currently waiting for the client to send\na continue message, see [Pausing a transaction](/docs/transaction-flow/#pausing-a-transaction).\nThe body of the request can specify an updated `requested_amount` for the\ntransaction. Only transactions that are currently waiting for the client\nto send a continue message can be continued.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContinueTransactionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processing succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transaction": {
                      "description": "Current state of the transaction after continuing.\n",
                      "$ref": "#/components/schemas/Transaction"
                    }
                  },
                  "required": [
                    "transaction"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "tags": [
          "Transactions"
        ]
      }
    },
    "/transaction/unconfirmed": {
      "post": {
        "operationId": "getUnconfirmedTransactions",
        "summary": "Get unconfirmed transactions",
        "description": "Get a list of unconfirmed transactions for a terminal.\n\nThis operation is meant only for development and recovering from lost\ntransaction identifiers. See [transactional\nreliability](/docs/concepts/transactional-reliability/).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetUnconfirmedTransactionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processing succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transactions": {
                      "description": "Current state of the transactions for the specified terminal.\n",
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Transaction"
                      }
                    }
                  },
                  "required": [
                    "transactions"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "tags": [
          "Transactions"
        ]
      }
    },
    "/terminal/status": {
      "post": {
        "operationId": "getTerminalStatus",
        "summary": "Get terminal status",
        "description": "Returns the state of a specific terminal.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetTerminalStatusRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processing succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "description": "Current status of the specified terminal.\n",
                      "$ref": "#/components/schemas/TerminalStatus"
                    }
                  },
                  "required": [
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "tags": [
          "Terminals"
        ]
      }
    },
    "/terminal/print": {
      "post": {
        "operationId": "print",
        "summary": "Print",
        "description": "Prints a message on the receipt printer included in the terminal. The\nrequest returns as soon as the message is successfully queued on the\nterminal and the terminal is ready to receive the next print operation.\nThe actual printing may take some time, or it may fail, which is not\nexposed in this API. If a print operation is sent to a terminal which\ndoes not have a receipt printer, the response will be an error.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrintRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processing succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrintResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "tags": [
          "Terminals"
        ]
      }
    },
    "/event/list": {
      "post": {
        "operationId": "listEvents",
        "summary": "List events",
        "description": "Returns a list of events either according to the given filtering\ncriteria or continuing from an earlier `next_token` value.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ListEventsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processing succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "List of events and continuance token.\n",
                  "$ref": "#/components/schemas/ListEventsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "tags": [
          "Events"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BasicAuth": {
        "type": "http",
        "scheme": "basic",
        "description": "Use the `Authorization` header to pass username and password as base64\nencoded string prefixed with `Basic `. For example, for username `user`\nand password `password` the header would be `Authorization: Basic\ndXNlcjpwYXNzd29yZA==`.\n"
      }
    },
    "schemas": {
      "Currency": {
        "type": "string",
        "example": "EUR",
        "maxLength": 3,
        "minLength": 3,
        "pattern": "^[A-Z]{3}$"
      },
      "ExternalId": {
        "type": "string",
        "example": "123",
        "maxLength": 63,
        "minLength": 1,
        "pattern": "^[\\x21-\\x7E]{1,63}$"
      },
      "Amount": {
        "type": "integer",
        "example": 1000,
        "maximum": 999999999999,
        "minimum": 0
      },
      "TerminalId": {
        "type": "string",
        "example": "t-12345678",
        "maxLength": 63,
        "minLength": 1,
        "pattern": "^[0-9a-zA-Z-]{1,63}$"
      },
      "Metadata": {
        "type": "object",
        "example": {
          "key1": "value1",
          "key2": "value2"
        },
        "additionalProperties": true
      },
      "WaitSeconds": {
        "type": "number",
        "example": 60,
        "default": 25,
        "maximum": 180,
        "minimum": 0
      },
      "Action": {
        "oneOf": [
          {
            "type": "object",
            "title": "Pause",
            "properties": {
              "pause": {
                "description": "Whether to pause the transaction. If true, the transaction will be paused at this point and the client will need to call `/transactions/continue` to resume the transaction processing.\n",
                "type": "boolean",
                "example": true
              }
            }
          }
        ]
      },
      "CreateTransactionOptions": {
        "description": "Modify the behaviour of the server side request and transaction handling.\n",
        "type": "object",
        "properties": {
          "wait_seconds": {
            "description": "How many seconds the server should wait for transaction `state` to change before responding, see [Long polling](/api/#long-polling).\nWill respond immediately if set to `0` or if transaction `state` is not `PROCESSING`.\n",
            "$ref": "#/components/schemas/WaitSeconds",
            "default": 25
          },
          "on_customer_identified": {
            "allOf": [
              {
                "description": "Action to be performed when the customer has been identified by\ntheir payment instrument but before the actual payment is done,\nsee [Pausing a\ntransaction](/docs/transaction-flow/#pausing-a-transaction).\nThe field `customer_identity` is present in the transaction when\nthis action runs, if the customer was identified.\n"
              },
              {
                "$ref": "#/components/schemas/Action"
              }
            ]
          }
        }
      },
      "CreatePurchaseTransactionRequest": {
        "type": "object",
        "properties": {
          "currency": {
            "description": "Currency of the transaction, see [Currency](/docs/concepts/amounts-and-currency.md/#currency).\n",
            "$ref": "#/components/schemas/Currency"
          },
          "external_id": {
            "description": "Client provided identifier for the purchase transaction, see [External id](/docs/concepts/identifiers/#external-id).\n",
            "$ref": "#/components/schemas/ExternalId"
          },
          "requested_amount": {
            "description": "Amount to request from the customer, see [Requested amount](/docs/concepts/amounts-and-currency.md/#requested-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "terminal_id": {
            "description": "Identifier of the terminal that should perform the purchase, see [Terminal ID](/docs/concepts/identifiers/#terminal-id).\n",
            "$ref": "#/components/schemas/TerminalId"
          },
          "cashback_amount": {
            "description": "Amount of cashback that should be given to the customer, see [Cashback amount](/docs/concepts/amounts-and-currency.md/#cashback-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "metadata": {
            "description": "Client provided transaction metadata, see [Metadata](/docs/concepts/metadata/).\n",
            "$ref": "#/components/schemas/Metadata"
          },
          "options": {
            "$ref": "#/components/schemas/CreateTransactionOptions"
          }
        },
        "required": [
          "currency",
          "external_id",
          "requested_amount",
          "terminal_id"
        ]
      },
      "DateTime": {
        "type": "string",
        "format": "date-time",
        "example": "2024-11-07T05:25:55.123Z",
        "maxLength": 24,
        "minLength": 24,
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "TransactionId": {
        "type": "string",
        "example": "txn-12345678-01JPHYGPRMH9QRFS3M69SJW9SH",
        "maxLength": 63,
        "minLength": 1,
        "pattern": "^[0-9a-zA-Z-]{1,63}$"
      },
      "CustomerIdentityLoyaltylink": {
        "description": "Loyaltylink specific customer identity information.\n",
        "type": "object",
        "properties": {
          "card_token": {
            "description": "Loyaltylink specific card token. This is a unique identifier for the card that can be used to identify\nloyalty programs related to it.\n",
            "type": "string",
            "example": "2797aa22047e89e0b39c1626b1be53cf246051b4927f2be7108bf5476edf4937",
            "maxLength": 64,
            "minLength": 64,
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "CustomerIdentityComputop": {
        "description": "Computop specific customer identity information.\n",
        "type": "object",
        "properties": {
          "card_token": {
            "description": "Computop specific card token. This is a unique identifier for the card that can be used to identify\nthe card in future transactions.\n",
            "type": "string",
            "example": "1234567890123456",
            "maxLength": 16,
            "minLength": 16,
            "pattern": "^[0-9]{16}$"
          }
        }
      },
      "CustomerIdentityPar": {
        "description": "Payment account reference (PAR) as provided by the payment instrument. This is a unique identifier for the card that can be used to identify the card in future transactions.\n",
        "type": "object",
        "properties": {
          "par_value": {
            "description": "Payment account reference (PAR) as read from the payment instrument.\n",
            "type": "string",
            "example": "5001ABCDEFGHIJKLMNOPQRSTUVWXY",
            "maxLength": 29,
            "minLength": 29,
            "pattern": "^[0-9A-Z]{29}$"
          }
        }
      },
      "CustomerIdentity": {
        "description": "Customer identity information. If the customer was identified somehow by their\npayment instrument, this information is available in the transaction details.\nThere can be multiple ways utilized at the same time for a single transaction,\nso this object will contain data for the methods that were used for this\ntransaction.\n",
        "type": "object",
        "properties": {
          "loyaltylink": {
            "$ref": "#/components/schemas/CustomerIdentityLoyaltylink"
          },
          "computop": {
            "$ref": "#/components/schemas/CustomerIdentityComputop"
          },
          "par": {
            "$ref": "#/components/schemas/CustomerIdentityPar"
          }
        }
      },
      "DccDetails": {
        "description": "Details of a currency conversion, see [DCC](/docs/concepts/amounts-and-currency.md/#dcc). This\nelement only present if the transaction was processed in a different currency for the customer than the one in\n`currency` field.\n",
        "type": "object",
        "properties": {
          "customer_amount": {
            "description": "Amount that the customer paid in their own currency. This amount is\nin the currency listed in `customer_currency`.\n",
            "$ref": "#/components/schemas/Amount"
          },
          "customer_currency": {
            "description": "Currency that customer paid in, see [Currency](/docs/concepts/amounts-and-currency.md/#currency).\n",
            "$ref": "#/components/schemas/Currency"
          },
          "exchange_rate": {
            "description": "**This field is less precise than `exchange_rate_precise` and should only be used for display purposes. It will be replaced with `exchange_rate_precise` in next API version.**\n\nExchange rate that was used for the DCC transaction. The value is\nexpressed as an integer with exactly four decimal places. That means\nthat a value of `10000` is equal to 1:1 exchange rate.\n",
            "type": "integer",
            "minimum": 0
          },
          "exchange_rate_precise": {
            "description": "Exchange rate that was used for the DCC transaction. The value is expressed as an integer with exactly six decimal places. That means that a value of `1000000` is equal to 1:1 exchange rate.\n",
            "type": "integer",
            "minimum": 0
          },
          "exchange_rate_date": {
            "description": "Date when the exchange rate was obtained from the provider.\n",
            "type": "string",
            "format": "date",
            "example": "2024-11-07",
            "maxLength": 10,
            "minLength": 1,
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "exchange_rate_provider": {
            "description": "Exchange rate provider that was used for the transaction.\n",
            "type": "string",
            "example": "ECB",
            "maxLength": 63,
            "minLength": 1,
            "pattern": "^[\\x20-\\x7E]{1,63}$"
          },
          "markup_fee": {
            "description": "Mark-up fee that was charged for the DCC transaction. The value is\nexpressed as an integer in one hundredth of percents, so `100` means\na mark-up of 1 %.\n",
            "type": "integer",
            "example": 500,
            "maximum": 10000,
            "minimum": 0
          },
          "provider": {
            "description": "DCC provider that was used for the transaction.\n",
            "type": "string",
            "example": "Nets",
            "maxLength": 63,
            "minLength": 1,
            "pattern": "^[\\x20-\\x7E]{1,63}$"
          }
        },
        "required": [
          "customer_amount",
          "customer_currency",
          "exchange_rate",
          "exchange_rate_date",
          "exchange_rate_provider",
          "markup_fee",
          "provider"
        ]
      },
      "CardPaymentMethodDetails": {
        "description": "Details of a card payment method.\n",
        "type": "object",
        "properties": {
          "payment_method": {
            "type": "string",
            "enum": [
              "CARD"
            ]
          },
          "acquirer_reference": {
            "description": "Transaction reference number in format `YYMMDDNNNNNN`. It is set by the terminal at the time the transaction is created and guaranteed to be unique within the terminal. It is transmitted to the acquirer during transaction processing.\n",
            "type": "string",
            "example": "241128113112",
            "maxLength": 12,
            "minLength": 12,
            "pattern": "^[0-9]{12}$"
          },
          "acquirer_terminal_id": {
            "description": "Terminal identifier that is used towards the acquirer. It often\nmatches the transaction terminal ID, but some acquirers have\nspecial rules and limitations that require it to be different.\n",
            "type": "string",
            "example": "A1234567",
            "maxLength": 8,
            "minLength": 8,
            "pattern": "^[0-9A-Z]{8}$"
          },
          "acquirer_timestamp": {
            "description": "Local transaction time in format `YYMMDDHHMMSS`. It is set by\nthe terminal at the time the transaction is created. It is\ntransmitted to the acquirer during transaction processing.\n",
            "type": "string",
            "example": "241128113123",
            "maxLength": 12,
            "minLength": 12,
            "pattern": "^[0-9]{12}$"
          },
          "application_identifier": {
            "description": "Application identifier (AID) of the selected card application.\n",
            "type": "string",
            "maxLength": 32,
            "minLength": 10,
            "pattern": "^[0-9A-F]{10,32}$"
          },
          "application_name": {
            "description": "Name of the selected card application.\n",
            "type": "string",
            "maxLength": 16,
            "minLength": 1,
            "pattern": "^[\\x20-\\x7E]{1,16}$"
          },
          "authorization_code": {
            "description": "Authorization code for the transaction, if received from the acquirer.\n",
            "type": "string",
            "example": "123ABC",
            "maxLength": 6,
            "minLength": 6,
            "pattern": "^[0-9A-Za-z]{6}$"
          },
          "authorization_response_code": {
            "description": "Response code from the acquirer. This is not the same as the\n`result_code` of the transaction. This is a code that is used by the\nacquirer to indicate the result of the authorization. Generally `00`\nmeans success.\n",
            "type": "string",
            "example": "00",
            "maxLength": 2,
            "minLength": 2,
            "pattern": "^[0-9A-Z]{2}$"
          },
          "card_entry_mode": {
            "description": "Card entry mode is the way the card was read by the terminal. This\ndoes not directly tell the form factor of the card, as contactless\nentry mode is used for anything that is read wirelessly, including\nmobile phones and smartwatches.\n",
            "type": "string",
            "enum": [
              "CONTACT_EMV",
              "CONTACTLESS_EMV",
              "MAGNETIC_STRIPE",
              "MANUAL"
            ],
            "x-enumDescriptions": {
              "CONTACT_EMV": "Card was inserted into the terminal and the chip was read",
              "CONTACTLESS_EMV": "Card or phone was tapped on the terminal and the chip was read wirelessly",
              "MAGNETIC_STRIPE": "Card was swiped on the terminal and the magnetic stripe was read",
              "MANUAL": "Card number was typed in manually on the terminal"
            }
          },
          "card_number_customer": {
            "description": "Card primary account number that can be shown to the customer.\nGenerally only the last 4 digits are shown, rest are masked.\n",
            "type": "string",
            "example": "************2454",
            "maxLength": 19,
            "minLength": 13,
            "pattern": "^[0-9*]{13,19}$"
          },
          "card_number_merchant": {
            "description": "Card primary account number that can be shown to the merchant.\nGenerally first 6 and last 4 digits are shown, rest are masked.\n",
            "type": "string",
            "example": "400770******2454",
            "maxLength": 19,
            "minLength": 13,
            "pattern": "^[0-9*]{13,19}$"
          },
          "card_scheme": {
            "description": "Card scheme is the payment network the card is provided by. This is\nnot necessarily the card brand which is printed on top of the card.\nScheme will never be `UNKNOWN` for a successful transaction.\n",
            "type": "string",
            "enum": [
              "AMEX",
              "BANKAXEPT",
              "DANKORT",
              "DINERS_CLUB",
              "GIROCARD",
              "JCB",
              "MASTERCARD",
              "UNIONPAY",
              "VISA",
              "UNKNOWN"
            ]
          },
          "card_sequence_number": {
            "description": "Sequence number for multiple cards with the same card number.\nRequired to be printed on receipts.\n",
            "type": "string",
            "example": "01",
            "maxLength": 2,
            "minLength": 2,
            "pattern": "^[0-9]{2}$"
          },
          "cardholder_verification": {
            "description": "Cardholder verification method (CVM) is the way the cardholder was\nverified to be the owner of the card.\n",
            "type": "string",
            "enum": [
              "NONE",
              "SIGNATURE",
              "PIN",
              "PIN_AND_SIGNATURE",
              "CONSUMER_DEVICE"
            ],
            "x-enumDescriptions": {
              "NONE": "Cardholder has not been verified",
              "SIGNATURE": "Cardholder has given their signature",
              "PIN": "Cardholder typed in a PIN code",
              "PIN_AND_SIGNATURE": "Both `SIGNATURE` and `PIN` were used",
              "CONSUMER_DEVICE": "Cardholder used a consumer device, such as a phone, for verification"
            }
          }
        },
        "required": [
          "payment_method"
        ]
      },
      "PaymentMethodDetails": {
        "description": "Payment method specific information",
        "anyOf": [
          {
            "$ref": "#/components/schemas/CardPaymentMethodDetails"
          }
        ],
        "discriminator": {
          "propertyName": "payment_method",
          "mapping": {
            "CARD": "#/components/schemas/CardPaymentMethodDetails"
          }
        }
      },
      "Code": {
        "type": "string",
        "example": "SUCCESS",
        "maxLength": 255,
        "minLength": 1,
        "pattern": "^[0-9A-Z_]{1,255}$"
      },
      "Description": {
        "type": "string",
        "example": "The amount given was negative.",
        "maxLength": 255,
        "minLength": 1,
        "pattern": "^[\\x20-\\x7E]{1,255}$"
      },
      "Transaction": {
        "title": "Transaction",
        "type": "object",
        "properties": {
          "created_at": {
            "description": "Time when the transaction was created.\n",
            "$ref": "#/components/schemas/DateTime"
          },
          "currency": {
            "description": "Currency of the transaction, see [Currency](/docs/concepts/amounts-and-currency.md/#currency).\n",
            "$ref": "#/components/schemas/Currency"
          },
          "external_id": {
            "description": "Client provided identifier for the transaction, see [External id](/docs/concepts/identifiers/#external-id).\n",
            "$ref": "#/components/schemas/ExternalId"
          },
          "id": {
            "description": "Internal identifier for the transaction, see [Id](/docs/concepts/identifiers/#id).\n",
            "$ref": "#/components/schemas/TransactionId"
          },
          "state": {
            "description": "State of the transaction, see [Transaction flow](/docs/transaction-flow/).\n",
            "type": "string",
            "example": "CONFIRMED",
            "enum": [
              "AWAITING_CONFIRM",
              "AWAITING_CONTINUE",
              "PROCESSING",
              "CONFIRMED",
              "COMMITTED"
            ],
            "x-enumDescriptions": {
              "AWAITING_CONFIRM": "Needs client to send 'confirm' message to continue processing",
              "AWAITING_CONTINUE": "Needs client to send 'continue' message to continue processing",
              "PROCESSING": "Transaction is being processed",
              "CONFIRMED": "Transaction has been confirmed as successful but can be changed to failed",
              "COMMITTED": "Transaction result has been committed and cannot be changed"
            }
          },
          "terminal_id": {
            "description": "Identifier of the terminal that processed the transaction, see [Terminal ID](/docs/concepts/identifiers/#terminal-id).\n",
            "$ref": "#/components/schemas/TerminalId"
          },
          "type": {
            "description": "Transaction type.\n",
            "type": "string",
            "enum": [
              "ACCOUNT_CHECK",
              "PURCHASE",
              "REFUND",
              "UNKNOWN"
            ],
            "x-enumDescriptions": {
              "ACCOUNT_CHECK": "Account check transaction to check if card is valid",
              "PURCHASE": "Purchase transaction to charge customer for goods",
              "REFUND": "Refund transaction to return money to customer",
              "UNKNOWN": "Transaction type not known, or not representable in this enumeration"
            }
          },
          "updated_at": {
            "description": "Time when the transaction was last updated.\n",
            "$ref": "#/components/schemas/DateTime"
          },
          "authorized_amount": {
            "description": "Amount that was authorized by the acquirer, see [Authorized amount](/docs/concepts/amounts-and-currency.md/#authorized-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "captured_amount": {
            "description": "Amount that was captured from customer account, see [Captured amount](/docs/concepts/amounts-and-currency.md/#captured-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "cashback_amount": {
            "description": "Amount of cashback given to the customer, see [Cashback amount](/docs/concepts/amounts-and-currency.md/#cashback-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "confirmed_at": {
            "description": "Time when the transaction was confirmed. Missing if the transaction\nhasn't been confirmed yet.\n",
            "$ref": "#/components/schemas/DateTime"
          },
          "customer_identity": {
            "$ref": "#/components/schemas/CustomerIdentity"
          },
          "customer_not_present": {
            "description": "Indicator that the transaction was done without the customer being present at the terminal.\n",
            "type": "boolean",
            "default": false
          },
          "dcc": {
            "$ref": "#/components/schemas/DccDetails"
          },
          "metadata": {
            "description": "Client provided transaction metadata, see [Metadata](/docs/concepts/metadata/).\n",
            "$ref": "#/components/schemas/Metadata"
          },
          "original_purchase_external_id": {
            "description": "Original purchase transaction's `external_id`, see [External id](/docs/concepts/identifiers/#external-id).\nOnly relevant when `type` is `REFUND`.\n",
            "$ref": "#/components/schemas/ExternalId"
          },
          "original_purchase_id": {
            "description": "Original purchase transaction's `id`, see [Id](/docs/concepts/identifiers/#id).\nOnly relevant when `type` is `REFUND`.\n",
            "$ref": "#/components/schemas/TransactionId"
          },
          "original_purchase_terminal_id": {
            "description": "Original purchase transaction's `terminal_id`, see [Terminal ID](/docs/concepts/identifiers/#terminal-id).\nOnly relevant when `type` is `REFUND`.\n",
            "$ref": "#/components/schemas/TerminalId"
          },
          "payment_method_details": {
            "$ref": "#/components/schemas/PaymentMethodDetails"
          },
          "receipt_details_customer": {
            "description": "Customer receipt details, see [Receipt](/docs/concepts/receipts/). This is the information\nthat must be printed on the customer receipt.\n",
            "type": "string",
            "example": "CARD:************0010\nAPP: CREDITO DE VISA\nAID: A0000000031010\nMODE:ICC/PIN   SEQ: 01\nAUTH:A1B2C3    RC:  00\nTIME:250629115005\nR:250629197805-87251720\n",
            "maxLength": 1023,
            "minLength": 1,
            "pattern": "^([\\x20-\\x7E]{0,32}\\n){1,31}$"
          },
          "receipt_details_merchant": {
            "description": "Merchant receipt details, see [Receipt](/docs/concepts/receipts/). This is the information\nthat must be printed on the merchant receipt.\n",
            "type": "string",
            "example": "CARD:************0010\nAPP: CREDITO DE VISA\nAID: A0000000031010\nMODE:ICC/PIN   SEQ: 01\nAUTH:A1B2C3    RC:  00\nTIME:250629115005\nR:250629197805-87251720\n",
            "maxLength": 1023,
            "minLength": 1,
            "pattern": "^([\\x20-\\x7E]{0,32}\\n){1,31}$"
          },
          "reference": {
            "description": "Unique reference number for the transaction.\n",
            "type": "string",
            "example": "250404123456-01234567",
            "maxLength": 63,
            "minLength": 1,
            "pattern": "^[0-9-]{1,63}$"
          },
          "requested_amount": {
            "description": "Amount that was requested for the transaction, see [Requested amount](/docs/concepts/amounts-and-currency.md/#requested-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "result_code": {
            "description": "Result of the transaction, see [Results and errors](/docs/results-and-errors/).\n",
            "$ref": "#/components/schemas/Code"
          },
          "result_description": {
            "description": "English language transaction result description for logs and\nadministrative interfaces. It should not be shown to customer and\nmight be too technical to be useful for a cashier.\n",
            "$ref": "#/components/schemas/Description"
          },
          "surcharge_amount": {
            "description": "Amount of surcharge that was added to the transaction, see [Surcharge amount](/docs/concepts/amounts-and-currency.md/#surcharge-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "tip_amount": {
            "description": "Amount of tip that was added to the transaction, see [Tip amount](/docs/concepts/amounts-and-currency.md/#tip-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "total_amount": {
            "description": "Current total amount for transaction, see [Total amount](/docs/concepts/amounts-and-currency.md/#total-amount)\n",
            "$ref": "#/components/schemas/Amount"
          }
        },
        "required": [
          "created_at",
          "external_id",
          "id",
          "state",
          "terminal_id",
          "type",
          "updated_at"
        ],
        "x-tags": [
          "Transactions"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "description": "Error code, see [Results and errors](/docs/results-and-errors/).\n",
            "type": "string",
            "example": "BAD_REQUEST",
            "maxLength": 63,
            "minLength": 1
          },
          "description": {
            "description": "Human readable description of error, see [Results and errors](/docs/results-and-errors/).\n",
            "type": "string",
            "example": "The amount given was negative.",
            "maxLength": 255,
            "minLength": 1
          }
        },
        "required": [
          "code",
          "description"
        ]
      },
      "ErrorResponse": {
        "description": "Request processing failed. The response contains an error object\nwith more information about the failure. Error response does not\nnecessarily mean that no changes were made.\n",
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        },
        "required": [
          "error"
        ]
      },
      "CreateRefundTransactionRequest": {
        "type": "object",
        "properties": {
          "currency": {
            "description": "Currency of the transaction, see [Currency](/docs/concepts/amounts-and-currency.md/#currency).\n",
            "$ref": "#/components/schemas/Currency"
          },
          "customer_not_present": {
            "description": "Whether the customer is present at the terminal during the refund\ntransaction. If the customer is present and the refund refers to an\noriginal purchase, they will be asked to present the same payment\ninstrument that was used for the original purchase, and the refund\nwill be authorized.\n",
            "type": "boolean",
            "default": false
          },
          "external_id": {
            "description": "Client provided identifier for the refund transaction, see [External id](/docs/concepts/identifiers/#external-id).\n",
            "$ref": "#/components/schemas/ExternalId"
          },
          "requested_amount": {
            "description": "Amount that should be refunded from the customer, see [Requested amount](/docs/concepts/amounts-and-currency.md/#requested-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "terminal_id": {
            "description": "Identifier of the terminal that should perform the refund, see [Terminal ID](/docs/concepts/identifiers/#terminal-id).\n",
            "$ref": "#/components/schemas/TerminalId"
          },
          "metadata": {
            "description": "Client provided transaction metadata, see [Metadata](/docs/concepts/metadata/).\n",
            "$ref": "#/components/schemas/Metadata"
          },
          "options": {
            "$ref": "#/components/schemas/CreateTransactionOptions"
          },
          "original_purchase_external_id": {
            "description": "Original purchase transaction's `external_id`, see [External id](/docs/concepts/identifiers/#external-id).\n",
            "$ref": "#/components/schemas/ExternalId"
          },
          "original_purchase_terminal_id": {
            "description": "Original purchase transaction's `terminal_id`, see [Terminal ID](/docs/concepts/identifiers/#terminal-id).\n",
            "$ref": "#/components/schemas/TerminalId"
          }
        },
        "required": [
          "currency",
          "external_id",
          "requested_amount",
          "terminal_id"
        ]
      },
      "ConfirmTransactionOptions": {
        "description": "Modify the behaviour of the server side request and transaction handling.\n",
        "type": "object",
        "properties": {
          "commit_window_seconds": {
            "description": "Grace period during which a transaction which is confirmed as successful can be re-confirmed as failed before it is automatically committed.\n",
            "type": "integer",
            "example": 60,
            "default": 3600,
            "minimum": 0,
            "maximum": 3600
          }
        }
      },
      "ConfirmTransactionRequest": {
        "type": "object",
        "properties": {
          "external_id": {
            "description": "Client provided identifier for the transaction that should be confirmed, see [External id](/docs/concepts/identifiers/#external-id).\n",
            "$ref": "#/components/schemas/ExternalId"
          },
          "result_code": {
            "description": "Error code, see [Results and errors](/docs/results-and-errors/).\n",
            "$ref": "#/components/schemas/Code"
          },
          "result_description": {
            "description": "Human readable description, only relevant if `result_code` is not `SUCCESS`.\n",
            "$ref": "#/components/schemas/Description"
          },
          "terminal_id": {
            "description": "Identifier of the terminal of the transaction that should be confirmed, see [Terminal ID](/docs/concepts/identifiers/#terminal-id).\n",
            "$ref": "#/components/schemas/TerminalId"
          },
          "captured_amount": {
            "description": "Amount to capture from customer account when doing partial purchase, see [Captured amount](/docs/concepts/amounts-and-currency.md/#captured-amount).\n",
            "$ref": "#/components/schemas/Amount"
          },
          "metadata": {
            "description": "Client provided transaction metadata, see [Metadata](/docs/concepts/metadata/). Will be\nmerged with any metadata transaction already has.\n",
            "$ref": "#/components/schemas/Metadata"
          },
          "options": {
            "$ref": "#/components/schemas/ConfirmTransactionOptions"
          }
        },
        "required": [
          "external_id",
          "result_code",
          "terminal_id"
        ]
      },
      "GetTransactionRequest": {
        "type": "object",
        "properties": {
          "external_id": {
            "description": "External id of the transaction, see [External id](/docs/concepts/identifiers/#external-id).\n",
            "$ref": "#/components/schemas/ExternalId"
          },
          "terminal_id": {
            "description": "Terminal ID of the transaction, see [Terminal ID](/docs/concepts/identifiers/#terminal-id).\n",
            "$ref": "#/components/schemas/TerminalId"
          },
          "options": {
            "description": "Modify the behaviour of the server side request handling.\n",
            "type": "object",
            "properties": {
              "extra_amounts": {
                "description": "Defines whether the response should include the `extra_amounts` object, which contains amounts\nthat are calculated across multiple transactions.\n",
                "type": "boolean",
                "default": false
              },
              "wait_seconds": {
                "description": "How many seconds the server should wait for transaction `state` to change before responding, see [Long polling](/api/#long-polling).\nWill respond immediately if set to `0` or if transaction `state` is not `PROCESSING`.\n",
                "$ref": "#/components/schemas/WaitSeconds",
                "default": 25
              }
            }
          }
        },
        "required": [
          "external_id",
          "terminal_id"
        ]
      },
      "ContinueTransactionOptions": {
        "description": "Modify the behaviour of the server side request handling.\n",
        "type": "object",
        "properties": {
          "wait_seconds": {
            "description": "How many seconds the server should wait for transaction `state` to change before responding, see [Long polling](/api/#long-polling).\nWill respond immediately if set to `0` or if transaction `state` is not `PROCESSING`.\n",
            "$ref": "#/components/schemas/WaitSeconds",
            "default": 25
          }
        }
      },
      "ContinueTransactionRequest": {
        "type": "object",
        "properties": {
          "external_id": {
            "description": "Client provided identifier for the transaction that should be continued, see [External id](/docs/concepts/identifiers/#external-id).\n",
            "$ref": "#/components/schemas/ExternalId"
          },
          "terminal_id": {
            "description": "Identifier of the terminal of the transaction that should be continued, see [Terminal ID](/docs/concepts/identifiers/#terminal-id).\n",
            "$ref": "#/components/schemas/TerminalId"
          },
          "metadata": {
            "description": "Client provided transaction metadata, see [Metadata](/docs/concepts/metadata/). Will be\nmerged with any metadata transaction already has.\n",
            "$ref": "#/components/schemas/Metadata"
          },
          "requested_amount": {
            "description": "Override the requested amount of the transaction, changing the amount that the transaction is going to be\nprocessed with.\n",
            "$ref": "#/components/schemas/Amount"
          },
          "options": {
            "$ref": "#/components/schemas/ContinueTransactionOptions"
          }
        },
        "required": [
          "external_id",
          "terminal_id"
        ]
      },
      "GetUnconfirmedTransactionsRequest": {
        "type": "object",
        "properties": {
          "terminal_id": {
            "description": "Identifier of the terminal for which to list the unconfirmed transactions, see [Terminal ID](/docs/concepts/identifiers/#terminal-id).\n",
            "$ref": "#/components/schemas/TerminalId"
          }
        },
        "required": [
          "terminal_id"
        ]
      },
      "GetTerminalStatusRequest": {
        "type": "object",
        "properties": {
          "terminal_id": {
            "$ref": "#/components/schemas/TerminalId"
          }
        },
        "required": [
          "terminal_id"
        ]
      },
      "TerminalStatus": {
        "type": "object",
        "properties": {
          "connected": {
            "description": "Whether the terminal is connected to the server.\n",
            "type": "boolean",
            "example": true
          },
          "terminal_id": {
            "description": "The terminal ID.\n",
            "$ref": "#/components/schemas/TerminalId"
          },
          "transaction_state": {
            "description": "The current state of the terminal regarding transactions.\n\n| Value | Description |\n| --- | --- |\n| `AWAITING_CONTINUE` | Terminal is waiting for client to send 'continue' message |\n| `BUSY` | Terminal is not ready to process transactions |\n| `PROCESSING` | Terminal is processing a transaction |\n| `READY` | Terminal is ready to process a new transaction |\n",
            "type": "string",
            "example": "PROCESSING",
            "enum": [
              "AWAITING_CONTINUE",
              "BUSY",
              "PROCESSING",
              "READY"
            ]
          },
          "updated_at": {
            "description": "When any of the fields last changed.\n",
            "$ref": "#/components/schemas/DateTime"
          },
          "battery_charging": {
            "description": "Whether the terminal is currently charging the battery. Only available for terminals that support this\nfeature.\n",
            "type": "boolean"
          },
          "battery_percentage": {
            "description": "How much charge is remaining on the terminal's battery. Only available for terminals that support this\nfeature.\n",
            "type": "number",
            "example": 94,
            "maximum": 100,
            "minimum": 0
          },
          "plugged_in": {
            "description": "Whether the terminals is currently plugged into a power source. Only available for terminals that support this\nfeature.\n",
            "type": "boolean"
          },
          "screen_message": {
            "description": "Human readable description of what is currently shown on the terminal screen. The messages may change both\nin content and language at any time, and as such they MUST NOT be parsed programmatically, e.g. to detect\ntransaction state as any such logic would be fragile.\n",
            "type": "string",
            "example": "Please insert card",
            "maxLength": 255,
            "minLength": 1
          }
        },
        "required": [
          "terminal_id",
          "updated_at"
        ]
      },
      "PrintRequest": {
        "type": "object",
        "properties": {
          "contents": {
            "description": "Data as a base64 encoded string. Decoded contents must match given format type.\n",
            "type": "string",
            "example": "iVBORw0KGgoAAAANSUhEUgAAAW0AAADICAIAAACsxSecAAAACXBIWXMAAA\nsTAAALEwEAmpwYAAAAB3RJTUUH3woPBx8Rn8o0RAAAABl0RVh0Q29tbWVudABDcmVhd\nGVkIHdpdGggR0lNUFeBDhcAAAHUSURBVHja7dSxDQAgDAPBhP13NiOkQEJC3NWuXHwV\nAAAAAAAAAAAAAAAAAAAA8KoeF0ncBF9noodQLB8Bh3QE0BFARwAdAXQEQEcAHQF0BNA\nRAB0BdATQEUBHAHQE0BFARwAdAdARQEcAHQF0BEBHAB0BdATQEQAdAXQE0BFARwB0BN\nARQEcAHQHQEUBHAB0BdARARwAdAXQE0BEAHQF0BNARQEcAdATQEUBHAB0B0BFARwAdA\nXQEQEcAHQF0BNARAB0BdATQEUBHAHQE0BFARwAdAdARQEcAHQF0BEBHAB0BdATQEQAd\nAXQE0BFARwB0BNARQEcAHQHQEUBHAB0BdARARwAdAXQE0BEAHQF0BNARQEcAdATQEUB\nHAB0B0BFARwAdAXQEQEcAHQF0BNARAB0BdATQEUBHAHQE0BFARwAdAdARQEcAHQF0BE\nBHAB0BdATQEQAdAXQE0BFARwB0BNARQEcAHQHQEUBHAB0BdATQEQAdAXQE0BFARwB0B\nNARQEcAHQHQEUBHAB0BdARARwAdAXQE0BEAHQF0BNARQEcAdATQEUBHAB0B0BFARwAd\nAXQEQEcAHQF0BNARAB0BdAQAAAAAAAAAAAAAAAAAAAAAuGMDAjUEVLwTKcgAAAAASUV\nORK5CYII=\n",
            "maxLength": 262143,
            "minLength": 1
          },
          "format": {
            "description": "Format of the content.\n",
            "type": "string",
            "example": "PNG",
            "enum": [
              "PNG"
            ]
          },
          "terminal_id": {
            "$ref": "#/components/schemas/TerminalId"
          },
          "continue": {
            "description": "Longer prints may be done with several calls, with `continue` set to `true` on all but last fragment.\n",
            "type": "boolean",
            "default": false
          }
        },
        "required": [
          "contents",
          "format",
          "terminal_id"
        ]
      },
      "PrintResponse": {
        "type": "object",
        "properties": {
          "queued": {
            "description": "Whether the print request was queued for processing. Currently\n`true` for all print requests as they are processed asynchronously.\n",
            "type": "boolean",
            "example": true
          }
        },
        "required": [
          "queued"
        ]
      },
      "ListEventsOptions": {
        "type": "object",
        "properties": {
          "limit": {
            "description": "Maximum number of events to return.\n",
            "type": "integer",
            "example": 10,
            "default": 100
          },
          "wait_seconds": {
            "description": "If there are no events available, wait for this many seconds before returning an empty list.\n",
            "$ref": "#/components/schemas/WaitSeconds",
            "default": 0
          }
        }
      },
      "EventDateTime": {
        "type": "string",
        "format": "date-time",
        "example": "2024-11-07T05:25:55.123001Z",
        "maxLength": 27,
        "minLength": 20,
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3}\\d{0,3})?Z$"
      },
      "EventFilterPredicateDate": {
        "type": "object",
        "properties": {
          "lt": {
            "description": "Less than date.\n",
            "$ref": "#/components/schemas/EventDateTime"
          },
          "le": {
            "description": "Less than or equal to date.\n",
            "$ref": "#/components/schemas/EventDateTime"
          },
          "gt": {
            "description": "Greater than date.\n",
            "$ref": "#/components/schemas/EventDateTime"
          },
          "ge": {
            "description": "Greater than or equal to date.\n",
            "$ref": "#/components/schemas/EventDateTime"
          }
        }
      },
      "EventType": {
        "type": "string",
        "enum": [
          "eu.npay.api.pos.v0.Transaction",
          "eu.npay.api.pos.v0.TerminalStatus"
        ]
      },
      "EventFilterPredicateType": {
        "type": "object",
        "properties": {
          "eq": {
            "description": "Equal to event type.\n",
            "$ref": "#/components/schemas/EventType"
          },
          "in": {
            "description": "Equal to any of the types.\n",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          }
        }
      },
      "CohortId": {
        "type": "string",
        "example": "cohort-511",
        "maxLength": 63,
        "minLength": 1,
        "pattern": "^[0-9a-zA-Z-]{1,63}$"
      },
      "EventFilterPredicateId": {
        "type": "object",
        "properties": {
          "eq": {
            "description": "Equal to identifier.\n",
            "anyOf": [
              {
                "$ref": "#/components/schemas/TerminalId"
              },
              {
                "$ref": "#/components/schemas/CohortId"
              }
            ]
          }
        }
      },
      "EventFilter": {
        "type": "object",
        "properties": {
          "time": {
            "$ref": "#/components/schemas/EventFilterPredicateDate"
          },
          "type": {
            "$ref": "#/components/schemas/EventFilterPredicateType"
          },
          "subject": {
            "$ref": "#/components/schemas/EventFilterPredicateId"
          }
        },
        "required": [
          "subject"
        ]
      },
      "ListEventsOptionsWithFilter": {
        "description": "List events based on a filter.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEventsOptions"
          },
          {
            "type": "object",
            "properties": {
              "filter": {
                "description": "Filter for events.\n",
                "$ref": "#/components/schemas/EventFilter"
              }
            },
            "required": [
              "filter"
            ]
          }
        ]
      },
      "NextToken": {
        "type": "string",
        "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
        "maxLength": 1023,
        "minLength": 1,
        "pattern": "^[\\x20-\\x7E]{1,1023}$"
      },
      "ListEventsOptionsWithNextToken": {
        "description": "List events based on a next token.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/ListEventsOptions"
          },
          {
            "type": "object",
            "properties": {
              "next_token": {
                "description": "Token for the next page of results.\n",
                "$ref": "#/components/schemas/NextToken"
              }
            },
            "required": [
              "next_token"
            ]
          }
        ]
      },
      "ListEventsRequest": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ListEventsOptionsWithFilter"
          },
          {
            "$ref": "#/components/schemas/ListEventsOptionsWithNextToken"
          }
        ]
      },
      "EventId": {
        "type": "string",
        "example": "evt-01JPHYGPRMH9QRFS3M69SJW9SH",
        "maxLength": 63,
        "minLength": 1,
        "pattern": "^[0-9a-zA-Z-]{1,63}$"
      },
      "BaseEvent": {
        "type": "object",
        "properties": {
          "id": {
            "description": "Unique identifier for the event.\n",
            "$ref": "#/components/schemas/EventId"
          },
          "source": {
            "description": "Source of the event, the base URL of the API.\n",
            "type": "string",
            "format": "uri-reference",
            "enum": [
              "https://api.npay.eu/pos/"
            ]
          },
          "specversion": {
            "description": "CloudEvents specification version.\n",
            "type": "string",
            "enum": [
              "1.0"
            ]
          },
          "datacontenttype": {
            "description": "Content type of the data. Will not be sent if it is `application/json`.\n",
            "type": "string",
            "example": "application/json",
            "minLength": 1
          },
          "dataschema": {
            "description": "Schema of the data. Will not be sent by the API.\n",
            "type": "string",
            "format": "uri-reference",
            "example": "https://example.com/schema",
            "minLength": 1
          },
          "subject": {
            "description": "For which entity the event was recorded. Typically the terminal ID but can also be the id of a cohort of terminals. See [Subject](/docs/concepts/events/#subject).\n",
            "anyOf": [
              {
                "$ref": "#/components/schemas/TerminalId"
              },
              {
                "$ref": "#/components/schemas/CohortId"
              }
            ]
          },
          "time": {
            "description": "Timestamp of when the event was recorded (time of occurrence depends on the event type).\n",
            "$ref": "#/components/schemas/EventDateTime"
          }
        },
        "required": [
          "id",
          "source",
          "specversion"
        ]
      },
      "TransactionEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEvent"
          },
          {
            "description": "Event containing transaction state snapshot.\n",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "eu.npay.api.pos.v0.Transaction"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/Transaction"
              }
            },
            "required": [
              "type",
              "data"
            ]
          }
        ]
      },
      "TerminalStatusEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEvent"
          },
          {
            "description": "Event containing terminal status snapshot.\n",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "eu.npay.api.pos.v0.TerminalStatus"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/TerminalStatus"
              }
            },
            "required": [
              "type",
              "data"
            ]
          }
        ]
      },
      "Event": {
        "title": "Event",
        "anyOf": [
          {
            "$ref": "#/components/schemas/TransactionEvent"
          },
          {
            "$ref": "#/components/schemas/TerminalStatusEvent"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "eu.npay.api.pos.v0.Transaction": "#/components/schemas/TransactionEvent",
            "eu.npay.api.pos.v0.TerminalStatus": "#/components/schemas/TerminalStatusEvent"
          }
        },
        "x-tags": [
          "Events"
        ]
      },
      "ListEventsResponse": {
        "type": "object",
        "properties": {
          "events": {
            "description": "List of events.\n",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            }
          },
          "next_token": {
            "description": "Token for the next page of results. Token will expire after 5 minutes.\n",
            "$ref": "#/components/schemas/NextToken"
          }
        },
        "required": [
          "next_token"
        ]
      }
    }
  },
  "x-tagGroups": [
    {
      "name": "API operations",
      "tags": [
        "Transactions",
        "Terminals",
        "Events"
      ]
    }
  ]
}