Introducing the Better Auth Chargebee plugin: Use it to handle subscriptions, billing, and auth seamlessly.
Chargebeechargebee API

Ledger account balances

Credit Grants

A credit grant is a quantified allocation of credits given to a subscription through a configured item price or as a promotional grant, consumed over time through ledger operations.

Example

A subscription receives a credit grant of 100 AI credits as a balance. As the customer uses AI features (e.g., Image Generation), the provisioned balance is consumed first. Once exhausted, further consumption is deducted from the overdraft balance until its limit is reached.

The Ledger Account Balance object

The ledger_account_balance object is a real-time snapshot of credit grants for a single combination of subscription_id, unit_id and unit_type.

The ledger tracks two balances:

  • provisioned_balance: Reflects the credit grants given through the configured item price or promotional grants. These are prepaid credit grants for which the customer has already paid. Any ledger operation will prioritize consuming this balance first.
  • overdraft_balance: Reflects the extra limit provided to a subscription in case it exhausts all credit grants before they are renewed or refreshed. Any ledger operation will consume this balance only when the provisioned balance has been exhausted.

Example

A subscription has a credit grant of 100 AI credits, added to its provisioned balance. Once the provisioned balance is exhausted, further consumption is drawn from the overdraft balance up to its configured limit.

AI Credits Balance Flow

Returned by

Sample Ledger account balanceJSON

API Index URL

https://[site].chargebee.com/api/v2/ledger_account_balances

Ledger account balances attributes

subscription_id
required, string, max chars=50

A unique, immutable identifier for the subscription this account belongs to.

unit_id
required, string, max chars=50

Identifier of the credit unit this account tracks. For example, a credit unit id such as ai_credits.

unit_type
required, enumerated string

Type of unit used for this balance.

Enum Values
credit_unit

The unit represents a credit unit, the type used by credit grants.

modified_at
optional, timestamp(UTC) in seconds

Unix timestamp (seconds) when the balance was last updated. For example, after capture or authorize.

provisioned_balance

Stores credit grants given through the configured item price. Used first before overdraft.

overdraft_balance

Extra credit available after provisioned balance is exhausted.