{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://monei.com/ucp/payments/2026-12-01/schema.json",
  "name": "com.monei.payments",
  "version": "2026-12-01",
  "title": "MONEI Payments Handler",
  "description": "Configuration, instruments and tokenization payloads for the MONEI UCP payment handler.",
  "$defs": {
    "environment": {
      "type": "string",
      "enum": ["test", "live"],
      "description": "The MONEI mode of the checkout and the API key used to tokenize."
    },
    "account_id": {
      "type": "string",
      "format": "uuid",
      "description": "The merchant's public MONEI account identifier."
    },
    "business_config": {
      "type": "object",
      "required": ["environment", "account_id"],
      "additionalProperties": false,
      "properties": {
        "environment": {"$ref": "#/$defs/environment"},
        "account_id": {"$ref": "#/$defs/account_id"}
      }
    },
    "platform_config": {
      "type": "object",
      "required": ["environment"],
      "additionalProperties": false,
      "properties": {
        "environment": {"$ref": "#/$defs/environment"}
      }
    },
    "available_instruments": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "required": ["type"],
            "additionalProperties": false,
            "properties": {
              "type": {"const": "card"},
              "constraints": {
                "type": "object",
                "required": ["properties"],
                "additionalProperties": false,
                "properties": {
                  "properties": {
                    "type": "object",
                    "required": ["brand"],
                    "additionalProperties": false,
                    "properties": {
                      "brand": {
                        "type": "object",
                        "required": ["enum"],
                        "additionalProperties": false,
                        "properties": {
                          "enum": {
                            "type": "array",
                            "items": {"type": "string", "minLength": 1}
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "required": ["type"],
            "additionalProperties": false,
            "properties": {
              "type": {"const": "bizum"}
            }
          }
        ]
      }
    },
    "token": {
      "type": "string",
      "pattern": "^[0-9a-f]{40}$",
      "description": "Single-use MONEI payment token bound to the merchant and checkout. It is valid for 15 minutes."
    },
    "monei_payment_token": {
      "title": "MONEI payment token credential",
      "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/token_credential.json",
      "type": "object",
      "required": ["type", "token", "expiry"],
      "properties": {
        "type": {"const": "monei_payment_token"},
        "token": {"$ref": "#/$defs/token"},
        "expiry": {
          "type": "string",
          "format": "date-time",
          "description": "Token expiration (ISO 8601 date-time). Platforms must tokenize again before this time."
        }
      }
    },
    "bizum_phone": {
      "title": "Bizum phone credential",
      "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/payment_credential.json",
      "type": "object",
      "required": ["phone_number"],
      "properties": {
        "type": {"const": "bizum_phone"},
        "phone_number": {
          "type": "string",
          "pattern": "^\\+[1-9][0-9]{1,14}$",
          "description": "The buyer's Bizum phone number in E.164 format."
        }
      }
    },
    "card": {
      "title": "Card instrument",
      "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/card_payment_instrument.json",
      "$defs": {
        "constraint_target": {
          "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/card_payment_instrument.json#/$defs/constraint_target"
        }
      },
      "type": "object",
      "required": ["credential"],
      "properties": {
        "credential": {"$ref": "#/$defs/monei_payment_token"}
      }
    },
    "bizum": {
      "title": "Bizum instrument",
      "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/payment_instrument.json",
      "type": "object",
      "required": ["credential"],
      "properties": {
        "type": {"const": "bizum"},
        "credential": {"$ref": "#/$defs/bizum_phone"}
      }
    },
    "pan": {
      "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/payment_credential.json",
      "type": "object",
      "required": ["number", "expiry_month", "expiry_year", "cvc"],
      "properties": {
        "type": {"const": "pan"},
        "number": {
          "type": "string",
          "pattern": "^[0-9]{13,19}$",
          "description": "Card number. The tokenize endpoint also checks the Luhn checksum."
        },
        "expiry_month": {"type": "integer", "minimum": 1, "maximum": 12},
        "expiry_year": {"type": "integer", "minimum": 2000, "maximum": 2099},
        "cvc": {"type": "string", "pattern": "^[0-9]{3,5}$"},
        "name": {"type": "string"}
      }
    },
    "tokenize_request": {
      "title": "POST /v1/ucp/tokenize request",
      "type": "object",
      "required": ["credential", "binding", "identity", "usage_limits"],
      "properties": {
        "credential": {"$ref": "#/$defs/pan"},
        "binding": {
          "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/binding.json",
          "type": "object",
          "properties": {
            "id": {"type": "string", "maxLength": 255}
          }
        },
        "identity": {
          "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/payment_identity.json",
          "type": "object",
          "properties": {
            "access_token": {
              "$ref": "#/$defs/account_id",
              "description": "The merchant's account_id."
            }
          }
        },
        "usage_limits": {
          "type": "object",
          "required": ["max_amount", "currency"],
          "properties": {
            "max_amount": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000000,
              "description": "The maximum charge in minor units."
            },
            "currency": {
              "type": "string",
              "enum": ["EUR", "USD", "GBP", "JPY", "CHF", "SEK", "DKK", "PLN", "JOD"],
              "description": "The ISO 4217 currency code. The charge must use this currency."
            }
          }
        },
        "signals": {
          "$ref": "https://ucp.dev/2026-08-25/schemas/common/types/signals.json",
          "type": "object",
          "properties": {
            "dev.ucp.buyer_ip": {
              "type": "string",
              "anyOf": [{"format": "ipv4"}, {"format": "ipv6"}]
            }
          }
        }
      }
    },
    "tokenize_response": {
      "title": "POST /v1/ucp/tokenize response",
      "type": "object",
      "required": ["token", "expiry"],
      "additionalProperties": false,
      "properties": {
        "token": {"$ref": "#/$defs/token"},
        "expiry": {"type": "string", "format": "date-time"}
      }
    },
    "com.monei.payments": {
      "payment_instrument": {
        "oneOf": [{"$ref": "#/$defs/card"}, {"$ref": "#/$defs/bizum"}]
      },
      "business_schema": {
        "$ref": "https://ucp.dev/2026-08-25/schemas/payment_handler.json#/$defs/business_schema",
        "type": "object",
        "required": ["config"],
        "properties": {
          "config": {"$ref": "#/$defs/business_config"},
          "available_instruments": {"$ref": "#/$defs/available_instruments"}
        }
      },
      "platform_schema": {
        "$ref": "https://ucp.dev/2026-08-25/schemas/payment_handler.json#/$defs/platform_schema",
        "type": "object",
        "properties": {
          "config": {"$ref": "#/$defs/platform_config"},
          "available_instruments": {"$ref": "#/$defs/available_instruments"}
        }
      },
      "response_schema": {
        "$ref": "https://ucp.dev/2026-08-25/schemas/payment_handler.json#/$defs/response_schema",
        "type": "object",
        "required": ["config"],
        "properties": {
          "config": {"$ref": "#/$defs/business_config"},
          "available_instruments": {"$ref": "#/$defs/available_instruments"}
        }
      }
    }
  }
}
