Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Mage ai Mage ai Chargebee Plan Model Events Schema

From Leeroopedia


Knowledge Sources
Domains Data_Integration, Chargebee, Schema
Last Updated 2026-02-09 00:00 GMT

Overview

JSON Schema definition for Chargebee event records under the plan model, used by the Singer-based Chargebee source connector.

Description

This schema defines the structure and types for event data extracted from the Chargebee API when using the plan-based billing model. It is loaded by the Chargebee source connector during stream discovery to validate and type-check extracted records. The schema follows the JSON Schema specification and includes top-level properties such as id, occurred_at, source, user, event_type, api_version, object, and webhook_status. It also contains a nested content object that references other plan-model schemas via $ref, including addon, coupon, credit_note, customer, gift, invoice, order, and others. Unlike the item-model events schema, this variant references plan-specific entities such as addons rather than items and item prices. The root type is a nullable object with additionalProperties set to false. At 647 lines, this provides the event envelope schema for the plan pricing model.

Usage

This schema is automatically loaded by the Chargebee source connector during the discovery phase. It defines the available columns and their types for the events stream when configured for the plan billing model.

Code Reference

Source Location

  • Repository: mage-ai
  • File: mage_integrations/mage_integrations/sources/chargebee/schemas/plan_model/events.json
  • Lines: 1-647

Signature

{
  "type": ["null", "object"],
  "additionalProperties": false,
  "properties": {
    "id": { "type": ["null", "string"] },
    "occurred_at": { "type": ["null", "string"], "format": "date-time" },
    "source": { "type": ["null", "string"] },
    "user": { "type": ["null", "string"] },
    "event_type": { "type": ["null", "string"] },
    "api_version": { "type": ["null", "string"] },
    "object": { "type": ["null", "string"] },
    "webhook_status": { "type": ["null", "string"] },
    "content": {
      "type": ["null", "object"],
      "properties": {
        "addon": { "$ref": "addons.json" },
        "coupon": { "$ref": "coupons.json" },
        "credit_note": { "$ref": "credit_notes.json" },
        "customer": { "$ref": "customers.json" },
        "gift": { "$ref": "gifts.json" },
        "invoice": { "$ref": "invoices.json" },
        "order": { "$ref": "orders.json" },
        "subscription": { "$ref": "subscriptions.json" },
        "transaction": { "..." }
      }
    }
  }
}

Import

# Loaded automatically by Source.load_schemas_from_folder()
# Path: mage_integrations/mage_integrations/sources/chargebee/schemas/plan_model/events.json

I/O Contract

Inputs

Name Type Required Description
(none) JSON file Yes Loaded from disk by schema loader

Outputs

Name Type Description
schema dict JSON Schema object with properties, types, format constraints, and $ref references to related plan-model schemas

Usage Examples

import json
import os

# Schema is auto-loaded by the Chargebee source connector
# Manual loading example:
schema_path = os.path.join(
    "mage_integrations/mage_integrations/sources/chargebee/schemas/plan_model",
    "events.json"
)
with open(schema_path) as f:
    schema = json.load(f)

# schema["properties"] contains field definitions
print(list(schema["properties"].keys()))
# The content property contains $ref references to other schemas
print(list(schema["properties"]["content"]["properties"].keys()))

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment