Movatterモバイル変換


[0]ホーム

URL:


ChargebeeAPI
Join the Chargebee Developers Discord — Connect, ask questions, and build faster.Join

Subscriptions

A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are:

The charges in a subscription are billed via invoices.

Note:The maximum number of subscriptions for any givencustomer(activeor not) is 900.

Sample SubscriptionJSON

API Index URL

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

Subscriptions attributes

id
required, string, max chars=50

The unique identifier of thesubscriptionresource. You have the option to specify this value when creating a customer. If not specified, Chargebee automatically generates a unique identifier.

NoteIn the event that the subscription resource istransferred along with its associatedcustomer resource to a different business entity, Chargebee assigns a new random value as theid for the subscription. The original identifier is preserved for the transferred copy of thesubscription resource. (See also:Mechanics of business entity transfer.)

currency_code
required, string, max chars=3

The currency code (ISO 4217 format) of the subscription

billing_period
optional, integer, min=1

Specifies the length of each billing cycle (or term) of the subscription, expressed in the unit defined bybilling_period_unit.

billing_period_unit
optional, enumerated string

Specifies the unit used to measure thebilling_period.

Possible Enum Values
day
week
month
year
start_date
optional, timestamp(UTC) in seconds

Applicable only for 'future' subscriptions. The scheduled start time of the subscription.

trial_end
optional, timestamp(UTC) in seconds

End of the trial period for the subscription. Presence of this value for 'future' subscription implies the subscription will go into 'in_trial' state when it starts.

remaining_billing_cycles
optional, integer, min=0
  • When the subscription is not on a contract term: this value is the number of billing cycles remaining after the current cycle, at the end of which, the subscription cancels.
  • When the subscription is on acontract term: this value is the number of billing cycles remaining in the contract term after the current billing cycle.
po_number
optional, string, max chars=100

Purchase order number for this subscription.

plan_quantity_in_decimal
optional, string, max chars=33

The decimal representation of the quantity of the addon. Returned for quantity-based plans whenmulti-decimal pricingis enabled.

plan_unit_price_in_decimal
optional, string, max chars=39

The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned whenmulti-decimal pricingis enabled.

customer_id
required, string, max chars=50

Identifier of the customer with whom this subscription is associated.

status
required, enumerated string

Current state of the subscription

Possible Enum Values
future

The subscription is scheduled to start at a future date.

in_trial

The subscription is in trial.

active

The subscription is active and will be charged for automatically based on the items in it.

non_renewing

The subscription will be canceled at the end of the current term.

paused

The subscription ispaused.The subscription will not renew while in this state.

cancelled

The subscription has been canceled and is no longer in service.

transferred

Thetransferredstatus will be reflected on the source business entity's subscription attribute once thecustomer transferactivity is completed successfully.

trial_start
optional, timestamp(UTC) in seconds

Start of the trial period for the subscription. Presence of this value forfuturesubscription implies the subscription will go intoin_trialstate when it starts.

trial_end_action
optional, enumerated string

Applicable only whenEnd-of-trial Actionhas been enabled for the site. Whenever the subscription has a trial period, this attribute (parameter) is returned (required) and specifies the operation to be carried out for the subscription once the trial ends.

Possible Enum Values
site_default

This is the default value. The actionconfigured for the siteat the time when the trial ends, takes effect.

plan_default

The actionconfigured for the siteat the time when the trial ends, takes effect.

activate_subscription

The subscription activates and charges are raised for non-metered items.

cancel_subscription

The subscription cancels.

current_term_start
optional, timestamp(UTC) in seconds

Start of the current billing period of the subscription.

current_term_end
optional, timestamp(UTC) in seconds

End of the current billing period of the subscription. Subscription is renewed immediately after this.

next_billing_at
optional, timestamp(UTC) in seconds

The date/time at which the next billing for the subscription happens. This is usually right aftercurrent_term_endunless multiple subscription terms were invoiced in advance using theterms_to_chargeparameter.

created_at
optional, timestamp(UTC) in seconds

The time at which the subscription was created.

started_at
optional, timestamp(UTC) in seconds

Time at which the subscription was started. Isnullforfuturesubscriptions as it is yet to be started.

activated_at
optional, timestamp(UTC) in seconds

