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 Item Model Subscriptions Schema

From Leeroopedia


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 item 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 item-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, currency_code, start_date, changes_scheduled_at, trial_end, remaining_billing_cycles, po_number, plan_quantity_in_decimal, plan_unit_price_in_decimal, customer_id, status, and coupon. The root type is a nullable object with additionalProperties set to false. At 873 lines, this is the largest schema in the Chargebee connector, reflecting the comprehensive nature of subscription data including billing cycles, trial periods, and item-based pricing configurations.

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 item billing model.

Code Reference

Source Location

  • Repository: mage-ai
  • File: mage_integrations/mage_integrations/sources/chargebee/schemas/item_model/subscriptions.json
  • Lines: 1-873

Signature

{
  "type": ["null", "object"],
  "additionalProperties": false,
  "properties": {
    "id": { "type": ["null", "string"] },
    "currency_code": { "type": ["null", "string"] },
    "start_date": { "type": ["null", "string"], "format": "date-time" },
    "changes_scheduled_at": { "type": ["null", "string"], "format": "date-time" },
    "trial_end": { "type": ["null", "string"], "format": "date-time" },
    "remaining_billing_cycles": { "type": ["null", "integer"] },
    "po_number": { "type": ["null", "string"] },
    "plan_quantity_in_decimal": { "type": ["null", "string"] },
    "plan_unit_price_in_decimal": { "type": ["null", "string"] },
    "customer_id": { "type": ["null", "string"] },
    "status": { "type": ["null", "string"] },
    "coupon": { "type": ["null", "string"] }
    // ... additional properties
  }
}

Import

# Loaded automatically by Source.load_schemas_from_folder()
# Path: mage_integrations/mage_integrations/sources/chargebee/schemas/item_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 item-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/item_model",
    "subscriptions.json"
)
with open(schema_path) as f:
    schema = json.load(f)

# schema["properties"] contains field definitions
print(list(schema["properties"].keys()))

Related Pages

Implements Principle

Requires Environment

Page Connections

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