Implementation:Mage ai Mage ai Chargebee Plan Model Subscriptions Schema
| Knowledge Sources | |
|---|---|
| Domains | Data_Integration, Chargebee, Schema |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
JSON Schema definition for Chargebee subscription records under the plan model, used by the Singer-based Chargebee source connector.
Description
This schema defines the structure and types for subscription 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 properties such as id, customer_id, currency_code, plan_id, plan_quantity, plan_unit_price, billing_period, mrr, billing_period_unit, status, coupon, trial_start, trial_end, trial_end_action, and current_term_start. The root type is a nullable object with additionalProperties set to false. Unlike the item-model subscriptions schema, this variant uses plan-specific fields such as plan_id, plan_quantity, and plan_unit_price rather than item-based pricing references.
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 subscriptions 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/subscriptions.json
- Lines: 1-465
Signature
{
"type": ["null", "object"],
"additionalProperties": false,
"properties": {
"id": { "type": ["null", "string"] },
"customer_id": { "type": ["null", "string"] },
"currency_code": { "type": ["null", "string"] },
"plan_id": { "type": ["null", "string"] },
"plan_quantity": { "type": ["null", "integer"] },
"plan_unit_price": { "type": ["null", "integer"] },
"billing_period": { "type": ["null", "integer"] },
"mrr": { "type": ["null", "integer"] },
"billing_period_unit": { "type": ["null", "string"] },
"status": { "type": ["null", "string"] },
"coupon": { "type": ["null", "string"] },
"trial_start": { "type": ["null", "string"], "format": "date-time" },
"trial_end": { "type": ["null", "string"], "format": "date-time" },
"trial_end_action": { "type": ["null", "string"] },
"current_term_start": { "type": ["null", "string"], "format": "date-time" }
// ... additional properties
}
}
Import
# Loaded automatically by Source.load_schemas_from_folder()
# Path: mage_integrations/mage_integrations/sources/chargebee/schemas/plan_model/subscriptions.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, and format constraints for plan-model subscription data |
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",
"subscriptions.json"
)
with open(schema_path) as f:
schema = json.load(f)
# schema["properties"] contains field definitions
print(list(schema["properties"].keys()))