Introducing the Chargebee CLI

Set a credit rate override

Sets the credit rate override for a subscription. If the subscription has no override for the metered feature, this creates one as version 0. If it already has one, this replaces it with a new version. Either way the override applies as soon as it is set, in place of the feature-level credit rate, and usage that was already converted into credits is not re-priced.

The request describes the whole override: nothing is carried over from the previous version, so pass every field you want the override to have. The credit unit is taken from the feature-level credit rate and cannot be changed.

The new override version stores this value in credit_rate_version: the version of the feature-level credit rate the subscription would use without an override.

Prerequisites & Constraints

  • The metered feature must already have a feature-level credit rate.

Implementation Notes

Sample Request

set a subscription credit rate override

Sample Result[JSON]

URL Format

POST https://[site].chargebee.com/api/v2/metered_features/{metered-feature-id}/set_credit_rate_override

Input Parameters

subscription_id
required, string, max chars=50

The identifier of the subscription the override applies to.

conversion_model
required, enumerated string

Determines how usage is converted into credits for this subscription. See Conversion models.

Enum Values
unit

Every unit of usage costs credit_cost credits. Do not pass package_size.

package

Usage is charged in packages of package_size units, and each package costs credit_cost credits. Packages are counted on the total usage in the billing term, and a partly used package is charged as a full package.

package_size
optional, bigdecimal, min=1E-9, max=999999999.999999999

The number of usage units in one package.

Required if

  • conversion_model is package.

Constraints

  • Must be greater than 0.
  • Supports up to 9 decimal places.
  • Not accepted when conversion_model is unit.
credit_cost
required, bigdecimal, min=0, max=999999999.999999999

The credits charged for each unit of usage when conversion_model is unit, or for each package of package_size units when conversion_model is package.

Constraints

  • Must be greater than or equal to 0.
  • Supports up to 9 decimal places.
note
optional, string, max chars=500

The reason for this change, shown in the version history.

Returns

Credit rate override object

The override version that was created: version 0 for a new override, otherwise the next version.