'Estimates', as the name implies, can be used to find out the estimate for performing an operation as against performing the operation itself. Say, if you want to create a new subscription or update an existing one, you can deduce the details such as the amount the customer needs to be charged for this operation, the state the subscription would be in, etc. using the estimate API.

Note: These APIs when invoked don't perform actual operations. They just generate an estimate.

Sample estimate [ JSON ]

{ "created_at": 1501853689, "object": "estimate", "subscription_estimate": { "id": "test123", "object": "subscription_estimate", "currency_code": "USD" }, "invoice_estimate": { "recurring": true, "price_type": "tax_exclusive", "sub_total": 900, "total": 900, "credits_applied": 0, "amount_paid": 0, "amount_due": 900, "object": "invoice_estimate", "line_items": [ { "date_from": 1504532089, "date_to": 1507124089, "unit_amount": 900, "quantity": 1, "is_taxed": false, "tax_amount": 0, "object": "line_item", "amount": 900, "description": "Sample", "entity_type": "plan", "entity_id": "basic", "discount_amount": 0, "item_level_discount_amount": 0 }, {..} ], "taxes": [], "line_item_taxes": [], "currency_code": "USD", "line_item_discounts": [] } }
created_at
The time at which this estimate got generated.
timestamp(UTC) in seconds
Represents the subscription details when the 'estimate' operations are invoked.
optional, subscription_estimate
Represents the preview of the invoice generated immediately when the 'estimate' operations are invoked.
optional, invoice_estimate
Is a list of estimated invoices i.e., an array of invoice_estimate objects. It is generated when 'Create an estimate for unbilled charges' operation is invoked.
optional, list of invoice_estimate
Represents the preview of the invoice generated at term end when the 'estimate' operations are invoked.
optional, invoice_estimate
Represents the preview of the credit-notes generated during 'estimate' operation. Currently applicable only for the 'Update Subscription Estimate' operation.
optional, list of credit_note_estimate
Represents the preview of the unbilled charges generated during 'estimate' operation. Currently not applicable for the ‘Subscription renewal estimate’ operation.
optional, list of unbilled_charge
id
The identifier of the subscription.
optional, string, max chars=50
currency_code
The currency code (ISO 4217 format) of the subscription.
string, max chars=3
status
The status of the subscription.
optional, enumerated string
Possible values are
futureThe Subscription is scheduled to start in a future date.in_trialThe subscription is in trial.activeThe subscription is in active state and will be charged at start of each term based on the recurring items(plan & addons etc.,).non_renewingThe subscription will be cancelled at end of the current term.cancelledThe subscription has been cancelled. No new recurring actions will take place, but any pending payments will be collected.
next_billing_at
Date on which the next billing happens. This will be null for non-renewing and canceled subscriptions.
optional, timestamp(UTC) in seconds
shipping_address
Show attributes[+]
Represents the shipping address when the 'estimate' operations are invoked.
optional, shipping_address
Shipping addres attributes
first_name
First name.
optional, string, max chars=150
last_name
Last name.
optional, string, max chars=150
email
Email.
optional, string, max chars=70
company
Company name.
optional, string, max chars=250
phone
Phone number.
optional, string, max chars=50
line1
Address line 1.
optional, string, max chars=180
line2
Address line 2.
optional, string, max chars=150
line3
Address line 3.
optional, string, max chars=150
city
City.
optional, string, max chars=50
state_code
The ISO 3166-2 state/province code. Supported only for countries US,Canada and India.
optional, string, max chars=50
state
The state/province name.
optional, string, max chars=50
country
2-letter ISO 3166 alpha-2 country code.
optional, string, max chars=50
zip
Zip or Postal code.
optional, string, max chars=20
validation_status
The address verification status.
optional, enumerated string, default=not_validated
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
recurring
Will be 'true' for subscription related estimates.
boolean, default=true
price_type
The price type of this invoice.
enumerated string, default=tax_exclusive
Possible values are
tax_exclusiveAll amounts in the document are exclusive of tax.tax_inclusiveAll amounts in the document are inclusive of tax.
currency_code
The currency code (ISO 4217 format) of the invoice.
string, max chars=3
sub_total
Invoice sub-total in cents.
in cents, min=0
total
Invoice total in cents.
optional, in cents, default=0, min=0
credits_applied
credits applied to this invoice in cents.
optional, in cents, default=0, min=0
amount_paid
Existing outstanding payments if any, applied to this invoice in cents.
optional, in cents, default=0, min=0
amount_due
Invoice amount due in cents.
optional, in cents, default=0, min=0
line_items
Show attributes[+]
The list of items in this estimate.
optional, list of line_item
Line item attributes
id
Uniquely identifies a line_item.
optional, string, max chars=40
subscription_id
A unique identifier for the subscription this lineitem belongs to.
optional, string, max chars=3
date_from
Start date of this lineitem.
timestamp(UTC) in seconds
date_to
End date of this lineitem.
timestamp(UTC) in seconds
unit_amount
Unit amount of the lineitem.
in cents
quantity
Quantity of the recurring item which is represented by this lineitem.
optional, integer, default=1
is_taxed
Specifies whether this line item is taxed or not.
boolean, default=false
tax_amount
The tax amount charged for this item.
optional, in cents, default=0, min=0
tax_rate
Rate of tax used to calculate tax for this lineitem.
optional, double, min=0.0, max=100.0
amount
Total amount of this lineitem. Typically equals to unit amount x quantity.
in cents
discount_amount
Total discounts for this line.
optional, in cents, min=0
item_level_discount_amount
'Item' level discounts for this line.
optional, in cents, min=0
description
Detailed description about this lineitem.
string, max chars=250
entity_type
Specifies the modelled entity (plan / addon etc) this lineitem is based on.
enumerated string
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.
tax_exempt_reason
The reason or category due to which the line item price/amount is excluded from taxable amount.
optional, enumerated string
Possible values are
tax_not_configuredIf tax is not enabled for the site.region_non_taxableIf the product sold is not taxable in this region, but it is taxable in other regions, hence this region is not part of the Taxable jurisdiction.exportIf the Merchant is not registered for Tax in this region, taxes will not be applied.customer_exemptIf the Customer is marked as Tax exempt.product_exemptIf the Plan or Addon is marked as Tax exempt.zero_ratedIf the rate of tax is 0% and no Sales/ GST tax is collectable for that line item.reverse_chargeIf the Customer is identified as B2B customer (when VAT Number is entered), applicable for EU only .
entity_id
The identifier of the modelled entity this lineitem is based on. Will be null for 'adhoc' entity type.
optional, string, max chars=50
discounts
Show attributes[+]
The list of discounts applied to this estimate.
optional, list of discount
Discount attributes
amount
Discount amount.
in cents, min=0
description
Detailed description of this discount line item.
optional, string, max chars=250
entity_type
Type of this Discount lineitem.
enumerated string
Possible values are
item_level_couponRepresents the 'Item' level coupons applied to this invoice. Further the 'entity_id' attribute specifies the coupon id this discount is based on.document_level_couponRepresents the 'Document' level coupons applied to this document. Further the 'entity_id' attribute specifies the coupon id this discount is based on.promotional_creditsRepresents the Promotional Credits item in invoice. The 'entity_id' attribute will be null in this case.prorated_creditsRepresents the credit adjustment items in invoice. The 'entity_id' attribute will be null in this case.
entity_id
The identifier of the modelled entity this lineitem is bases on. Will be null for 'Prorated Credits' & 'Promotional Credits'.
optional, string, max chars=100
The list of taxes applied to this estimate.
optional, list of tax
Tax attributes
name
The name of the tax applied. E.g. GST.
string, max chars=100
amount
The tax amount.
in cents, min=0
description
Description of the tax item.
optional, string, max chars=250
line_item_taxes
Show attributes[+]
The list of taxes applied on line items.
optional, list of line_item_tax
Line item tax attributes
line_item_id
The unique reference id of the line item for which the tax is applicable.
optional, string, max chars=40
tax_name
The name of the tax applied.
string, max chars=100
tax_rate
The rate of tax used to calculate tax amount.
double, default=0.0, min=0.0, max=100.0
tax_amount
The tax amount.
in cents, min=0
tax_juris_type
The type of tax jurisdiction.
optional, enumerated string
Possible values are
countryThe tax jurisdiction is a country.stateThe tax jurisdiction is a state.countyThe tax jurisdiction is a county.cityThe tax jurisdiction is a city.specialSpecial tax jurisdiction.otherJurisdictions other than the ones listed above.
tax_juris_name
The name of the tax jurisdiction.
optional, string, max chars=250
tax_juris_code
The tax jurisdiction code.
optional, string, max chars=250
line_item_discounts
Show attributes[+]
The list of discount(s) applied for each line item of this invoice.
optional, list of line_item_discount
Line item discount attributes
line_item_id
The unique reference id of the line item for which the discount is applicable.
string, max chars=50
discount_type
Type of this discount line item.
enumerated string
Possible values are
item_level_couponRepresents the 'Item' level coupons applied to this invoice. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.document_level_couponRepresents the 'Document' level coupons applied to this document. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.promotional_creditsRepresents the Promotional Credits item in invoice. The 'coupon_id' attribute will be null in this case.prorated_creditsRepresents the credit adjustment items in invoice. The 'coupon_id' attribute will be null in this case.
coupon_id
Coupon id.
optional, string, max chars=50
discount_amount
Discount amount.
in cents, min=0
recurring
Will be 'true' for subscription related estimates.
boolean, default=true
price_type
The price type of this invoice.
enumerated string, default=tax_exclusive
Possible values are
tax_exclusiveAll amounts in the document are exclusive of tax.tax_inclusiveAll amounts in the document are inclusive of tax.
currency_code
The currency code (ISO 4217 format) of the invoice.
string, max chars=3
sub_total
Invoice sub-total in cents.
in cents, min=0
total
Invoice total in cents.
optional, in cents, default=0, min=0
credits_applied
credits applied to this invoice in cents.
optional, in cents, default=0, min=0
amount_paid
Existing outstanding payments if any, applied to this invoice in cents.
optional, in cents, default=0, min=0
amount_due
Invoice amount due in cents.
optional, in cents, default=0, min=0
line_items
Show attributes[+]
The list of items in this estimate.
optional, list of line_item
Line item attributes
id
Uniquely identifies a line_item.
optional, string, max chars=40
subscription_id
A unique identifier for the subscription this lineitem belongs to.
optional, string, max chars=3
date_from
Start date of this lineitem.
timestamp(UTC) in seconds
date_to
End date of this lineitem.
timestamp(UTC) in seconds
unit_amount
Unit amount of the lineitem.
in cents
quantity
Quantity of the recurring item which is represented by this lineitem.
optional, integer, default=1
is_taxed
Specifies whether this line item is taxed or not.
boolean, default=false
tax_amount
The tax amount charged for this item.
optional, in cents, default=0, min=0
tax_rate
Rate of tax used to calculate tax for this lineitem.
optional, double, min=0.0, max=100.0
amount
Total amount of this lineitem. Typically equals to unit amount x quantity.
in cents
discount_amount
Total discounts for this line.
optional, in cents, min=0
item_level_discount_amount
'Item' level discounts for this line.
optional, in cents, min=0
description
Detailed description about this lineitem.
string, max chars=250
entity_type
Specifies the modelled entity (plan / addon etc) this lineitem is based on.
enumerated string
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.
tax_exempt_reason
The reason or category due to which the line item price/amount is excluded from taxable amount.
optional, enumerated string
Possible values are
tax_not_configuredIf tax is not enabled for the site.region_non_taxableIf the product sold is not taxable in this region, but it is taxable in other regions, hence this region is not part of the Taxable jurisdiction.exportIf the Merchant is not registered for Tax in this region, taxes will not be applied.customer_exemptIf the Customer is marked as Tax exempt.product_exemptIf the Plan or Addon is marked as Tax exempt.zero_ratedIf the rate of tax is 0% and no Sales/ GST tax is collectable for that line item.reverse_chargeIf the Customer is identified as B2B customer (when VAT Number is entered), applicable for EU only .
entity_id
The identifier of the modelled entity this lineitem is based on. Will be null for 'adhoc' entity type.
optional, string, max chars=50
discounts
Show attributes[+]
The list of discounts applied to this estimate.
optional, list of discount
Discount attributes
amount
Discount amount.
in cents, min=0
description
Detailed description of this discount line item.
optional, string, max chars=250
entity_type
Type of this Discount lineitem.
enumerated string
Possible values are
item_level_couponRepresents the 'Item' level coupons applied to this invoice. Further the 'entity_id' attribute specifies the coupon id this discount is based on.document_level_couponRepresents the 'Document' level coupons applied to this document. Further the 'entity_id' attribute specifies the coupon id this discount is based on.promotional_creditsRepresents the Promotional Credits item in invoice. The 'entity_id' attribute will be null in this case.prorated_creditsRepresents the credit adjustment items in invoice. The 'entity_id' attribute will be null in this case.
entity_id
The identifier of the modelled entity this lineitem is bases on. Will be null for 'Prorated Credits' & 'Promotional Credits'.
optional, string, max chars=100
The list of taxes applied to this estimate.
optional, list of tax
Tax attributes
name
The name of the tax applied. E.g. GST.
string, max chars=100
amount
The tax amount.
in cents, min=0
description
Description of the tax item.
optional, string, max chars=250
line_item_taxes
Show attributes[+]
The list of taxes applied on line items.
optional, list of line_item_tax
Line item tax attributes
line_item_id
The unique reference id of the line item for which the tax is applicable.
optional, string, max chars=40
tax_name
The name of the tax applied.
string, max chars=100
tax_rate
The rate of tax used to calculate tax amount.
double, default=0.0, min=0.0, max=100.0
tax_amount
The tax amount.
in cents, min=0
tax_juris_type
The type of tax jurisdiction.
optional, enumerated string
Possible values are
countryThe tax jurisdiction is a country.stateThe tax jurisdiction is a state.countyThe tax jurisdiction is a county.cityThe tax jurisdiction is a city.specialSpecial tax jurisdiction.otherJurisdictions other than the ones listed above.
tax_juris_name
The name of the tax jurisdiction.
optional, string, max chars=250
tax_juris_code
The tax jurisdiction code.
optional, string, max chars=250
line_item_discounts
Show attributes[+]
The list of discount(s) applied for each line item of this invoice.
optional, list of line_item_discount
Line item discount attributes
line_item_id
The unique reference id of the line item for which the discount is applicable.
string, max chars=50
discount_type
Type of this discount line item.
enumerated string
Possible values are
item_level_couponRepresents the 'Item' level coupons applied to this invoice. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.document_level_couponRepresents the 'Document' level coupons applied to this document. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.promotional_creditsRepresents the Promotional Credits item in invoice. The 'coupon_id' attribute will be null in this case.prorated_creditsRepresents the credit adjustment items in invoice. The 'coupon_id' attribute will be null in this case.
coupon_id
Coupon id.
optional, string, max chars=50
discount_amount
Discount amount.
in cents, min=0
recurring
Will be 'true' for subscription related estimates.
boolean, default=true
price_type
The price type of this invoice.
enumerated string, default=tax_exclusive
Possible values are
tax_exclusiveAll amounts in the document are exclusive of tax.tax_inclusiveAll amounts in the document are inclusive of tax.
currency_code
The currency code (ISO 4217 format) of the invoice.
string, max chars=3
sub_total
Invoice sub-total in cents.
in cents, min=0
total
Invoice total in cents.
optional, in cents, default=0, min=0
credits_applied
credits applied to this invoice in cents.
optional, in cents, default=0, min=0
amount_paid
Existing outstanding payments if any, applied to this invoice in cents.
optional, in cents, default=0, min=0
amount_due
Invoice amount due in cents.
optional, in cents, default=0, min=0
line_items
Show attributes[+]
The list of items in this estimate.
optional, list of line_item
Line item attributes
id
Uniquely identifies a line_item.
optional, string, max chars=40
subscription_id
A unique identifier for the subscription this lineitem belongs to.
optional, string, max chars=3
date_from
Start date of this lineitem.
timestamp(UTC) in seconds
date_to
End date of this lineitem.
timestamp(UTC) in seconds
unit_amount
Unit amount of the lineitem.
in cents
quantity
Quantity of the recurring item which is represented by this lineitem.
optional, integer, default=1
is_taxed
Specifies whether this line item is taxed or not.
boolean, default=false
tax_amount
The tax amount charged for this item.
optional, in cents, default=0, min=0
tax_rate
Rate of tax used to calculate tax for this lineitem.
optional, double, min=0.0, max=100.0
amount
Total amount of this lineitem. Typically equals to unit amount x quantity.
in cents
discount_amount
Total discounts for this line.
optional, in cents, min=0
item_level_discount_amount
'Item' level discounts for this line.
optional, in cents, min=0
description
Detailed description about this lineitem.
string, max chars=250
entity_type
Specifies the modelled entity (plan / addon etc) this lineitem is based on.
enumerated string
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.
tax_exempt_reason
The reason or category due to which the line item price/amount is excluded from taxable amount.
optional, enumerated string
Possible values are
tax_not_configuredIf tax is not enabled for the site.region_non_taxableIf the product sold is not taxable in this region, but it is taxable in other regions, hence this region is not part of the Taxable jurisdiction.exportIf the Merchant is not registered for Tax in this region, taxes will not be applied.customer_exemptIf the Customer is marked as Tax exempt.product_exemptIf the Plan or Addon is marked as Tax exempt.zero_ratedIf the rate of tax is 0% and no Sales/ GST tax is collectable for that line item.reverse_chargeIf the Customer is identified as B2B customer (when VAT Number is entered), applicable for EU only .
entity_id
The identifier of the modelled entity this lineitem is based on. Will be null for 'adhoc' entity type.
optional, string, max chars=50
discounts
Show attributes[+]
The list of discounts applied to this estimate.
optional, list of discount
Discount attributes
amount
Discount amount.
in cents, min=0
description
Detailed description of this discount line item.
optional, string, max chars=250
entity_type
Type of this Discount lineitem.
enumerated string
Possible values are
item_level_couponRepresents the 'Item' level coupons applied to this invoice. Further the 'entity_id' attribute specifies the coupon id this discount is based on.document_level_couponRepresents the 'Document' level coupons applied to this document. Further the 'entity_id' attribute specifies the coupon id this discount is based on.promotional_creditsRepresents the Promotional Credits item in invoice. The 'entity_id' attribute will be null in this case.prorated_creditsRepresents the credit adjustment items in invoice. The 'entity_id' attribute will be null in this case.
entity_id
The identifier of the modelled entity this lineitem is bases on. Will be null for 'Prorated Credits' & 'Promotional Credits'.
optional, string, max chars=100
The list of taxes applied to this estimate.
optional, list of tax
Tax attributes
name
The name of the tax applied. E.g. GST.
string, max chars=100
amount
The tax amount.
in cents, min=0
description
Description of the tax item.
optional, string, max chars=250
line_item_taxes
Show attributes[+]
The list of taxes applied on line items.
optional, list of line_item_tax
Line item tax attributes
line_item_id
The unique reference id of the line item for which the tax is applicable.
optional, string, max chars=40
tax_name
The name of the tax applied.
string, max chars=100
tax_rate
The rate of tax used to calculate tax amount.
double, default=0.0, min=0.0, max=100.0
tax_amount
The tax amount.
in cents, min=0
tax_juris_type
The type of tax jurisdiction.
optional, enumerated string
Possible values are
countryThe tax jurisdiction is a country.stateThe tax jurisdiction is a state.countyThe tax jurisdiction is a county.cityThe tax jurisdiction is a city.specialSpecial tax jurisdiction.otherJurisdictions other than the ones listed above.
tax_juris_name
The name of the tax jurisdiction.
optional, string, max chars=250
tax_juris_code
The tax jurisdiction code.
optional, string, max chars=250
line_item_discounts
Show attributes[+]
The list of discount(s) applied for each line item of this invoice.
optional, list of line_item_discount
Line item discount attributes
line_item_id
The unique reference id of the line item for which the discount is applicable.
string, max chars=50
discount_type
Type of this discount line item.
enumerated string
Possible values are
item_level_couponRepresents the 'Item' level coupons applied to this invoice. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.document_level_couponRepresents the 'Document' level coupons applied to this document. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.promotional_creditsRepresents the Promotional Credits item in invoice. The 'coupon_id' attribute will be null in this case.prorated_creditsRepresents the credit adjustment items in invoice. The 'coupon_id' attribute will be null in this case.
coupon_id
Coupon id.
optional, string, max chars=50
discount_amount
Discount amount.
in cents, min=0
reference_invoice_id
The reference invoice id.
string, max chars=50
type
credit note type.
enumerated string
Possible values are
adjustmentAdjustment Credit Note.refundableRefundable Credit Note.
price_type
The price type of this credit note.
enumerated string, default=tax_exclusive
Possible values are
tax_exclusiveAll amounts in the document are exclusive of tax.tax_inclusiveAll amounts in the document are inclusive of tax.
currency_code
The currency code (ISO 4217 format) of the credit note.
string, max chars=3
sub_total
Invoice sub-total in cents.
in cents, min=0
total
CreditNote total in cents.
in cents, min=0
amount_allocated
Allocated credits in cents.
in cents, min=0
amount_available
Remaining credits in cents.
in cents, min=0
line_items
Show attributes[+]
The list of items in this estimate.
optional, list of line_item
Line item attributes
id
Uniquely identifies a line_item.
optional, string, max chars=40
subscription_id
A unique identifier for the subscription this lineitem belongs to.
optional, string, max chars=3
date_from
Start date of this lineitem.
timestamp(UTC) in seconds
date_to
End date of this lineitem.
timestamp(UTC) in seconds
unit_amount
Unit amount of the lineitem.
in cents
quantity
Quantity of the recurring item which is represented by this lineitem.
optional, integer, default=1
is_taxed
Specifies whether this line item is taxed or not.
boolean, default=false
tax_amount
The tax amount charged for this item.
optional, in cents, default=0, min=0
tax_rate
Rate of tax used to calculate tax for this lineitem.
optional, double, min=0.0, max=100.0
amount
Total amount of this lineitem. Typically equals to unit amount x quantity.
in cents
discount_amount
Total discounts for this line.
optional, in cents, min=0
item_level_discount_amount
'Item' level discounts for this line.
optional, in cents, min=0
description
Detailed description about this lineitem.
string, max chars=250
entity_type
Specifies the modelled entity (plan / addon etc) this lineitem is based on.
enumerated string
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.
tax_exempt_reason
The reason or category due to which the line item price/amount is excluded from taxable amount.
optional, enumerated string
Possible values are
tax_not_configuredIf tax is not enabled for the site.region_non_taxableIf the product sold is not taxable in this region, but it is taxable in other regions, hence this region is not part of the Taxable jurisdiction.exportIf the Merchant is not registered for Tax in this region, taxes will not be applied.customer_exemptIf the Customer is marked as Tax exempt.product_exemptIf the Plan or Addon is marked as Tax exempt.zero_ratedIf the rate of tax is 0% and no Sales/ GST tax is collectable for that line item.reverse_chargeIf the Customer is identified as B2B customer (when VAT Number is entered), applicable for EU only .
entity_id
The identifier of the modelled entity this lineitem is based on. Will be null for 'adhoc' entity type.
optional, string, max chars=50
discounts
Show attributes[+]
The list of discounts applied to this estimate.
optional, list of discount
Discount attributes
amount
Discount amount.
in cents, min=0
description
Detailed description of this discount line item.
optional, string, max chars=250
entity_type
Type of this Discount lineitem.
enumerated string
Possible values are
item_level_couponRepresents the 'Item' level coupons applied to this invoice. Further the 'entity_id' attribute specifies the coupon id this discount is based on.document_level_couponRepresents the 'Document' level coupons applied to this document. Further the 'entity_id' attribute specifies the coupon id this discount is based on.promotional_creditsRepresents the Promotional Credits item in invoice. The 'entity_id' attribute will be null in this case.prorated_creditsRepresents the credit adjustment items in invoice. The 'entity_id' attribute will be null in this case.
entity_id
The identifier of the modelled entity this lineitem is bases on. Will be null for 'Prorated Credits' & 'Promotional Credits'.
optional, string, max chars=100
The list of taxes applied to this estimate.
optional, list of tax
Tax attributes
name
The name of the tax applied. E.g. GST.
string, max chars=100
amount
The tax amount.
in cents, min=0
description
Description of the tax item.
optional, string, max chars=250
line_item_taxes
Show attributes[+]
The list of taxes applied on line items.
optional, list of line_item_tax
Line item tax attributes
line_item_id
The unique reference id of the line item for which the tax is applicable.
optional, string, max chars=40
tax_name
The name of the tax applied.
string, max chars=100
tax_rate
The rate of tax used to calculate tax amount.
double, default=0.0, min=0.0, max=100.0
tax_amount
The tax amount.
in cents, min=0
tax_juris_type
The type of tax jurisdiction.
optional, enumerated string
Possible values are
countryThe tax jurisdiction is a country.stateThe tax jurisdiction is a state.countyThe tax jurisdiction is a county.cityThe tax jurisdiction is a city.specialSpecial tax jurisdiction.otherJurisdictions other than the ones listed above.
tax_juris_name
The name of the tax jurisdiction.
optional, string, max chars=250
tax_juris_code
The tax jurisdiction code.
optional, string, max chars=250
line_item_discounts
Show attributes[+]
The list of discount(s) applied for each line item of this invoice.
optional, list of line_item_discount
Line item discount attributes
line_item_id
The unique reference id of the line item for which the discount is applicable.
string, max chars=50
discount_type
Type of this discount line item.
enumerated string
Possible values are
item_level_couponRepresents the 'Item' level coupons applied to this invoice. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.document_level_couponRepresents the 'Document' level coupons applied to this document. Further the 'coupon_id' attribute specifies the coupon id this discount is based on.promotional_creditsRepresents the Promotional Credits item in invoice. The 'coupon_id' attribute will be null in this case.prorated_creditsRepresents the credit adjustment items in invoice. The 'coupon_id' attribute will be null in this case.
coupon_id
Coupon id.
optional, string, max chars=50
discount_amount
Discount amount.
in cents, min=0
id
Uniquely identifies an unbilled charge.
optional, string, max chars=50
customer_id
A unique identifier for the customer being charged.
optional, string, max chars=50
subscription_id
A unique identifier for the subscription this charge belongs to.
optional, string, max chars=50
date_from
Start date of this charge.
optional, timestamp(UTC) in seconds
date_to
Start date of this charge.
optional, timestamp(UTC) in seconds
unit_amount
Unit amount of the charge item.
optional, in cents, min=0
quantity
Quantity of the item which is represented by this charge.
optional, integer, min=0
amount
Total amount of this charge. Typically equals to unit amount x quantity.
optional, in cents, min=0
currency_code
The currency code (ISO 4217 format) for the charge.
string, max chars=3
discount_amount
Total discounts for this charge.
optional, in cents, min=0
description
Detailed description about this charge.
optional, string, max chars=250
entity_type
Specifies the modelled entity (plan / addon etc) this lineitem is based on.
enumerated string
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
The identifier of the modelled entity this charge is based on. Will be null for 'adhoc' entity type.
optional, string, max chars=100
is_voided
Will be true if the charge has been voided. Usually the unbilled charge will be voided and revised to different charges(s) during proration.
boolean, default=false
voided_at
Timestamp indicating the date and time this charge got voided.
optional, timestamp(UTC) in seconds

