{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/settlement-provider-abstraction.schema.json",
  "title": "Settlement Provider Abstraction",
  "description": "Canonical provider abstraction for settlement rails that fund Wever Labs OS credits. Provider-specific rails normalize into a common route, confirmation, credit funding, receipt, callback, and ledger contract.",
  "type": "object",
  "required": [
    "provider_id",
    "provider_type",
    "rail_mode",
    "supported_assets",
    "confirmation_mode",
    "credit_funding_rule",
    "receipt_contract",
    "links"
  ],
  "properties": {
    "provider_id": {
      "type": "string"
    },
    "provider_name": {
      "type": "string"
    },
    "provider_type": {
      "type": "string",
      "enum": [
        "stripe_stablecoin",
        "x402",
        "circle_usdc",
        "ap2_mandate",
        "manual_invoice",
        "custom_provider"
      ]
    },
    "rail_mode": {
      "type": "string",
      "enum": [
        "checkout",
        "http_payment",
        "wallet_transfer",
        "mandate_authorization",
        "invoice_settlement",
        "custom"
      ]
    },
    "supported_assets": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "accepted_currencies": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "confirmation_mode": {
      "type": "string",
      "enum": [
        "webhook_confirmation",
        "signed_http_response",
        "wallet_event",
        "operator_attested_confirmation",
        "provider_api_polling"
      ]
    },
    "webhook_signature_profile": {
      "type": "object",
      "additionalProperties": true
    },
    "credit_funding_rule": {
      "type": "object",
      "properties": {
        "funds_credit_account": {
          "type": "boolean"
        },
        "credit_unit": {
          "type": "string"
        },
        "release_policy": {
          "type": "string"
        },
        "refund_behavior": {
          "type": "string"
        },
        "dispute_behavior": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "receipt_contract": {
      "type": "object",
      "properties": {
        "settlement_receipt_schema": {
          "type": "string"
        },
        "usage_receipt_schema": {
          "type": "string"
        },
        "result_contract_schema": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "supported_tools": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "links": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "additionalProperties": true
}
