{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aifinpay-io/json-schema/aifinpay-io-merchant-config-committed-schema.json",
  "title": "MerchantConfigCommitted",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aifinpay-io-openapi.json#/components/schemas/MerchantConfigCommitted",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "operation_id",
    "revision",
    "config"
  ],
  "properties": {
    "operation_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "revision": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "config": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "format",
        "version",
        "revision",
        "router_slug",
        "default_gateway_id",
        "legacy_gateway_id",
        "gateways",
        "context_revision",
        "capabilities"
      ],
      "properties": {
        "format": {
          "const": "aifinpay-merchant-config",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "integer"
        },
        "revision": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "router_slug": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "maxLength": 100
        },
        "default_gateway_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "maxLength": 100
        },
        "legacy_gateway_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "maxLength": 100
        },
        "gateways": {
          "type": "array",
          "maxItems": 8,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "slug",
              "type",
              "enabled_intent",
              "priority",
              "upstream_base_url",
              "description",
              "metadata",
              "chains",
              "payment_assets",
              "resources",
              "origin_secret_set",
              "readiness"
            ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "slug": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-]{2,39}$"
              },
              "type": {
                "type": "string",
                "const": "hosted_x402"
              },
              "enabled_intent": {
                "type": "boolean"
              },
              "priority": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000
              },
              "upstream_base_url": {
                "type": "string",
                "format": "uri",
                "maxLength": 2048
              },
              "description": {
                "type": "string",
                "maxLength": 500
              },
              "metadata": {
                "type": "object",
                "maxProperties": 10,
                "propertyNames": {
                  "minLength": 1,
                  "maxLength": 40
                },
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 200
                }
              },
              "chains": {
                "type": "array",
                "uniqueItems": true,
                "items": {
                  "type": "string"
                }
              },
              "payment_assets": {
                "type": "array",
                "uniqueItems": true,
                "items": {
                  "type": "string"
                }
              },
              "resources": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "id",
                    "route_pattern",
                    "type"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "route_pattern": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "page",
                        "api",
                        "dataset",
                        "mcp_tool",
                        "product"
                      ]
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "maxLength": 60
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "paywall_enabled": {
                      "type": "boolean"
                    },
                    "currency": {
                      "const": "USD",
                      "type": "string"
                    },
                    "billing_unit": {
                      "const": "request",
                      "type": "string"
                    },
                    "unit_weight": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100000
                    },
                    "price_usd": {
                      "type": "string",
                      "pattern": "^(?:0|[1-9][0-9]*)(?:\\.[0-9]{1,6})?$"
                    },
                    "tier": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "standard",
                        "complex",
                        "premium",
                        null
                      ]
                    },
                    "chains": {
                      "type": "array",
                      "uniqueItems": true,
                      "items": {
                        "type": "string"
                      }
                    },
                    "payment_assets": {
                      "type": "array",
                      "uniqueItems": true,
                      "items": {
                        "type": "string"
                      }
                    },
                    "daily_unit_limit": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1,
                      "maximum": 100000000
                    },
                    "fallback_gateway_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "maxLength": 100
                    }
                  }
                }
              },
              "origin_secret_set": {
                "type": "boolean"
              },
              "readiness": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "ready",
                  "state"
                ],
                "properties": {
                  "ready": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "PENDING_DNS",
                      "DNS_VALID",
                      "DNS_INVALID",
                      "REMOVED"
                    ]
                  }
                }
              }
            }
          }
        },
        "context_revision": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "capabilities": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "chains",
            "payment_assets"
          ],
          "properties": {
            "chains": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string"
              }
            },
            "payment_assets": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}