Generates an estimate for the 'create subscription' operation. This is similar to the Create Subscription API but no subscription will be created, only an estimate for this operation is created.

In the response,

  • estimate.subscription_estimate has the subscription details like the status of the subscription (in_trial, active, etc.), next billing date, and so on.
  • estimate.invoice_estimate has details of the invoice that will be generated immediately. This will not be present if no immediate invoice is generated for this operation.
  • estimate.next_invoice_estimate has details of the invoice that will be generated on the next billing date of this subscription. This will be present only if no immediate invoice is generated during this operation and this subscription has next billing.

    If the subscription is created in trial/future states, estimate.invoice_estimate will not be present as no immediate invoice would be generated. However, estimate.next_invoice_estimate will be returned which is a preview of the invoice that would be generated at a later date when the subscription becomes 'active'.

  • estimate.unbilled_charge_estimates has details of the unbilled charges. This is returned only if invoice_immediately is set as true. But this is not applicable for the ‘Subscription renewal estimate’ operation.

Note: If you have configured EU VAT or Customized taxes, you need to specify the applicable parameters for calculating taxes - billing_address[], shipping_address[], customer[vat_number], customer[taxability] etc. Otherwise tax calculation will be ignored.

Related Tutorial

Sample Request
curl  https://{site}.chargebee.com/api/v2/estimates/create_subscription \
     -u {site_api_key}: \
     -d subscription[plan_id]="basic" \
     -d billing_address[line1]="PO Box 9999" \
     -d billing_address[city]="Walnut" \
     -d billing_address[zip]="91789" \
     -d billing_address[country]="US"