Time at which the subscriptionstatuslast changed toactive.For example, this value is updated when anin_trialorcancelledsubscription activates.

contract_term_billing_cycle_on_renewal
optional, integer, min=1, max=100

Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same asbilling_cyclesor a custom value depending on thesite configuration.

override_relationship
optional, boolean

Iftrue, ignores thehierarchy relationshipand uses customer as payment and invoice owner.

pause_date
optional, timestamp(UTC) in seconds

When a pause has been scheduled, it is the date/time of scheduled pause. When the subscription is in thepausedstate, it is the date/time when the subscription was paused.

resume_date
optional, timestamp(UTC) in seconds

For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned.

cancelled_at
optional, timestamp(UTC) in seconds

Time at which subscription was cancelled or is set to be cancelled.

cancel_reason
optional, enumerated string

The reason for canceling the subscription. Set by Chargebee automatically.

Possible Enum Values
not_paid

Not Paid

no_card

No Card

fraud_review_failed

Fraud Review Failed

non_compliant_eu_customer

Non Compliant EU Customer

tax_calculation_failed

Tax Calculation Failed

currency_incompatible_with_gateway

Currency incompatible with Gateway

non_compliant_customer

Non Compliant Customer

created_from_ip
optional, string, max chars=50

The IP address of the user. Used primarly in Refersion integration. Refersion uses this field to track/log affiliate subscription.

resource_version
optional, long

Version number of this resource. Theresource_versionis updated with a new timestamp in milliseconds for every change made to the resource. This attribute will be present only if the resource has been updated after 2016-09-28.

updated_at
optional, timestamp(UTC) in seconds

Timestamp indicating when the item was last updated.

has_scheduled_advance_invoices
required, boolean, default=false

The subscription has anadvance invoicing schedule.

has_scheduled_changes
required, boolean, default=false

Indicates whether a change is scheduled on the subscription.

Note

WhenRamps are enabled with compatibility mode, this attribute indicates whether one or more ramps are scheduled for the subscription. For more details, seeRamps API compatibility mode.

payment_source_id
optional, string, max chars=40

Payment source attached to this subscription. If present, customer's payment sources won't be used to collect any payment for this subscripiton.

plan_free_quantity_in_decimal
optional, string, max chars=33

The free_quantity_in_decimal as set for the plan. Returned for quantity-based plans whenmulti-decimal pricingis enabled.

plan_amount_in_decimal
optional, string, max chars=39

The decimal representation of the total amount for the item, in major units of the currency. Always returned whenmulti-decimal pricingis enabled.

cancel_schedule_created_at
optional, timestamp(UTC) in seconds

This is the date/time at which the most recent cancellation schedule for the subscription was created in Chargebee. Applicable only forcancelledsubscriptions or subscriptions that are scheduled for cancellation.

offline_payment_method
optional, enumerated string
Possible Enum Values
no_preference
cash
check
bank_transfer
ach_credit
channel
optional, enumerated string

The subscription channel this object originated from and is maintained in.

Possible Enum Values
web

The object was created (and is maintained) for the web channel directly in Chargebee via API or UI.

app_store

The object data is synchronized with data fromin-app subscription(s)created in Apple App Store. Direct manipulation of this object via UI or API is disallowed.

play_store

The object data is synchronized with data fromin-app subscription(s)created in Google Play Store. Direct manipulation of this object via UI or API is disallowed.

net_term_days
optional, integer

TheNet Dvalue explicitly set for this subscription. Net D is the number of days within which any invoice raised for the subscription must be paid. When an invoice is raised, and this value is unavailable, the net_term_days defined atthe customer levelis considered.

active_id
optional, string, max chars=50

Note: Present only when thesubscription has beentransferred between business entities.

Represents theid of the active version of thesubscription resource.

TipIf theid andactive_id of asubscription resource are the same, this indicates that you are working with the active version of thatsubscription resource.

due_invoices_count
optional, integer

Total number of invoices that are due for payment against the subscription.Note:Not supported ifconsolidated invoicingis enabled, or when the subscription is for the customer who is inhierarchy, and the parent of this customer owns and pays for the invoices of the subscription. It is also worth noting that the consolidated invoice amount is not included in the calculation ofdue_invoices_count.

due_since
optional, timestamp(UTC) in seconds

