{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/spendesk/json-schema/spendesk-bank-fee-schema.json",
  "title": "bankFee",
  "description": "When money moves via a card being charged or with a wire-transfer, a Settlement is be created. If there were any fees for this transaction, such as FX fees, they will be recorded as a Bank fee. Each item is an append-only entry: a correction adds an entry for the difference, which can be zero or negative, so the amount of a fee is the sum of the amounts of its entries.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/spendesk-settlements-and-wallet-api-openapi.yml#/components/schemas/bankFee",
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "ID of this bank fee entry. One bank fee can have several entries; group them with bankFeeId."
    },
    "bankFeeId": {
      "type": "string",
      "description": "ID of the bank fee this entry belongs to."
    },
    "kind": {
      "type": "string",
      "enum": [
        "fxFee",
        "atmFee",
        "otherFee"
      ],
      "description": "`fxFee` refers to fees incurred by a payment in a foreign currency, and `atmFee` refers to fees incurred at an atm, e.g. to withdraw cash."
    },
    "settlementId": {
      "type": "string",
      "description": "The ID of the Settlement related to this bank fee."
    },
    "amount": {
      "allOf": [
        {
          "$ref": "#/$defs/priceAmount"
        }
      ],
      "description": "Amount of the fee, always in wallet currency. Expressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY)."
    },
    "currency": {
      "$ref": "#/$defs/currency"
    },
    "chargedAt": {
      "allOf": [
        {
          "$ref": "#/$defs/dateTime"
        }
      ],
      "description": "Date and time of this entry: when the bank fee was incurred for its first entry, and when it was corrected for a correction entry."
    }
  },
  "required": [
    "id",
    "bankFeeId",
    "kind",
    "amount",
    "currency",
    "chargedAt",
    "settlementId"
  ],
  "$defs": {
    "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$",
      "description": "If the payment was made in a foreign currency, this amount will be the one in the payment currency. Three-letter [ISO currency codes](https://www.iso.org/iso-4217-currency-codes.html).",
      "title": "currency"
    },
    "dateTime": {
      "type": "string",
      "format": "date-time",
      "description": "String containing a UTC datetime expressed in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format like `2023-05-12T14:06:40Z`.",
      "title": "dateTime"
    },
    "priceAmount": {
      "type": "number",
      "description": "If the payment was made in a foreign currency, this amount will be the one in the payment currency.\nCan contain a negative value in case of refunds.\nExpressed in smallest units of the currency (e.g. cents for EUR and USD, but yen for JPY).",
      "title": "priceAmount"
    }
  }
}