Unbilled charge represents the charges that are held by passing invoice_later in various operations such as update subscription, add charge, create subscription, etc. Learn more.
If any invoice is to be created for a subscription all the unbilled charges associated with the subscription will be included in that invoice.
If any invoice is to be created for a customer, all the unbilled charges associated with its subscriptions will be included in that invoice.
Any automatic invoice creation like renewal, activation, etc., will include the unbilled charges.
Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'.
If consolidated invoicing is enabled, the charges during the subscription renewals/activations will be held and consolidated at the last renewal/activation that takes place on that particular day.
optional, string, max chars=40 Uniquely identifies an unbilled charge.
customer_id
optional, string, max chars=50 A unique identifier for the customer being charged.
subscription_id
optional, string, max chars=50 A unique identifier for the subscription this charge belongs to.
date_from
optional, timestamp(UTC) in seconds Start date of this charge.
date_to
optional, timestamp(UTC) in seconds End date of this charge.
unit_amount
optional, in cents, min=0 Unit amount of the charge item.
pricing_model
optional, enumerated string The pricing scheme for this line item.
Possible values are
flat_feeA fixed price that is not quantity-based.per_unitA fixed price per unit quantity.tieredThe per unit price is based on the tier that the total quantity falls in.volumeThere are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers.stairstepA quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in.
quantity
optional, integer, min=0 Quantity of the item which is represented by this charge.
amount
optional, in cents, min=0 Total amount of this charge. Typically equals to unit amount x quantity.
currency_code
string, max chars=3 The currency code (ISO 4217 format) for the charge.
discount_amount
optional, in cents, min=0 Total discounts for this charge.
description
optional, string, max chars=250 Detailed description about this charge.
entity_type
enumerated string Specifies the modelled entity this line item is based on.
Possible values are
plan_setupIndicates that this lineitem is based on 'Plan Setup' charge. The 'entity_id' attribute specifies the plan id.planIndicates that this lineitem is based on 'Plan' entity. The 'entity_id' attribute specifies the plan id.addonIndicates that this lineitem is based on 'Addon' entity. The 'entity_id' attribute specifies the addon id.adhocIndicates that this lineitem is not modelled. i.e created adhoc. So the 'entity_id' attribute will be null in this case.
entity_id
optional, string, max chars=100 The identifier of the modelled entity this charge is based on. Will be null for 'adhoc' entity type.
is_voided
boolean, default=false Will be true if the charge has been voided. Usually the unbilled charge will be voided and revised to different charges(s) during proration.
voided_at
optional, timestamp(UTC) in seconds Timestamp indicating the date and time this charge got voided.
unit_amount_in_decimal
optional, string, max chars=39 The decimal representation of the amount for the charge, in major units of the currency. Typically equals to unit_amount_in_decimal x quantity_in_decimal. Returned when multi-decimal pricing is enabled.
quantity_in_decimal
optional, string, max chars=33 The decimal representation of the quantity of this entity. Returned when the entity is quantity-based and multi-decimal pricing is enabled.
amount_in_decimal
optional, string, max chars=39 The decimal representation of the unit amount for the entity. The value is in major units of the currency. Returned when the entity is quantity-based and multi-decimal pricing is enabled.
updated_at
timestamp(UTC) in seconds Timestamp indicating when the unbilled charge was last updated
is_advance_charge
optional, boolean, default=false The value of this parameter will be true if it is a recurring unbilled charge for a future term.
deleted
boolean Indicates that this resource has been deleted.
optional, list of line_item_tier The list of tiers applicable for this line item
Tier attributes
starting_unit
integer, min=0 The lower limit of a range of units for the tier
ending_unit
optional, integer The upper limit of a range of units for the tier
quantity_used
integer, min=0 The number of units purchased in a range.
unit_amount
in cents, min=0 The price of the tier if the charge model is a stairtstep pricing , or the price of each unit in the tier if the charge model is tiered/volume pricing.
starting_unit_in_decimal
optional, string, max chars=33 The decimal representation of the the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as ending_unit_in_decimal of the next lower tier. Returned only when the line_items.pricing_model is tiered, volume or stairstep and multi-decimal pricing is enabled.
ending_unit_in_decimal
optional, string, max chars=33 The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the starting_unit_in_decimal of the next higher tier. Returned only when the line_items.pricing_model is tiered, volume or stairstep and multi-decimal pricing is enabled.
quantity_used_in_decimal
optional, string, max chars=33 The decimal representation of the quantity purchased from this tier. Returned when the line_item is quantity-based and multi-decimal pricing is enabled.
unit_amount_in_decimal
optional, string, max chars=40 The decimal representation of the per-unit price for the tier when the pricing_model is tiered or volume. When the pricing_model is stairstep, it is the decimal representation of the total price for line_item. The value is in major units of the currency. Returned when the line_item is quantity-based and multi-decimal pricing is enabled.
required, string, max chars=50 Identifier of the subscription for which this unbilled charges needs to be created.
currency_code
required if Multicurrency is enabled, string, max chars=3 The currency code (ISO 4217 format) of the unbilled_charge.
+
addons
Parameters for addons. Multiple addons can be passed by specifying unique indices.
pass parameters as addons[<param name>][<idx:0..n>]
addons[id][0..n]
optional, string, max chars=100 Identifier of the addon. Multiple addons can be passed.
addons[quantity][0..n]
optional, integer, default=1, min=1 Quantity of the addon. Applicable for addons with pricing_model other than flat_fee.
addons[unit_price][0..n]
optional, in cents, min=0
The price or per-unit-price of the addon. The value depends on the type of currency.
Note:
For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
The unit_price provided is $10
The addon billing period is 1 month.
The plan billing period is 3 months.
The addon is only billed for $10 on each subscription renewal.
addons[quantity_in_decimal][0..n]
optional, string, max chars=33 The decimal representation of the quantity of the non-recurring addon. Provide the value in major units of the currency. Must be provided when the addon is quantity-based. This parameter can only be passed when multi-decimal pricing is enabled.
addons[unit_price_in_decimal][0..n]
optional, string, max chars=39 When price overriding is enabled for the site, the price or per-unit price of the non-recurring addon can be set here. The value set for the addon is used by default. Provide the value as a decimal string in major units of the currency. This parameter can only be passed when multi-decimal pricing is enabled.
addons[date_from][0..n]
optional, timestamp(UTC) in seconds The time when the service period for the addon starts.
addons[date_to][0..n]
optional, timestamp(UTC) in seconds The time when the service period for the addon ends.
+
charges
Parameters for charges. Multiple charges can be passed by specifying unique indices.
pass parameters as charges[<param name>][<idx:0..n>]
charges[amount][0..n]
optional, in cents, min=1 The amount to be charged. The unit depends on the type of currency.
charges[amount_in_decimal][0..n]
optional, string, max chars=39 The decimal representation of the amount for the one-time charge. Provide the value in major units of the currency. Can be provided only when multi-decimal pricing is enabled.
charges[description][0..n]
optional, string, max chars=250 Description for this charge
charges[taxable][0..n]
optional, boolean, default=true The amount to be charged is taxable or not.
charges[tax_profile_id][0..n]
optional, string, max chars=50 Tax profile of the charge.
charges[avalara_tax_code][0..n]
optional, string, max chars=50 The Avalara tax codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's AvaTax for Sales integration.
charges[hsn_code][0..n]
optional, string, max chars=50 The HSN code to which the item is mapped for calculating the customer’s tax in India. Applicable only when both of the following conditions are true:
India has been enabled as a Tax Region. (An error is returned when this condition is not true.)
optional, string, max chars=50 The TaxJar product codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's TaxJar integration.
charges[avalara_sale_type][0..n]
optional, enumerated string Indicates the type of sale carried out. This is applicable only if you use Chargebee’s AvaTax for Communications integration.
Possible values are
wholesaleTransaction is a sale to another company that will resell your product or service to another consumerretailTransaction is a sale to an end userconsumedTransaction is for an item that is consumed directlyvendor_useTransaction is for an item that is subject to vendor use tax
charges[avalara_transaction_type][0..n]
optional, integer Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use Chargebee’s AvaTax for Communications integration.
charges[avalara_service_type][0..n]
optional, integer Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use Chargebee’s AvaTax for Communications integration.
charges[date_from][0..n]
optional, timestamp(UTC) in seconds The time when the service period for the charge starts.
charges[date_to][0..n]
optional, timestamp(UTC) in seconds The time when the service period for the charge ends.
Use this API to bill the unbilled charges. Available Credits and Excess Payments will automatically be applied while creating the invoice.
If the Auto Collection is turned on for the particular customer, the invoice will be created in payment_due state and the payment collection will be scheduled immediately.
During invoice creation, the PO number for the line items will be filled from the subscription’s current PO number, if available.
If no recurring item is present in the created invoice, the invoice will be marked as recurring=false.
If consolidated invoicing is enabled and the parameter ‘customer_id’ is passed, multiple invoices can be created based on the following factors.
Currency
PO number if ‘Group by PO number’ is enabled
Shipping address
Auto Collection
Payment method
Sample Request
curl https://{site}.chargebee.com/api/v2/unbilled_charges/invoice_unbilled_charges \
-X POST \
-u {site_api_key}:\
-d subscription_id="__test__KyVnHhSBWSjWC2p"
copy
curl https://{site}.chargebee.com/api/v2/unbilled_charges/invoice_unbilled_charges \
-X POST \
-u {site_api_key}:\
-d subscription_id="__test__KyVnHhSBWSjWC2p"
optional, string, max chars=50 Identifier of the subscription for which this invoice needs to be created. Should be specified if 'customer_id' is not specified.
customer_id
optional, string, max chars=50 Identifier of the customer for whom this invoice needs to be created. Should be specified if 'subscription_id' is not specified. Applicable only if the consolidated invoicing is enabled. .
optional, integer, default=10, min=1, max=100 The number of resources to be returned.
offset
optional, string, max chars=1000 Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set offset to the value of next_offset obtained in the previous iteration of the API call.
include_deleted
optional, boolean, default=false If set to true, includes the deleted resources in the response. For the deleted resources in the response, the 'deleted' attribute will be 'true'.
optional, boolean, default=false Will be true if the charge has been voided. Usually the unbilled charge will be voided and revised to different charges(s) during proration.
subscription_id[<operator>]
optional, string filter A unique identifier for the subscription this charge belongs to. Supported operators : is, is_not, starts_with, is_present, in, not_in
Example →subscription_id[is] = "5hjdk8nOpd0b12"
customer_id[<operator>]
optional, string filter A unique identifier for the customer being charged. Supported operators : is, is_not, starts_with, is_present, in, not_in
always returned
Resource object representing unbilled_charge
next_offset
optional, string, max chars=1000
This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter “offset”.
optional, string, max chars=50 Identifier of the subscription for which this estimate needs to be created. Should be given if 'customer_id' is not specified.
customer_id
optional, string, max chars=50 Identifier of the customer for whom this estimate is created. Is given if 'subscription_id' is not specified. Applicable only if the 'Consolidated Invoicing' is enabled. If 'Consolidated Invoicing' is not enabled, an invoice will be generated for every subscription.