{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cm-com/json-schema/cm-com-create-checkout-2-schema.json",
  "title": "CreateCheckout-2",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cm-com-checkout-api-openapi.yml#/components/schemas/CreateCheckout-2",
  "allOf": [
    {
      "$ref": "#/$defs/TransactionWithoutOrderId"
    },
    {
      "type": "object",
      "required": [
        "status",
        "action",
        "expiresAt",
        "merchantOrderReference"
      ],
      "properties": {
        "merchantOrderReference": {
          "$ref": "#/$defs/MerchantOrderReference"
        },
        "consumer": {
          "$ref": "#/$defs/CheckoutConsumer"
        },
        "status": {
          "description": "The status of the transaction.",
          "oneOf": [
            {
              "$ref": "#/$defs/StatusOpen"
            },
            {
              "$ref": "#/$defs/StatusSuccess"
            },
            {
              "$ref": "#/$defs/StatusCancelled"
            },
            {
              "$ref": "#/$defs/StatusExpired"
            },
            {
              "$ref": "#/$defs/StatusFailure"
            },
            {
              "$ref": "#/$defs/StatusAuthorized"
            },
            {
              "$ref": "#/$defs/StatusPending"
            }
          ]
        },
        "action": {
          "type": "object",
          "description": "Next action to be performed by merchant (or consumer) to complete the payment.",
          "properties": {
            "redirect": {
              "$ref": "#/$defs/RedirectAction"
            },
            "qrcode": {
              "$ref": "#/$defs/CheckoutQRCodeAction"
            }
          }
        },
        "paymentMethods": {
          "$ref": "#/$defs/PaymentMethods"
        },
        "orderItems": {
          "$ref": "#/$defs/OrderItems"
        },
        "maxRetries": {
          "$ref": "#/$defs/MaxRetries"
        },
        "refunds": {
          "$ref": "#/$defs/Refunds"
        }
      }
    }
  ],
  "$defs": {
    "AddressWithStateAndAdditionalData": {
      "allOf": [
        {
          "$ref": "#/$defs/AddressWithoutMandatoryCountry"
        },
        {
          "type": "object",
          "properties": {
            "state": {
              "description": "The state or province of the consumer's billing address associated with the card used for this purchase. The value must be the country subdivision code (e.g., 'NH') or the official state/province name (e.g., 'Noord Holland') as defined in ISO 3166-2.",
              "type": "string",
              "maxLength": 40
            },
            "additionalData": {
              "description": "The consumers house number addition.",
              "type": "string",
              "maxLength": 35
            }
          }
        }
      ]
    },
    "AddressWithoutMandatoryCountry": {
      "type": "object",
      "description": "The consumers address.",
      "properties": {
        "street": {
          "description": "The consumers street name.",
          "type": "string",
          "maxLength": 100
        },
        "houseNumber": {
          "description": "The consumers house number.",
          "type": "string",
          "maxLength": 35
        },
        "postalCode": {
          "description": "The consumers postal code.",
          "type": "string",
          "maxLength": 35
        },
        "city": {
          "description": "The consumers city.",
          "type": "string",
          "maxLength": 35
        },
        "countryCode": {
          "$ref": "#/$defs/Country"
        }
      }
    },
    "Amount": {
      "description": "Denomination in the smallest currency subunit, as for example euro cents.",
      "type": "integer",
      "minimum": 1,
      "maximum": 99999999
    },
    "BaseWebhook": {
      "type": "object",
      "description": "A single webhook object consists out of an URL to which we need to send the occurred event together with the event that needs to trigger the webhook call.",
      "required": [
        "url",
        "events"
      ],
      "properties": {
        "url": {
          "description": "The URL the request must be send to.",
          "type": "string",
          "format": "url"
        },
        "events": {
          "description": "Type of events that will trigger a webhook.",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        }
      }
    },
    "CheckoutConsumer": {
      "allOf": [
        {
          "$ref": "#/$defs/Consumer"
        },
        {
          "type": "object",
          "properties": {
            "givenName": {
              "type": "string",
              "maxLength": 35,
              "description": "First name of the consumer."
            },
            "middleName": {
              "type": "string",
              "maxLength": 35,
              "description": "Middle name of the consumer."
            },
            "familyName": {
              "type": "string",
              "maxLength": 35,
              "description": "Last name of the consumer."
            },
            "address": {
              "$ref": "#/$defs/AddressWithStateAndAdditionalData"
            }
          }
        }
      ]
    },
    "CheckoutQRCodeAction": {
      "type": "object",
      "required": [
        "url"
      ],
      "description": "Action to be performed by the consumer to complete the payment by scanning a QR code that leads to the same hosted checkout session as the redirect action.",
      "properties": {
        "url": {
          "description": "URL to a QR code image encoding the hosted checkout session URL, to be scanned by the consumer. Append a `.png`, `.jpg`, or `.svg` extension to select the image output format; if omitted or unrecognized, `png` is returned.",
          "type": "string",
          "format": "url"
        }
      }
    },
    "Consumer": {
      "allOf": [
        {
          "$ref": "#/$defs/GenderlessConsumer"
        },
        {
          "type": "object",
          "properties": {
            "gender": {
              "$ref": "#/$defs/Gender"
            }
          }
        }
      ]
    },
    "Country": {
      "description": "Country of the consumer (ISO-3166)",
      "type": "string",
      "minLength": 2,
      "maxLength": 2
    },
    "Currency": {
      "description": "ISO 4217 currency code.",
      "type": "string",
      "minLength": 3,
      "maxLength": 3,
      "default": "EUR"
    },
    "Datetime": {
      "type": "string",
      "format": "date-time",
      "minLength": 20,
      "description": "ISO 8601 date and time."
    },
    "Description": {
      "description": "Description of the underlying value or reason of the payment.",
      "type": "string",
      "maxLength": 255
    },
    "Email": {
      "description": "The email address of the consumer.",
      "type": "string",
      "format": "email"
    },
    "FinalStatusEvent": {
      "description": "* `FINALSTATUS` - This value is deprecated and shouldn't be used anymore. Use `STATUS_CHANGE` instead.\n",
      "type": "string",
      "enum": [
        "FINALSTATUS"
      ]
    },
    "Gender": {
      "description": "The consumers gender.",
      "type": "string",
      "format": "enum",
      "enum": [
        "m",
        "f",
        "null"
      ],
      "default": null
    },
    "GenderlessConsumer": {
      "type": "object",
      "properties": {
        "email": {
          "$ref": "#/$defs/Email"
        },
        "phone": {
          "$ref": "#/$defs/Phone"
        },
        "dateOfBirth": {
          "type": "string",
          "format": "date",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "description": "Date of birth in ISO 8601 format (YYYY-MM-DD)."
        }
      }
    },
    "Item": {
      "description": "Item object that can be used to provide details of the items in the order.\nThis is only used by payment methods that support it, like Klarna and Riverty.",
      "type": "object",
      "required": [
        "code",
        "unitPrice",
        "quantity",
        "vatAmount",
        "vatRate"
      ],
      "properties": {
        "code": {
          "description": "Merchant Product identification. Each item code must be unique per transaction.",
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        },
        "description": {
          "description": "A human readable description of the item.",
          "$ref": "#/$defs/Description"
        },
        "unitPrice": {
          "description": "Unit price (including VAT) of the item, specified in the smallest currency subunit, as for example euro cents.",
          "$ref": "#/$defs/Amount"
        },
        "quantity": {
          "description": "The number of items of this type.",
          "type": "integer",
          "minimum": 1,
          "maximum": 1000000000
        },
        "vatAmount": {
          "description": "Total VAT amount of the orderline, specified in the smallest currency subunit as for example euro cents.\n",
          "$ref": "#/$defs/Amount"
        },
        "vatRate": {
          "description": "Percentage of VAT applied.\nOnly the first decimal value will be taken into account, the rest will be ignored.\n",
          "type": "number",
          "minimum": 0,
          "maximum": 99.9,
          "multipleOf": 0.1
        }
      }
    },
    "ItemName": {
      "description": "A human readable name of the item.",
      "type": "string",
      "maxLength": 50
    },
    "Items": {
      "description": "Items included in the order. We request both values 'vatAmount' and 'vatRate' to prevent errors.\n",
      "type": "array",
      "minItems": 1,
      "maxItems": 512,
      "items": {
        "allOf": [
          {
            "$ref": "#/$defs/Item"
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "$ref": "#/$defs/ItemName"
              },
              "description": {
                "$ref": "#/$defs/KlarnaDescription"
              },
              "type": {
                "description": "The type of order line item. Used by Klarna to classify the order line.\n",
                "type": "string",
                "format": "enum",
                "enum": [
                  "PHYSICAL",
                  "DIGITAL",
                  "DISCOUNT",
                  "GIFT_CARD",
                  "STORE_CREDIT",
                  "SHIPPING_FEE",
                  "SALES_TAX",
                  "SURCHARGE"
                ]
              }
            }
          }
        ]
      }
    },
    "KlarnaDescription": {
      "maxLength": 100
    },
    "Language": {
      "description": "Preferred language for the user interface as ISO 639-1 code. If the provided language is not supported the default will be used. Commonly supported languages are Dutch (nl) and English (en).",
      "type": "string",
      "default": "nl",
      "minLength": 2,
      "maxLength": 2
    },
    "MaxRetries": {
      "description": "Maximum number of payment attempts allowed for this checkout order.\n**Values:**\n- **null or omitted**: Defaults to 0 (no retry limit, skip UI with single payment method)\n- **0**: No retry limit enforcement. When combined with a single payment method, the hosted checkout will skip the payment method selection screen and redirect the customer directly to the payment method (e.g., iDEAL, PayPal). Useful for external integrations that have their own checkout UI.\n- **1-255**: Enforces retry limit. After exceeding this number of failed payment attempts, the checkout will be locked out with status `LOCKED_OUT`. The payment method selection screen will be shown normally, even with a single payment method.\n\n**Use Cases:**\n- **External integrations**: Set to 0 to enable seamless redirect from external checkout to payment provider\n- **Fraud prevention**: Set to 3-5 to limit retry attempts and prevent abuse\n- **Standard checkout**: Set to 10-255 for generous retry limits with fraud protection\n\n**Important**: `maxRetries=0` does NOT mean \"lock out immediately\". It means \"allow unlimited retries without lockout enforcement\".\n",
      "type": "integer",
      "minimum": 0,
      "maximum": 255
    },
    "MerchantOrderReference": {
      "type": "string",
      "maxLength": 35,
      "description": "Unique identifier, as known by the merchant. This value will end up in the payments portal."
    },
    "OrderItems": {
      "$ref": "#/$defs/Items",
      "description": "Items included in the order. Required field for the following payment methods: Klarna, Riverty. We request both values 'vatAmount' and 'vatRate' to prevent errors."
    },
    "PaymentMethods": {
      "type": "array",
      "description": "List of payment methods used in the checkout. If not provided all available payment methods will be shown.",
      "items": {
        "type": "string",
        "enum": [
          "apple_pay",
          "bancontact",
          "bank_transfer",
          "creditcard",
          "google_pay",
          "ideal",
          "klarna",
          "paypal",
          "in3"
        ]
      }
    },
    "Phone": {
      "description": "The phonenumber of the consumer (E.164 format).",
      "type": "string",
      "maxLength": 16
    },
    "RedirectAction": {
      "description": "URL where consumer should be redirected to by the merchant to perform the payment.",
      "type": "object",
      "required": [
        "url"
      ],
      "properties": {
        "url": {
          "description": "URL where consumer should be redirected to by the merchant to perform the payment.",
          "type": "string",
          "format": "url"
        }
      }
    },
    "Reference": {
      "description": "The clients identifier. This value will be sent in the webhook payload alongside the ID you receive as part of the response of a transaction.",
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "RefundStatusEvent": {
      "description": "* `REFUND_STATUS` - Triggered when a transaction receives an update on one of its requested refunds.\n",
      "type": "string",
      "enum": [
        "REFUND_STATUS"
      ]
    },
    "Refunds": {
      "description": "Details of refunds for a transaction",
      "type": "object",
      "required": [
        "refundedAmount",
        "refundedPendingAmount"
      ],
      "properties": {
        "refundedAmount": {
          "description": "Amount in the smallest currency subunit, as for example euro cents, that has already been refunded.",
          "type": "integer",
          "minimum": 0,
          "maximum": 99999999
        },
        "refundedPendingAmount": {
          "description": "Amount in the smallest currency subunit, as for example euro cents, that has been requested to be refunded.",
          "type": "integer",
          "minimum": 1,
          "maximum": 99999999
        }
      }
    },
    "ReturnURLOneOf": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "returnUrls"
          ],
          "properties": {
            "returnUrls": {
              "$ref": "#/$defs/ReturnUrls"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "returnUrl"
          ],
          "properties": {
            "returnUrl": {
              "$ref": "#/$defs/ReturnUrl"
            }
          }
        }
      ]
    },
    "ReturnUrl": {
      "description": "URL where the Consumer is redirected to after completing the transaction at its issuing bank or at the chosen payment method.\n\nWith this implementation you are responsible to fetch the payment status and incorporated into your site.",
      "type": "string",
      "format": "url",
      "maxLength": 2000
    },
    "ReturnUrls": {
      "type": "object",
      "description": "URLs where the Consumer is redirected to after completing the transaction at its issuing bank or at the chosen payment method.\n\nWith this object we can redirect consumer to a dedicated page per payment result status. Either this object or the returnUrl field is mandatory.",
      "required": [
        "success",
        "cancelled",
        "expired",
        "failed"
      ],
      "properties": {
        "success": {
          "type": "string",
          "format": "url",
          "maxLength": 2000
        },
        "cancelled": {
          "type": "string",
          "format": "url",
          "maxLength": 2000
        },
        "expired": {
          "type": "string",
          "format": "url",
          "maxLength": 2000
        },
        "failed": {
          "type": "string",
          "format": "url",
          "maxLength": 2000
        }
      }
    },
    "StatusAuthorized": {
      "description": "The transaction has been authorized.",
      "type": "string",
      "format": "enum",
      "enum": [
        "AUTHORIZED"
      ]
    },
    "StatusCancelled": {
      "description": "The transaction has been cancelled by the consumer.",
      "type": "string",
      "format": "enum",
      "enum": [
        "CANCELLED"
      ]
    },
    "StatusChangeEvent": {
      "description": "* `STATUS_CHANGE` - Triggered when the status of a transaction changes.\n",
      "type": "string",
      "enum": [
        "STATUS_CHANGE"
      ]
    },
    "StatusExpired": {
      "description": "The transaction has expired.",
      "type": "string",
      "format": "enum",
      "enum": [
        "EXPIRED"
      ]
    },
    "StatusFailure": {
      "description": "The transaction has failed.",
      "type": "string",
      "format": "enum",
      "enum": [
        "FAILURE"
      ]
    },
    "StatusOpen": {
      "description": "The transaction is open and can be paid.",
      "type": "string",
      "format": "enum",
      "enum": [
        "OPEN"
      ]
    },
    "StatusPending": {
      "description": "The transaction is pending, meaning it could not be completed yet; waiting for something.",
      "type": "string",
      "format": "enum",
      "enum": [
        "PENDING"
      ]
    },
    "StatusSuccess": {
      "description": "The transaction has been successfully paid.",
      "type": "string",
      "format": "enum",
      "enum": [
        "SUCCESS"
      ]
    },
    "TransactionId": {
      "description": "ID received in the POST transaction response root object, which can be used in up following calls like refunds or cancellations as transactionId.",
      "type": "string",
      "format": "uuid",
      "minLength": 36,
      "maxLength": 36
    },
    "TransactionWebhook": {
      "allOf": [
        {
          "$ref": "#/$defs/BaseWebhook"
        },
        {
          "type": "object",
          "properties": {
            "events": {
              "items": {
                "description": "* `STATUS_CHANGE` - Triggered when the status of a transaction changes.\n* `REFUND_STATUS` - Triggered when a transaction receives an update on one of its requested refunds.\n* `FINALSTATUS` - This value is deprecated and shouldn't be used anymore. Use `STATUS_CHANGE` instead.\n",
                "oneOf": [
                  {
                    "$ref": "#/$defs/StatusChangeEvent"
                  },
                  {
                    "$ref": "#/$defs/RefundStatusEvent"
                  },
                  {
                    "$ref": "#/$defs/FinalStatusEvent"
                  }
                ]
              }
            }
          }
        }
      ]
    },
    "TransactionWebhooks": {
      "description": "Array of webhooks that enables receiving a web request once a given event occurs. We won't do preventive rate-limiting in order to have the highest throughput possible. However, we will honor 429 (Too-many-requests) responses per callback. We use the Retry-After header to retry after a certain period. If the header was not set we use our default exponential delay implementation.\n",
      "type": "array",
      "items": {
        "$ref": "#/$defs/TransactionWebhook"
      }
    },
    "TransactionWithoutOrderId": {
      "allOf": [
        {
          "$ref": "#/$defs/TransactionWithoutOrderIdLanguageRefundsAndExpiresAt"
        },
        {
          "type": "object",
          "required": [
            "language",
            "expiresAt"
          ],
          "properties": {
            "language": {
              "$ref": "#/$defs/Language"
            },
            "expiresAt": {
              "$ref": "#/$defs/Datetime",
              "description": "ISO 8601 date and time. If a transaction is not finalized before this time the status becomes **EXPIRED**."
            },
            "refunds": {
              "$ref": "#/$defs/Refunds"
            }
          }
        }
      ]
    },
    "TransactionWithoutOrderIdLanguageRefundsAndExpiresAt": {
      "allOf": [
        {
          "$ref": "#/$defs/TransactionWithoutOrderIdLanguageRefundsCreatedAtAndExpiresAt"
        },
        {
          "type": "object",
          "required": [
            "createdAt"
          ],
          "properties": {
            "createdAt": {
              "$ref": "#/$defs/Datetime",
              "description": "ISO 8601 date and time when the transaction was created."
            }
          }
        }
      ]
    },
    "TransactionWithoutOrderIdLanguageRefundsCreatedAtAndExpiresAt": {
      "allOf": [
        {
          "$ref": "#/$defs/ReturnURLOneOf"
        },
        {
          "type": "object",
          "required": [
            "id",
            "reference",
            "amount",
            "currency",
            "status",
            "description"
          ],
          "properties": {
            "id": {
              "$ref": "#/$defs/TransactionId"
            },
            "reference": {
              "$ref": "#/$defs/Reference"
            },
            "amount": {
              "$ref": "#/$defs/Amount"
            },
            "currency": {
              "$ref": "#/$defs/Currency"
            },
            "webhooks": {
              "$ref": "#/$defs/TransactionWebhooks"
            },
            "description": {
              "$ref": "#/$defs/Description"
            }
          }
        }
      ]
    }
  }
}