copy
curl  https://{site}.chargebee.com/api/v2/estimates/create_subscription \
     -u {site_api_key}: \
     -d subscription[plan_id]="basic" \
     -d billing_address[line1]="PO Box 9999" \
     -d billing_address[city]="Walnut" \
     -d billing_address[zip]="91789" \
     -d billing_address[country]="US"

Sample Response [ JSON ]

{"estimate": { "created_at": 1501853769, "object": "estimate", "subscription_estimate": { "status": "in_trial", "next_billing_at": 1504532169, "object": "subscription_estimate", "currency_code": "USD" }, "next_invoice_estimate": { "recurring": true, "price_type": "tax_exclusive", "sub_total": 900, "total": 900, "credits_applied": 0, "amount_paid": 0, "amount_due": 900, "object": "invoice_estimate", "line_items": [ { "id": "li_XpbKGJ9QRL7MSyET", "date_from": 1504532169, "date_to": 1507124169, "unit_amount": 900, "quantity": 1, "is_taxed": false, "tax_amount": 0, "object": "line_item", "amount": 900, "description": "sample plan", "entity_type": "plan", "entity_id": "basic", "discount_amount": 0, "item_level_discount_amount": 0 }, {..} ], "taxes": [], "line_item_taxes": [], "currency_code": "USD", "line_item_discounts": [] } }}

