{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/paytrail/json-schema/paytrail-token-payment-request-schema.json",
  "title": "TokenPaymentRequest",
  "description": "Payment request payload",
  "x-generated": "2026-11-16",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/paytrail-openapi.yml#/components/schemas/TokenPaymentRequest",
  "type": "object",
  "required": [
    "stamp",
    "reference",
    "amount",
    "currency",
    "language",
    "customer",
    "items",
    "redirectUrls",
    "token"
  ],
  "properties": {
    "stamp": {
      "type": "string",
      "maxLength": 200,
      "description": "Merchant specific unique stamp"
    },
    "reference": {
      "type": "string",
      "maxLength": 200,
      "description": "Merchant reference for the payment"
    },
    "amount": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "maximum": 99999999,
      "description": "Total amount of the payment (sum of items), VAT included"
    },
    "currency": {
      "type": "string",
      "enum": [
        "EUR"
      ]
    },
    "language": {
      "type": "string",
      "enum": [
        "FI",
        "SV",
        "EN"
      ],
      "description": "Alpha-2 language code for the payment process"
    },
    "orderId": {
      "type": "string",
      "maxLength": 60,
      "description": "Order ID. Used for eg. Collector payments order ID. If not given, merchant reference is used instead."
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Item"
      }
    },
    "customer": {
      "$ref": "#/$defs/Customer"
    },
    "deliveryAddress": {
      "$ref": "#/$defs/Address"
    },
    "invoicingAddress": {
      "$ref": "#/$defs/Address"
    },
    "redirectUrls": {
      "$ref": "#/$defs/Callbacks"
    },
    "callbackUrls": {
      "$ref": "#/$defs/Callbacks"
    },
    "callbackDelay": {
      "type": "integer",
      "minimum": 0,
      "maximum": 900,
      "description": "Callback delay in seconds. If callback URLs and delay are provided, callbacks will be called after the delay."
    },
    "token": {
      "type": "string",
      "description": "Payment card token received from request to /tokenization/{checkout-tokenization-id}"
    }
  },
  "$defs": {
    "Address": {
      "type": "object",
      "required": [
        "streetAddress",
        "postalCode",
        "city",
        "country"
      ],
      "properties": {
        "streetAddress": {
          "type": "string",
          "maxLength": 200,
          "description": "Street address"
        },
        "postalCode": {
          "type": "string",
          "pattern": "^[0-9A-z -]+$",
          "maxLength": 15,
          "description": "Postal code"
        },
        "city": {
          "type": "string",
          "maxLength": 200,
          "description": "City"
        },
        "county": {
          "type": "string",
          "maxLength": 200,
          "description": "County or top-level geographic subdivision"
        },
        "country": {
          "type": "string",
          "maxLength": 2,
          "description": "Alpha-2 country code"
        }
      }
    },
    "Callbacks": {
      "type": "object",
      "required": [
        "success",
        "cancel"
      ],
      "properties": {
        "success": {
          "type": "string",
          "maxLength": 300,
          "description": "URL to call when payment is succesfully paid.\nCan called multiple times; one must ensure idempotency of this endpoint.\n"
        },
        "cancel": {
          "type": "string",
          "maxLength": 300,
          "description": "URL to call when payment is cancelled and not fulfilled.\nCan called multiple times; one must ensure idempotency of this endpoint.\n"
        }
      }
    },
    "Customer": {
      "type": "object",
      "required": [
        "email"
      ],
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "description": "Customer email address"
        },
        "firstName": {
          "type": "string",
          "description": "Customer first name"
        },
        "lastName": {
          "type": "string",
          "description": "Customer last name"
        },
        "phone": {
          "type": "string",
          "description": "Customer phone number"
        },
        "vatId": {
          "type": "string",
          "description": "Company VAT ID in international format"
        }
      }
    },
    "Item": {
      "type": "object",
      "required": [
        "unitPrice",
        "units",
        "vatPercentage",
        "productCode"
      ],
      "properties": {
        "unitPrice": {
          "type": "integer",
          "format": "int64",
          "minimum": 0,
          "maximum": 99999999,
          "description": "Unit price of an item in currency minor unit, eg. EUR cents. VAT should be included in amount unless `usePricesWithoutVat` is set to true."
        },
        "units": {
          "type": "integer",
          "format": "int64",
          "minimum": 1,
          "maximum": 10000000,
          "description": "Number of units"
        },
        "vatPercentage": {
          "type": "number",
          "format": "float",
          "minimum": 0,
          "maximum": 100,
          "description": "Item VAT percentage"
        },
        "productCode": {
          "type": "string",
          "maxLength": 100,
          "description": "Merchant specific product code"
        },
        "deliveryDate": {
          "type": "string",
          "format": "date",
          "description": "Estimated delivery date"
        },
        "description": {
          "type": "string",
          "maxLength": 1000,
          "description": "Merchant specific product description"
        },
        "category": {
          "type": "string",
          "maxLength": 100,
          "description": "Item product category"
        },
        "merchant": {
          "type": "string",
          "maxLength": 10,
          "description": "Submerchant ID. Required for shop-in-shop payments, leave out from normal payments."
        },
        "stamp": {
          "type": "string",
          "maxLength": 200,
          "description": "Submerchant specific unique stamp. Required for shop-in-shop payments, leave out from normal payments."
        },
        "reference": {
          "type": "string",
          "maxLength": 200,
          "description": "Submerchant reference for the item. Required for shop-in-shop payments, leave out from normal payments."
        },
        "orderId": {
          "type": "string",
          "maxLength": 60,
          "description": "Order ID. Used for eg. Collector payments order ID. If not given, merchant reference is used instead."
        },
        "commission": {
          "type": "object",
          "properties": {
            "merchant": {
              "type": "string",
              "description": "Merchant who get's the commission money. This merchant id can not be deleted, has to be active and\nhas to have same reseller with the merchant who initiated/created the webtrade.\n",
              "maxLength": 10
            },
            "amount": {
              "type": "integer",
              "format": "int32",
              "description": "Commission amount in currency minor unit, eg. EUR cents. VAT not applicable.\nThis field is needed only for specific shop-in-shop payments, usually not needed.\n",
              "maximum": 99999999
            }
          }
        }
      }
    }
  }
}