{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://splitclubapp.com/schemas/v1/webhook_event.json",
  "title": "WebhookEvent",
  "description": "What SplitClub POSTs to your webhook endpoint, signed with SplitClub-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, t + \".\" + body)>.",
  "x-doc": "schema-webhook-event",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "object",
    "type",
    "mode",
    "created_at",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^evt_[A-Za-z0-9]+$",
      "examples": [
        "evt_1Zp"
      ]
    },
    "object": {
      "const": "event"
    },
    "type": {
      "type": "string",
      "enum": [
        "checkout.created",
        "checkout.collecting",
        "share.held",
        "checkout.funded",
        "checkout.completed",
        "checkout.expired",
        "checkout.canceled",
        "refund.created",
        "offering.approved",
        "offering.rejected"
      ]
    },
    "mode": {
      "type": "string",
      "enum": [
        "test",
        "live"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "data": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "object"
      ],
      "properties": {
        "object": {
          "type": "object",
          "description": "The checkout, share or offering the event is about, as the API returns it."
        },
        "previous_status": {
          "type": "string"
        }
      }
    }
  }
}