URL Format POST

https://{site}.chargebee.com/api/v2/estimates/create_subscription
billing_cycles
Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled.
optional, integer, min=0
terms_to_charge
The number of future renewals for which advance invoicing is done. However, if a new term gets started in this operation, the specified terms_to_charge will be inclusive of this new term.
optional, integer, min=1
billing_alignment_mode
Applicable when calendar billing is enabled and subscription is getting created in active / non_renewing states. Unless specified the configured default value will be used.
optional, enumerated string
Possible values are
immediateSubscription period will be aligned with the configured billing date immediately.delayedSubscription period will be aligned with the configured billing date at a later date (subsequent renewals).
referral_details
Referral Details to apply for this subscription.
optional, string, max chars=500
coupon_ids[0..n]
Identifier of the coupon as a List. Coupon Codes can also be passed.
optional, list of string
invoice_immediately
Applicable when charges gets added during this operation. If specified as false, these charges will be added to the unbilled charges instead of getting invoiced immediately.
optional, boolean, default=true
subscription
Parameters for subscription
pass parameters as subscription[<param name>]
subscription[id]
A unique identifier to identify the subscription. You will use this to perform all operations on this subscription.
optional, string, max chars=50
subscription[plan_id]
Identifier of the plan for this subscription.
required, string, max chars=100
subscription[plan_quantity]
Plan quantity for this subscription.
optional, integer, default=1, min=1
subscription[plan_unit_price]
Amount that will override the Plan's default price.
optional, in cents, min=0
subscription[setup_fee]
Amount that will override the default setup fee.
optional, in cents, min=0
subscription[start_date]
Specify this if you want to start the subscription at a future date instead of starting it immediately.
optional, timestamp(UTC) in seconds
subscription[trial_end]
The time at which the trial ends for this subscription. Can be specified to override the default trial period.If '0' is passed, the subscription will be activated immediately.
optional, timestamp(UTC) in seconds
billing_address
Parameters for billing_address
pass parameters as billing_address[<param name>]
billing_address[line1]
Address line 1.
optional, string, max chars=150
billing_address[line2]
Address line 2.
optional, string, max chars=150
billing_address[line3]
Address line 3.
optional, string, max chars=150
billing_address[city]
City.
optional, string, max chars=50
billing_address[state_code]
The ISO 3166-2 state/province code. The recommended way of passing the state/province information. Supported for US, Canada and India now. Further if this is specified, 'state' attribute should not be specified as it will be set automatically.
optional, string, max chars=50
billing_address[zip]
Zip or Postal code.
optional, string, max chars=20
billing_address[country]
2-letter ISO 3166 alpha-2 country code.
optional, string, max chars=50
billing_address[validation_status]
The address verification status.
optional, enumerated string, default=not_validated
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
shipping_address
Parameters for shipping_address
pass parameters as shipping_address[<param name>]
shipping_address[line1]
Address line 1.
optional, string, max chars=180
shipping_address[line2]
Address line 2.
optional, string, max chars=150
shipping_address[line3]
Address line 3.
optional, string, max chars=150
shipping_address[city]
City.
optional, string, max chars=50
shipping_address[state_code]
The ISO 3166-2 state/province code. The recommended way of passing the state/province information. Supported for US, Canada and India now. Further if this is specified, 'state' attribute should not be specified as it will be set automatically.
optional, string, max chars=50
shipping_address[zip]
Zip or Postal code.
optional, string, max chars=20
shipping_address[country]
2-letter ISO 3166 alpha-2 country code.
optional, string, max chars=50
shipping_address[validation_status]
The address verification status.
optional, enumerated string, default=not_validated
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
customer
Parameters for customer
pass parameters as customer[<param name>]
customer[vat_number]
VAT number of this customer. VIES validation will not happen for this parameter.
optional, string, max chars=20
customer[taxability]
Specifies if the customer is liable for tax.
optional, enumerated string, default=taxable
Possible values are
taxableCustomer is taxable.exemptCustomer is exempted from tax.
customer[entity_code]
The exemption category of the customer, for the USA and Canada. applicable if you use Chargebee's Avalara integration.
optional, enumerated string
Possible values are
aFederal government (United States).bState government (United States).cTribe/Status Indian/Indian Band (both).dForeign diplomat (both).
eCharitable or benevolent org (both).fReligious or educational org (both).gResale (both).hCommercial agricultural production (both).iIndustrial production/manufacturer (both).jDirect pay permit (United States).kDirect mail (United States).lOther (both).nLocal government (United States).pCommercial aquaculture (Canada).qCommercial Fishery (Canada).rNon-resident (Canada).med1US Medical Device Excise Tax with exempt sales tax.med2US Medical Device Excise Tax with taxable sales tax.
Show all values[+]
customer[exempt_number]
Any string value that will cause the sale to be exempted. Use this if your finance team manually verifies and tracks exemption certificates. Applicable only for Avalara.
optional, string, max chars=100
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]
Identifier of the addon. Multiple addons can be passed.
optional, string, max chars=100
addons[quantity][0..n]
Addon quantity. Applicable only for the quantity based addons. Should be passed with the same index as that of associated addon id.
optional, integer, default=1, min=1
addons[unit_price][0..n]
Amount that will override the Addon's default price. The Plan's billing frequency will not be considered for overriding. E.g. If the Plan's billing frequency is every 3 months, and if the price override amount is $10, $10 will be used, and not $30 (i.e $10*3).
optional, in cents, min=0
addons[trial_end][0..n]
The time at which the trial ends for the addon. In order to use this param please contact support@chargebee.com.
optional, timestamp(UTC) in seconds
Resource object representing estimate.
always returned
Sample Request
curl  https://{site}.chargebee.com/api/v2/customers/4gkYnd21ouvW/create_subscription_estimate \
     -G  \
     -u {site_api_key}: \
     --data-urlencode subscription[plan_id]="basic"
