{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aifinpay-io/json-schema/aifinpay-io-merchant-config-export-schema.json",
  "title": "MerchantConfigExport",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aifinpay-io-openapi.json#/components/schemas/MerchantConfigExport",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "version",
    "revision",
    "router_slug",
    "default_gateway_id",
    "legacy_gateway_id",
    "gateways"
  ],
  "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"
        ],
        "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
                }
              }
            }
          }
        }
      }
    }
  }
}