Time since this subscription has unpaid invoices.Note:Not supported ifconsolidated invoicingis enabled, or when the subscription is for the customer who is inhierarchy, and the parent of this customer owns and pays for the invoices of the subscription.

total_dues
optional, in cents, min=0

Total invoice due amount for this subscription. The value depends on thetype of currency.Note:Not supported ifconsolidated invoicingis enabled, or when the subscription is for the customer who is inhierarchy, and the parent of this customer owns and pays for the invoices of the subscription. It is also worth noting that the consolidated invoice amount is not included in the calculation oftotal_dues.

mrr
optional, in cents, min=1

Monthly recurring revenue for the subscription. Updated asynchronously, this value catches up with changes to the subscription in less than a minute. The value depends on thetype of currency.Note:This may not return accurate values since updated asynchronously.

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

Exchange rate used for base currency conversion.This value is updated to therate configuredon your site each time any change is made to the subscription.

base_currency_code
optional, string, max chars=3

The currency code (ISO 4217 format) of the site's base currency.

invoice_notes
optional, string, max chars=2000

A customer-facing note added to all invoices associated with this subscription. This note is one amongall the notesdisplayed on the invoice PDF.

meta_data
optional, jsonobject

A collection of key-value pairs that provides extra information about the subscription.

Note:There's a character limit of 65,535.

Learn more.

deleted
required, boolean

Indicates that the subscription has been deleted when the value istrue.You can retrieve a deleted subscription using thelist operation.

changes_scheduled_at
optional, timestamp(UTC) in seconds

The date-time at which the subscription change is scheduled to happen.

NoteThis attribute is not returned when the change is scheduled to happen at the end of the current term.

cancel_reason_code
optional, string, max chars=100

Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app inSettings > Configure Chargebee > Reason Codes > Subscriptions > Subscription Cancellation.Must be passed if set as mandatory in the app. The codes are case-sensitive

free_period
optional, integer

The period of time by which the first term of the subscription is extended free of charge. The value is expressed in the time unit specified byfree_period_unit. For example,3 withfree_period_unit =month means 3 free months are added to the first term.

free_period_unit
optional, enumerated string

The time unit forfree_period.

Possible Enum Values
day

Charge based on day(s)

week

Charge based on week(s)

month

Charge based on month(s)

year

Charge based on year(s)

create_pending_invoices
optional, boolean

Indicates whether the invoices for this subscription are generated with apendingstatus. This attribute is set totrue automatically when the subscription has item prices that belong tometered items.You can also set this totrue explicitly using thecreate/update subscription operations. This is useful in the following scenarios:

  • When tracking usages and calculating usage-based charges on your end. You can then add them to the subscription as aone-time charge at the end of the billing term.
  • When you need to inspect all charges before closing invoices for this subscription.Applicable only whenMetered Billing is enabled for the site
auto_close_invoices
optional, boolean

Set tofalseto override for this subscription, thesite-level settingfor auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at thecustomer level.

business_entity_id
optional, string, max chars=50

The unique ID of thebusiness entityof this subscription. This is always the same as thebusiness entityof the customer.

decommissioned
required, boolean, default=false

Indicates whether the subscription should be decommissioned when it is canceled. If set totrue all subscription operations will be disabled except deletion.

Note: Decommission operation is irreversible. Once set totrue it cannot be updated tofalse and thus subscription will remain decommissioned permanently.

subscription_items

Details of individualitem pricesthat are part of this subscription.

item_tiers

The pricing details ofsubscription_itemswhich havepricing_modelastiered,volumeorstairstep.

charged_items

List of event based charge items that have already been charged.

coupons

List of coupons for this subscription

shipping_address

Shipping address for the subscription.

referral_info

Referral details if exists for the subscription

billing_override

Specify limits on how credits and excesspayments are applied to individual invoices for the subscription.

Prerequisite

Constraints

contract_term

Contract terms for this subscription

discounts

List ofdiscountscurrently attached to the subscription.

Note

  • Discounts ofduration_typeone_time are removed from the list after a single application to the subscription.
  • Discounts ofduration_typelimited_period are removed from the list once the specifiedperiod expires since their attachment to the subscription.

[8]ページ先頭

©2009-2026 Movatter.jp