copy
curl  https://{site}.chargebee.com/api/v2/customers/4gkYnd21ouvW/create_subscription_estimate \
     -G  \
     -u {site_api_key}: \
     --data-urlencode subscription[plan_id]="basic"

Sample Response [ JSON ]

{"estimate": { "created_at": 1501853769, "object": "estimate", "subscription_estimate": { "status": "in_trial", "next_billing_at": 1504532169, "object": "subscription_estimate", "currency_code": "USD" }, "next_invoice_estimate": { "recurring": true, "price_type": "tax_exclusive", "sub_total": 900, "total": 900, "credits_applied": 0, "amount_paid": 0, "amount_due": 900, "object": "invoice_estimate", "line_items": [ { "id": "li_XpbKGJ9QRL7MVOEW", "date_from": 1504532169, "date_to": 1507124169, "unit_amount": 900, "quantity": 1, "is_taxed": false, "tax_amount": 0, "object": "line_item", "amount": 900, "description": "sample plan", "entity_type": "plan", "entity_id": "basic", "discount_amount": 0, "item_level_discount_amount": 0 }, {..} ], "taxes": [], "line_item_taxes": [], "currency_code": "USD", "line_item_discounts": [] } }}

URL Format GET

https://{site}.chargebee.com/api/v2/customers/{customer_id}/create_subscription_estimate
use_existing_balances
If true, all the existing balances - promotional credits, refundable credits and excess payments - will be included for the invoice estimate.
optional, boolean, default=true
invoice_immediately
Applicable when charges gets added during this operation. If specified as false, these charges will be added to the unbilled charges instead of getting invoiced immediately.
optional, boolean, default=true
billing_cycles
Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled.
optional, integer, min=0
terms_to_charge
The number of future renewals for which advance invoicing is done. However, if a new term gets started in this operation, the specified terms_to_charge will be inclusive of this new term.
optional, integer, min=1
billing_alignment_mode
Applicable when calendar billing is enabled and subscription is getting created in active / non_renewing states. Unless specified the configured default value will be used.
optional, enumerated string
Possible values are
immediateSubscription period will be aligned with the configured billing date immediately.delayedSubscription period will be aligned with the configured billing date at a later date (subsequent renewals).
referral_details
Referral Details to apply for this subscription.
optional, string, max chars=500
coupon_ids[0..n]
Identifier of the coupon as a List. Coupon Codes can also be passed.
optional, list of string
subscription
Parameters for subscription
pass parameters as subscription[<param name>]
subscription[id]
A unique identifier to identify the subscription. You will use this to perform all operations on this subscription.
optional, string, max chars=50
subscription[plan_id]
Identifier of the plan for this subscription.
required, string, max chars=100
subscription[plan_quantity]
Plan quantity for this subscription.
optional, integer, default=1, min=1
subscription[plan_unit_price]
Amount that will override the Plan's default price.
optional, in cents, min=0
subscription[setup_fee]
Amount that will override the default setup fee.
optional, in cents, min=0
subscription[start_date]
Specify this if you want to start the subscription at a future date instead of starting it immediately.
optional, timestamp(UTC) in seconds
subscription[trial_end]
The time at which the trial ends for this subscription. Can be specified to override the default trial period.If '0' is passed, the subscription will be activated immediately.
optional, timestamp(UTC) in seconds
shipping_address
Parameters for shipping_address
pass parameters as shipping_address[<param name>]
shipping_address[line1]
Address line 1.
optional, string, max chars=180
shipping_address[line2]
Address line 2.
optional, string, max chars=150
shipping_address[line3]
Address line 3.
optional, string, max chars=150
shipping_address[city]
City.
optional, string, max chars=50
shipping_address[state_code]
The ISO 3166-2 state/province code. The recommended way of passing the state/province information. Supported for US, Canada and India now. Further if this is specified, 'state' attribute should not be specified as it will be set automatically.
optional, string, max chars=50
shipping_address[zip]
Zip or Postal code.
optional, string, max chars=20
shipping_address[country]
2-letter ISO 3166 alpha-2 country code.
optional, string, max chars=50
shipping_address[validation_status]
The address verification status.
optional, enumerated string, default=not_validated
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
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]
Identifier of the addon. Multiple addons can be passed.
optional, string, max chars=100
addons[quantity][0..n]
Addon quantity. Applicable only for the quantity based addons. Should be passed with the same index as that of associated addon id.
optional, integer, default=1, min=1
addons[unit_price][0..n]
Amount that will override the Addon's default price. The Plan's billing frequency will not be considered for overriding. E.g. If the Plan's billing frequency is every 3 months, and if the price override amount is $10, $10 will be used, and not $30 (i.e $10*3).
optional, in cents, min=0
addons[trial_end][0..n]
The time at which the trial ends for the addon. In order to use this param please contact support@chargebee.com.
optional, timestamp(UTC) in seconds
Resource object representing estimate.
always returned

Generates an estimate for the 'update subscription' operation. The input will be similar to the Update Subscription API but subscription will not be updated, only an estimate will be created.

In the response,

  • estimate.subscription_estimate has the subscription details like the status of the subscription (in_trial, active, etc.), next billing date, and so on.
  • estimate.invoice_estimate has details of the invoice that will be generated immediately. This will not be present if no immediate invoice is generated for this operation. This will happen when
    • end_of_term parameter is true
    • prorate parameter is false
    • No recurring items (plan and addons) are changed . E.g. only a coupon is applied or billing_cycles is updated.
    • For certain types of changes - like plan/addon quantity downgrades - only Credit Notes will be created and no invoice gets generated.
  • estimate.next_invoice_estimate has details of the invoice that will be generated during the next billing date of this subscription. This will be present only if no immediate invoice is generated during this operation (scenarios mentioned above) and this subscription has next billing.

    The generated invoice_estimate/next_invoice_estimate will include all the balances - Promotional Credits, Refundable Credits, and Excess Payments - if any. If you don’t want these balances to be included you can specify 'false' for the parameter use_existing_balances.

  • estimate.credit_note_estimates[] has details of the credit-notes that will get generated during this operation. This list will be empty if no credit-note gets generated during this operation.
  • estimate.unbilled_charge_estimates has details of the unbilled charges. This is returned only if invoice_immediately is set as false. But this is not applicable for the ‘Subscription renewal estimate’ operation.

Note: If you have configured EU VAT or Customized taxes, you need to specify the applicable parameters for calculating taxes - billing_address[], shipping_address[], customer[vat_number], customer[taxability] etc. Otherwise tax calculation will be ignored.

Sample Request
curl  https://{site}.chargebee.com/api/v2/estimates/update_subscription \
     -u {site_api_key}: \
     -d subscription[id]="5cDfREwp3I5lJ" \
     -d subscription[plan_id]="basic" \
     -d billing_address[line1]="PO Box 9999" \
     -d billing_address[city]="Walnut" \
     -d billing_address[zip]="91789" \
     -d billing_address[country]="US"
copy
curl  https://{site}.chargebee.com/api/v2/estimates/update_subscription \
     -u {site_api_key}: \
     -d subscription[id]="5cDfREwp3I5lJ" \
     -d subscription[plan_id]="basic" \
     -d billing_address[line1]="PO Box 9999" \
     -d billing_address[city]="Walnut" \
     -d billing_address[zip]="91789" \
     -d billing_address[country]="US"

Sample Response [ JSON ]

{"estimate": { "created_at": 1501853769, "object": "estimate", "subscription_estimate": { "id": "5cDfREwp3I5lJ", "status": "active", "next_billing_at": 1504366475, "object": "subscription_estimate", "currency_code": "USD" }, "next_invoice_estimate": { "recurring": true, "price_type": "tax_exclusive", "sub_total": 900, "total": 900, "credits_applied": 0, "amount_paid": 0, "amount_due": 900, "object": "invoice_estimate", "line_items": [ { "id": "li_XpbKGJ9QRL7MYPEZ", "date_from": 1504366475, "date_to": 1506958475, "unit_amount": 900, "quantity": 1, "is_taxed": false, "tax_amount": 0, "object": "line_item", "subscription_id": "5cDfREwp3I5lJ", "amount": 900, "description": "sample plan", "entity_type": "plan", "entity_id": "basic", "discount_amount": 0, "item_level_discount_amount": 0 }, {..} ], "taxes": [], "line_item_taxes": [], "currency_code": "USD", "line_item_discounts": [] }, "credit_note_estimates": [] }}

URL Format POST

https://{site}.chargebee.com/api/v2/estimates/update_subscription
billing_cycles
Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled.
optional, integer, min=0
replace_addon_list
Should be true if the existing addons should be replaced with the ones that are being passed.
optional, boolean, default=false
terms_to_charge
The number of future renewals for which advance invoicing is done. However, if a new term gets started in this operation, the specified terms_to_charge will be inclusive of this new term.
optional, integer, min=1
reactivate_from
The time from which this subscription should be reactivated.
optional, timestamp(UTC) in seconds
billing_alignment_mode
Applicable when calendar billing is enabled and a new term gets started during this operation. Unless specified the configured default value will be used.
optional, enumerated string
Possible values are
immediateSubscription period will be aligned with the configured billing date immediately.delayedSubscription period will be aligned with the configured billing date at a later date (subsequent renewals).
coupon_ids[0..n]
Identifier of the coupon as a List. Coupon Codes can also be passed.
optional, list of string
replace_coupon_list
Should be true if the existing coupons should be replaced with the ones that are being passed.
optional, boolean, default=false
prorate
Add Prorated Credits and Charges, if applicable, while updating the subscription. If this parameter is not passed, the default value set in the Site Settings will be used. Else, it will be assumed as true.
optional, boolean
end_of_term
You can specify when you want to update the subscription.
optional, boolean, default=false
force_term_reset
Applicable for 'Active' & 'Non Renewing' states alone. Generally, subscription's term will be reset (i.e current term is ended and a new term starts immediately) when a new plan having different billing frequency is specified in the input. For all the other cases, the subscription's term will remain intact. Now for this later scenario, if you want to force a term reset you can specify this param as 'true'.
Note: Specifying this value as 'false' has no impact on the default behaviour.
optional, boolean, default=false
reactivate
Applicable only for canceled subscriptions. Once this is passed as true, canceled subscription will become active; otherwise subscription changes will be made but the the subscription state will remain canceled. If not passed, subscription will be activated only if there is any change in subscription data.
optional, boolean
include_delayed_charges
If true, all the unbilled charges will be included for the invoice estimate.
optional, boolean, default=false
use_existing_balances
If true, all the existing balances - promotional credits, refundable credits and excess payments - will be included for the invoice estimate.
optional, boolean, default=true
invoice_immediately
Applicable when charges gets added during this operation. If specified as false, these charges will be added to the unbilled charges instead of getting invoiced immediately.
optional, boolean, default=true
subscription
Parameters for subscription
pass parameters as subscription[<param name>]
subscription[id]
A unique identifier to identify the subscription. You will use this to perform all operations on this subscription.
required, string, max chars=50
subscription[plan_id]
Identifier of the plan for this subscription.
optional, string, max chars=100
subscription[plan_quantity]
Represents the plan quantity for this subscription.
optional, integer, default=1, min=1
subscription[plan_unit_price]
Amount that will override the Plan's default price.
optional, in cents, min=0
subscription[setup_fee]
Amount that will override the default setup fee.
optional, in cents, min=0
subscription[start_date]
Applicable only for 'future' subscriptions. The new start date of the 'future' subscription.
optional, timestamp(UTC) in seconds
subscription[trial_end]
The time at which the trial should end for this subscription. Can be specified to override the default trial period defined in plan. If '0' is passed, the subscription will be activated immediately.
optional, timestamp(UTC) in seconds
billing_address
Parameters for billing_address
pass parameters as billing_address[<param name>]
billing_address[line1]
Address line 1.
optional, string, max chars=150
billing_address[line2]
Address line 2.
optional, string, max chars=150
billing_address[line3]
Address line 3.
optional, string, max chars=150
billing_address[city]
City.
optional, string, max chars=50
billing_address[state_code]
The ISO 3166-2 state/province code. The recommended way of passing the state/province information. Supported for US, Canada and India now. Further if this is specified, 'state' attribute should not be specified as it will be set automatically.
optional, string, max chars=50
billing_address[zip]
Zip or Postal code.
optional, string, max chars=20
billing_address[country]
2-letter ISO 3166 alpha-2 country code.
optional, string, max chars=50
billing_address[validation_status]
The address verification status.
optional, enumerated string, default=not_validated
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
shipping_address
Parameters for shipping_address
pass parameters as shipping_address[<param name>]
shipping_address[line1]
Address line 1.
optional, string, max chars=180
shipping_address[line2]
Address line 2.
optional, string, max chars=150
shipping_address[line3]
Address line 3.
optional, string, max chars=150
shipping_address[city]
City.
optional, string, max chars=50
shipping_address[state_code]
The ISO 3166-2 state/province code. The recommended way of passing the state/province information. Supported for US, Canada and India now. Further if this is specified, 'state' attribute should not be specified as it will be set automatically.
optional, string, max chars=50
shipping_address[zip]
Zip or Postal code.
optional, string, max chars=20
shipping_address[country]
2-letter ISO 3166 alpha-2 country code.
optional, string, max chars=50
shipping_address[validation_status]
The address verification status.
optional, enumerated string, default=not_validated
Possible values are
not_validatedAddress is not yet validated.validAddress was validated successfully.partially_validAddress is verified but only partially.invalidAddress is invalid.
customer
Parameters for customer
pass parameters as customer[<param name>]
customer[vat_number]
VAT number of this customer. VIES validation will not happen for this parameter.
optional, string, max chars=20
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]
Identifier of the addon. Multiple addons can be passed.
optional, string, max chars=100
addons[quantity][0..n]
Addon quantity. Applicable only for the quantity based addons. Should be passed with the same index as that of associated addon id.
optional, integer, default=1, min=1
addons[unit_price][0..n]
Amount that will override the Addon's default price. The Plan's billing frequency will not be considered for overriding. E.g. If the Plan's billing frequency is every 3 months, and if the price override amount is $10, $10 will be used, and not $30 (i.e $10*3).
optional, in cents, min=0
addons[trial_end][0..n]
The time at which the trial ends for the addon. Trial end cannot be updated for addons which are attached to subscriptions. In order to use this param please contact support@chargebee.com.
optional, timestamp(UTC) in seconds
Resource object representing estimate.
always returned

This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons.

In the response,

  • estimate.subscription_estimate has the current subscription details like its status, next billing date, and so on.
  • estimate.invoice_estimate has details of the invoice that will be generated at the next billing date.

    The generated invoice estimate will include all the balances - Promotional Credits, Refundable Credits, and Excess Payments - if any. If you don’t want these balances to be included you can specify 'false' for the parameter use_existing_balances.

    To exclude the delayed charges from the invoice estimate, specify 'false' for the parameter include_delayed_charges.

Note:

  • This API will not generate a renewal invoice if an advance invoice is already present for the subscription.
  • For 'Non Renewing' subscriptions, only the delayed charges will be included in the invoice estimate.
  • This API is not supported for 'Cancelled' subscriptions.
  • Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the Upcoming Invoices estimate available for the Customer object to get the actual estimate invoice for the customer.
Sample Request
curl  https://{site}.chargebee.com/api/v2/subscriptions/5cDfREwp3I5lJ/renewal_estimate \
     -u {site_api_key}:
copy
curl  https://{site}.chargebee.com/api/v2/subscriptions/5cDfREwp3I5lJ/renewal_estimate \
     -u {site_api_key}:

Sample Response [ JSON ]

{"estimate": { "created_at": 1501853769, "object": "estimate", "subscription_estimate": { "id": "5cDfREwp3I5lJ", "status": "active", "next_billing_at": 1504366475, "object": "subscription_estimate", "currency_code": "USD" }, "invoice_estimate": { "recurring": true, "price_type": "tax_exclusive", "sub_total": 900, "total": 900, "credits_applied": 0, "amount_paid": 0, "amount_due": 900, "object": "invoice_estimate", "line_items": [ { "id": "li_XpbKGJ9QRL7MbxEc", "date_from": 1504366475, "date_to": 1506958475, "unit_amount": 900, "quantity": 1, "is_taxed": false, "tax_amount": 0, "object": "line_item", "subscription_id": "5cDfREwp3I5lJ", "amount": 900, "description": "sample plan", "entity_type": "plan", "entity_id": "basic", "discount_amount": 0, "item_level_discount_amount": 0 }, {..} ], "taxes": [], "line_item_taxes": [], "currency_code": "USD", "line_item_discounts": [] } }}

URL Format GET

https://{site}.chargebee.com/api/v2/subscriptions/{subscription_id}/renewal_estimate
include_delayed_charges
If true, all the unbilled charges will be included for the invoice estimate.
optional, boolean, default=true
use_existing_balances
If true, all the existing balances - promotional credits, refundable credits and excess payments - will be included for the invoice estimate.
optional, boolean, default=true
ignore_scheduled_cancellation
if true, ignores scheduled cancellation for non renewing subscription.
optional, boolean, default=false
ignore_scheduled_changes
If true, ignores all recurring charges scheduled during renewal.
optional, boolean, default=false
Resource object representing estimate.
always returned

Estimate of the upcoming scheduled invoices (subscription activations, renewals etc) of a customer. For now preview of the invoices generated on the immediate upcoming date is supported. Say a customer has couple of subscription renewals scheduled on Jan,10th and another subscription renewal scheduled on Jan,15th. This API gives the preview of all the invoices scheduled to be generated on Jan,10th (immediate upcoming date).

In the response:

  • estimate.invoice_estimates[] has details of the invoices scheduled to be generated.

Note: If consolidated invoicing is enabled you may use this API to test whether upcoming renewals are consolidated.

Sample Request
curl  https://{site}.chargebee.com/api/v2/customers/4gkYnd21ouvW/upcoming_invoices_estimate \
     -u {site_api_key}:
copy
curl  https://{site}.chargebee.com/api/v2/customers/4gkYnd21ouvW/upcoming_invoices_estimate \
     -u {site_api_key}:

Sample Response [ JSON ]

{"estimate": { "created_at": 1501853770, "object": "estimate", "invoice_estimates": [ { "recurring": true, "price_type": "tax_exclusive", "sub_total": 2000, "total": 2000, "credits_applied": 0, "amount_paid": 0, "amount_due": 2000, "object": "invoice_estimate", "line_items": [ { "id": "li_XpbKGJ9QRL7LpTE7", "date_from": 1501853766, "date_to": 1504532166, "unit_amount": 1000, "quantity": 1, "is_taxed": false, "tax_amount": 0, "object": "line_item", "subscription_id": "addams", "amount": 1000, "description": "No Trial", "entity_type": "plan", "entity_id": "no_trial", "discount_amount": 0, "item_level_discount_amount": 0 }, {..} ], "taxes": [], "line_item_taxes": [], "currency_code": "USD", "line_item_discounts": [] }, {..} ] }}

URL Format GET

https://{site}.chargebee.com/api/v2/customers/{customer_id}/upcoming_invoices_estimate
Resource object representing estimate.
always returned

Generates an estimate for the 'change term end' operation. This is similar to the Change term end API but the subscription’s term end will not be changed, only an estimate for this operation is created. This is applicable only for subscriptions in ‘in-trial’, ‘active’ and ‘non-renewing’ states.

In the response,

  • estimate.subscription_estimate has the subscription details like the status of the subscription (in_trial, active, etc.), next billing date, and so on.
  • estimate.invoice_estimate has details of the invoice that will be generated immediately. This will not be present if no immediate invoice is generated for this operation. This will happen when
    • prorate parameter is false, or
    • invoice_immediately parameter is false, or
    • subscription is in in-trial state
  • estimate.credit_note_estimates[] has details of the credit-notes that will get generated during this operation. This list will be empty if no credit-note gets generated during this operation.
  • estimate.unbilled_charge_estimates[] has details of the unbilled charges. This is returned only if invoice_immediately is set as false.
Sample Request
curl  https://{site}.chargebee.com/api/v2/subscriptions/8avVGOkx8U1MX/change_term_end_estimate \
     -u {site_api_key}: \
     -d term_ends_at="1609459199"
copy
curl  https://{site}.chargebee.com/api/v2/subscriptions/8avVGOkx8U1MX/change_term_end_estimate \
     -u {site_api_key}: \
     -d term_ends_at="1609459199"

Sample Response [ JSON ]

{"estimate": { "created_at": 1501853770, "object": "estimate", "subscription_estimate": { "id": "8avVGOkx8U1MX", "status": "non_renewing", "next_billing_at": 1609459199, "object": "subscription_estimate", "currency_code": "USD", "shipping_address": { "first_name": "Benjamin", "last_name": "Ross", "line1": "PO Box 9999", "city": "Walnut", "state_code": "CA", "state": "California", "country": "US", "zip": "91789", "validation_status": "not_validated", "object": "shipping_address" } }, "credit_note_estimates": [] }}

URL Format POST

https://{site}.chargebee.com/api/v2/subscriptions/{subscription_id}/change_term_end_estimate
term_ends_at
The time at which the current term should end for this subscription.
optional, timestamp(UTC) in seconds
prorate
Applicable for active / non_renewing subscriptions. If specified as true prorated charges / credits will be added during this operation.
optional, boolean
invoice_immediately
Applicable when charges gets added during this operation. If specified as false, these charges will be added to the unbilled charges instead of getting invoiced immediately.
optional, boolean, default=true
Resource object representing estimate.
always returned