chargebee 2.40.0 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/LICENSE +1 -1
  3. package/README.md +90 -172
  4. package/cjs/RequestWrapper.js +81 -0
  5. package/cjs/asyncApiSupport.js +39 -0
  6. package/cjs/chargebee.cjs.js +13 -0
  7. package/cjs/chargebee.cjs.worker.js +9 -0
  8. package/cjs/chargebeeError.js +17 -0
  9. package/cjs/coreCommon.js +72 -0
  10. package/cjs/createChargebee.js +92 -0
  11. package/cjs/environment.js +18 -0
  12. package/cjs/filter.js +1 -0
  13. package/cjs/net/ClientInterface.js +40 -0
  14. package/cjs/net/FetchClient.js +86 -0
  15. package/cjs/net/NodeClient.js +61 -0
  16. package/cjs/package.json +1 -0
  17. package/cjs/resources/api_endpoints.js +1086 -0
  18. package/cjs/util.js +218 -0
  19. package/esm/RequestWrapper.js +77 -0
  20. package/esm/asyncApiSupport.js +35 -0
  21. package/esm/chargebee.esm.js +9 -0
  22. package/esm/chargebee.esm.worker.js +5 -0
  23. package/esm/chargebeeError.js +13 -0
  24. package/esm/coreCommon.js +67 -0
  25. package/esm/createChargebee.js +88 -0
  26. package/esm/environment.js +15 -0
  27. package/esm/filter.js +1 -0
  28. package/esm/net/ClientInterface.js +35 -0
  29. package/esm/net/FetchClient.js +81 -0
  30. package/esm/net/NodeClient.js +56 -0
  31. package/esm/package.json +1 -0
  32. package/esm/resources/api_endpoints.js +1083 -0
  33. package/esm/util.js +202 -0
  34. package/package.json +69 -38
  35. package/types/core.d.ts +558 -89
  36. package/types/index.d.ts +91 -54
  37. package/types/resources/Address.d.ts +57 -272
  38. package/types/resources/AdvanceInvoiceSchedule.d.ts +21 -94
  39. package/types/resources/AttachedItem.d.ts +91 -329
  40. package/types/resources/Attribute.d.ts +5 -5
  41. package/types/resources/BusinessEntity.d.ts +49 -69
  42. package/types/resources/BusinessEntityTransfer.d.ts +11 -17
  43. package/types/resources/Card.d.ts +146 -424
  44. package/types/resources/Comment.d.ts +72 -189
  45. package/types/resources/Contact.d.ts +12 -64
  46. package/types/resources/ContractTerm.d.ts +15 -96
  47. package/types/resources/Coupon.d.ts +282 -758
  48. package/types/resources/CouponCode.d.ts +56 -52
  49. package/types/resources/CouponSet.d.ts +92 -234
  50. package/types/resources/CreditNote.d.ts +588 -1758
  51. package/types/resources/CreditNoteEstimate.d.ts +131 -157
  52. package/types/resources/Currency.d.ts +75 -62
  53. package/types/resources/Customer.d.ts +892 -835
  54. package/types/resources/CustomerEntitlement.d.ts +36 -0
  55. package/types/resources/DifferentialPrice.d.ts +116 -314
  56. package/types/resources/Discount.d.ts +20 -125
  57. package/types/resources/Download.d.ts +6 -22
  58. package/types/resources/Entitlement.d.ts +51 -160
  59. package/types/resources/EntitlementOverride.d.ts +58 -139
  60. package/types/resources/Estimate.d.ts +1178 -527
  61. package/types/resources/Event.d.ts +67 -178
  62. package/types/resources/Export.d.ts +563 -723
  63. package/types/resources/Feature.d.ts +117 -433
  64. package/types/resources/GatewayErrorDetail.d.ts +16 -72
  65. package/types/resources/Gift.d.ts +265 -432
  66. package/types/resources/Hierarchy.d.ts +8 -36
  67. package/types/resources/HostedPage.d.ts +1017 -1153
  68. package/types/resources/ImpactedItem.d.ts +13 -50
  69. package/types/resources/ImpactedItemPrice.d.ts +13 -15
  70. package/types/resources/ImpactedSubscription.d.ts +13 -45
  71. package/types/resources/InAppSubscription.d.ts +93 -389
  72. package/types/resources/Installment.d.ts +35 -110
  73. package/types/resources/InstallmentConfig.d.ts +54 -155
  74. package/types/resources/InstallmentDetail.d.ts +19 -27
  75. package/types/resources/Invoice.d.ts +1574 -3157
  76. package/types/resources/InvoiceEstimate.d.ts +131 -161
  77. package/types/resources/Item.d.ts +133 -611
  78. package/types/resources/ItemEntitlement.d.ts +78 -215
  79. package/types/resources/ItemFamily.d.ts +69 -178
  80. package/types/resources/ItemPrice.d.ts +291 -1203
  81. package/types/resources/Metadata.d.ts +3 -5
  82. package/types/resources/Order.d.ts +538 -1471
  83. package/types/resources/PaymentIntent.d.ts +163 -347
  84. package/types/resources/PaymentReferenceNumber.d.ts +7 -29
  85. package/types/resources/PaymentSource.d.ts +476 -1272
  86. package/types/resources/PaymentVoucher.d.ts +87 -306
  87. package/types/resources/PortalSession.d.ts +71 -207
  88. package/types/resources/PriceVariant.d.ts +91 -279
  89. package/types/resources/PricingPageSession.d.ts +92 -41
  90. package/types/resources/PromotionalCredit.d.ts +90 -346
  91. package/types/resources/Purchase.d.ts +185 -315
  92. package/types/resources/Quote.d.ts +1406 -887
  93. package/types/resources/QuoteLineGroup.d.ts +125 -452
  94. package/types/resources/QuotedCharge.d.ts +45 -274
  95. package/types/resources/QuotedSubscription.d.ts +100 -488
  96. package/types/resources/Ramp.d.ts +233 -724
  97. package/types/resources/ResourceMigration.d.ts +25 -80
  98. package/types/resources/SiteMigrationDetail.d.ts +34 -112
  99. package/types/resources/Subscription.d.ts +2390 -4335
  100. package/types/resources/SubscriptionEntitlement.d.ts +59 -160
  101. package/types/resources/SubscriptionEstimate.d.ts +51 -75
  102. package/types/resources/TaxWithheld.d.ts +15 -40
  103. package/types/resources/ThirdPartyPaymentMethod.d.ts +7 -29
  104. package/types/resources/TimeMachine.d.ts +43 -97
  105. package/types/resources/Token.d.ts +15 -85
  106. package/types/resources/Transaction.d.ts +278 -900
  107. package/types/resources/UnbilledCharge.d.ts +189 -164
  108. package/types/resources/Usage.d.ts +89 -279
  109. package/types/resources/VirtualBankAccount.d.ts +103 -255
  110. package/types/resources/filter.d.ts +52 -0
  111. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -81
  112. package/.github/ISSUE_TEMPLATE/config.yml +0 -6
  113. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -34
  114. package/.github/PULL_REQUEST_TEMPLATE.md +0 -8
  115. package/lib/chargebee.js +0 -512
  116. package/lib/resources/api_endpoints.js +0 -2912
  117. package/types/resources/NonSubscription.d.ts +0 -30
  118. package/types/resources/Session.d.ts +0 -41
@@ -1,499 +1,111 @@
1
1
  ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+
2
4
  declare module 'chargebee' {
3
5
  export interface QuotedSubscription {
4
-
5
- /**
6
- * @description A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
7
-
8
- */
9
-
10
- id:string;
11
-
12
- /**
13
- * @description Applicable only when &#x60;operation_type&#x60; of the quote is &#x60;create_subscription_for_customer&#x60;. For subscriptions in the &#x60;future&#x60; &#x60;status&#x60;, this is the date/time when the subscription is set to start. The quote can be converted on a date/time after this date. This is called backdating the subscription creation. Backdating is performed when the subscription has already been provisioned but the conversion action has been delayed. Backdating is allowed only when the following prerequisites are met:
14
-
15
- * Backdating is enabled for subscription creation operations.
16
- * The current day of the month does not exceed the limit set in Chargebee for backdating such operations. This day is typically the day of the month by which the accounting for the previous month must be closed.
17
- * The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the subscription&#x27;s plan is 2 months and today is 14th April, the &#x60;start_date&#x60; cannot be earlier than 14th February.
18
-
19
- */
20
-
21
- start_date?:number;
22
-
23
- /**
24
- * @description End of the trial period for the subscription. Presence of this value for &#x27;future&#x27; subscription implies the subscription will go into &#x27;in_trial&#x27; state when it starts.
25
-
26
- */
27
-
28
- trial_end?:number;
29
-
30
- /**
31
- * @description * 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.
32
- * When the subscription is on a [contract term](contract_terms): this value is the number of billing cycles remaining in the contract term after the current billing cycle.
33
-
34
- */
35
-
36
- remaining_billing_cycles?:number;
37
-
38
- /**
39
- * @description Purchase order number for this subscription.
40
-
41
- */
42
-
43
- po_number?:string;
44
-
45
- /**
46
- * @description The decimal representation of the quantity of the plan purchased. Returned for quantity-based plans when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled.
47
-
48
- */
49
-
50
- plan_quantity_in_decimal?:string;
51
-
52
- /**
53
- * @description The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled.
54
-
55
- */
56
-
57
- plan_unit_price_in_decimal?:string;
58
-
59
- /**
60
- * @description Applicable only when &#x60;operation_type&#x60; of the quote is &#x60;change_subscription&#x60;. When &#x60;change_option&#x60; is set to &#x60;specific_date&#x60;, then this is the date/time at which the subscription change is scheduled to occur. The quote can be converted on a date/time after this date. This is called backdating the subscription change and performed when the subscription change has already been provisioned but the conversion action has been delayed. Backdating is allowed only when the following prerequisites are met:
61
-
62
- * Backdating must be enabled for subscription change operations.
63
- * Only the following changes can be backdated:
64
- * Changes in the recurring items or their prices.
65
- * Addition of non-recurring items.
66
- * Subscription &#x60;status&#x60; is &#x60;active&#x60;, &#x60;cancelled&#x60;, or &#x60;non_renewing&#x60;.
67
- * The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is the day of the month by which the accounting for the previous month must be closed.
68
- * The date is on or after &#x60;current_term_start&#x60;.
69
- * The date is on or after the last date/time any of the following changes were made:
70
- * Changes in the recurring items or their prices.
71
- * Addition of non-recurring items.
72
- * The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the subscription&#x27;s plan is 2 months and today is 14th April, &#x60;changes_scheduled_at&#x60; cannot be earlier than 14th February.
73
-
74
- */
75
-
76
- changes_scheduled_at?:number;
77
-
78
- /**
79
- * @description Applicable only when &#x60;operation_type&#x60; of the quote is &#x60;change_subscription&#x60;. When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out. \* end_of_term - The change is scheduled to be carried out at the end of the billing cycle of the subscription. \* specific_date - The change is carried out as of &#x60;changes_scheduled_at&#x60;. \* immediately - The change is carried out immediately upon quote conversion.
80
-
81
- */
82
-
83
- change_option?:'end_of_term' | 'immediately' | 'specific_date';
84
-
85
- /**
86
- * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as &#x60;billing_cycles&#x60; or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms).
87
-
88
- */
89
-
90
- contract_term_billing_cycle_on_renewal?:number;
91
-
92
- /**
93
- * @description List of coupons for this subscription
94
-
95
- */
96
-
97
- coupons?:QuotedSubscription.Coupon[];
98
-
99
- /**
100
- * @description List of discounts for this quoted subscription.
101
-
102
- */
103
-
104
- discounts?:QuotedSubscription.Discount[];
105
-
106
- /**
107
- * @description Details of individual [item prices](/docs/api/item_prices?prod_cat_ver&#x3D;2) that are part of this subscription
108
-
109
- */
110
-
111
- subscription_items?:QuotedSubscription.SubscriptionItem[];
112
-
113
- /**
114
- * @description List of item tier.
115
-
116
- */
117
-
118
- item_tiers?:QuotedSubscription.ItemTier[];
119
-
120
- /**
121
- * @description The details of the contract term to be created when this quote is invoiced.
122
-
123
- */
124
-
125
- quoted_contract_term?:QuotedSubscription.QuotedContractTerm;
6
+ id: string;
7
+ plan_id: string;
8
+ plan_quantity: number;
9
+ plan_unit_price?: number;
10
+ setup_fee?: number;
11
+ billing_period?: number;
12
+ billing_period_unit?: 'day' | 'week' | 'month' | 'year';
13
+ start_date?: number;
14
+ trial_end?: number;
15
+ remaining_billing_cycles?: number;
16
+ po_number?: string;
17
+ auto_collection?: AutoCollection;
18
+ plan_quantity_in_decimal?: string;
19
+ plan_unit_price_in_decimal?: string;
20
+ changes_scheduled_at?: number;
21
+ change_option?: 'end_of_term' | 'specific_date' | 'immediately';
22
+ contract_term_billing_cycle_on_renewal?: number;
23
+ addons?: QuotedSubscription.Addon[];
24
+ event_based_addons?: QuotedSubscription.EventBasedAddon[];
25
+ coupons?: QuotedSubscription.Coupon[];
26
+ subscription_items?: QuotedSubscription.SubscriptionItem[];
27
+ item_tiers?: QuotedSubscription.ItemTier[];
28
+ quoted_contract_term?: QuotedSubscription.QuotedContractTerm;
126
29
  }
127
- export namespace QuotedSubscription {
128
-
129
-
130
- export interface Coupon {
131
- /**
132
- * @description Used to uniquely identify the coupon
133
30
 
134
- */
135
-
136
- coupon_id:string;
31
+ export namespace QuotedSubscription {
32
+ export interface Addon {
33
+ id: string;
34
+ quantity?: number;
35
+ unit_price?: number;
36
+ amount?: number;
37
+ trial_end?: number;
38
+ remaining_billing_cycles?: number;
39
+ quantity_in_decimal?: string;
40
+ unit_price_in_decimal?: string;
41
+ amount_in_decimal?: string;
42
+ proration_type?: 'full_term' | 'partial_term' | 'none';
137
43
  }
138
- export interface Discount {
139
- /**
140
- * @description An immutable unique id for the discount. It is always auto-generated.
141
-
142
- */
143
-
144
- id:string;
145
-
146
- /**
147
- * @description The name of the discount as it should appear on customer-facing pages and documents such as [invoices](/docs/api/invoices?prod_cat_ver&#x3D;2) and [hosted pages](/docs/api/hosted_pages?prod_cat_ver&#x3D;2). This is auto-generated based on the &#x60;type&#x60;, &#x60;amount&#x60;, and &#x60;currency_code&#x60; of the discount. For example, it can be &#x60;10% off&#x60; or &#x60;10$ off&#x60;.
148
-
149
- */
150
-
151
- invoice_name?:string;
152
-
153
- /**
154
- * @description The type of discount. Possible value are: \* fixed_amount - The specified amount will be given as discount. \* percentage - The specified percentage will be given as discount.
155
-
156
- */
157
-
158
- type:'fixed_amount' | 'percentage';
159
-
160
- /**
161
- * @description The percentage of the original amount that should be deducted from it. Only applicable when &#x60;discount.type&#x60; is percentage.
162
-
163
- */
164
-
165
- percentage?:number;
166
-
167
- /**
168
- * @description The value of the discount. [The format of this value](https://apidocs.chargebee.com/docs/api?prod_cat_ver&#x3D;2#currencies) depends on the kind of currency. This is only applicable when &#x60;discount.type&#x60; is &#x60;fixed_amount&#x60;.
169
-
170
- */
171
-
172
- amount?:number;
173
-
174
- /**
175
- * @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the discount. This is only applicable when &#x60;discount.type&#x60; is &#x60;fixed_amount&#x60;.
176
-
177
- */
178
-
179
- currency_code?:string;
180
-
181
- /**
182
- * @description Specifies the time duration for which this discount is attached to the subscription. \* forever - The discount is attached to the subscription and applied on the invoices till it is [explicitly removed](/docs/api/subscriptions?prod_cat_ver&#x3D;2#update_subscription_for_items_discounts_operation_type). \* one_time - The discount stays attached to the subscription till it is applied on an invoice **once** . It is removed after that from the subscription. \* limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by &#x60;period&#x60; and &#x60;period_unit&#x60;.
183
-
184
- */
185
-
186
- duration_type:'limited_period' | 'one_time' | 'forever';
187
-
188
- /**
189
- * @description The duration of time for which the discount is attached to the subscription, in &#x60;period_units&#x60;. Applicable only when &#x60;duration_type&#x60; is &#x60;limited_period&#x60;.
190
-
191
- */
192
-
193
- period?:number;
194
-
195
- /**
196
- * @description The unit of time for &#x60;period&#x60;. Applicable only when &#x60;duration_type&#x60; is &#x60;limited_period&#x60;. \* day - A period of 24 hours. \* year - A period of 1 calendar year. \* week - A period of 7 days. \* month - A period of 1 calendar month.
197
-
198
- */
199
-
200
- period_unit?:'week' | 'month' | 'year' | 'day';
201
-
202
- /**
203
- * @description The discount is included in MRR calculations for your site. This attribute is only applicable when &#x60;duration_type&#x60; is &#x60;one_time&#x60; and when the [feature is enabled](https://www.chargebee.com/docs/reporting.html#dashboards_flexible-mrr-calculation) in Chargebee. Also, If the [site-level setting](https://www.chargebee.com/docs/reporting.html#chart_flexible-mrr-calculation) is to exclude one-time discounts from MRR calculations, this value is always returned &#x60;false&#x60;.
204
-
205
- */
206
-
207
- included_in_mrr:boolean;
208
-
209
- /**
210
- * @description The amount on the invoice to which the discount is applied. \* invoice_amount - The discount is applied to the invoice &#x60;sub_total&#x60;. \* specific_item_price - The discount is applied to the &#x60;invoice.line_item.amount&#x60; that corresponds to the item price specified by &#x60;item_price_id&#x60;.
211
-
212
- */
213
-
214
- apply_on:'specific_item_price' | 'invoice_amount';
215
-
216
- /**
217
- * @description The [id of the item price](/docs/api/subscriptions?prod_cat_ver&#x3D;2#subscription_subscription_items_item_price_id) in the subscription to which the discount is to be applied. Relevant only when &#x60;apply_on&#x60; &#x3D; &#x60;specific_item_price&#x60;.
218
-
219
- */
220
-
221
- item_price_id?:string;
222
-
223
- /**
224
- * @description Timestamp indicating when this discount is created.
225
-
226
- */
227
-
228
- created_at:number;
229
-
230
- /**
231
- * @description Specifies till when the limited period discount is applicable. This attribute will be sent in the response only for &#x60;limited_period&#x60; duration type discount.
232
-
233
- */
234
-
235
- apply_till?:number;
236
-
237
- /**
238
- * @description Specifies the number of times the discount has been applied.
239
-
240
- */
241
-
242
- applied_count?:number;
243
-
244
- /**
245
- * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
246
- **Note:**
247
-
248
-
249
- When the coupon ID contains a special character; for example: &#x60;#&#x60;, the API returns an error.
250
- Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call.
251
-
252
- */
253
-
254
- coupon_id:string;
255
-
256
- /**
257
- * @description The index number of the subscription to which the item price is added. Provide a unique number between &#x60;0&#x60; and &#x60;4&#x60; (inclusive) for each subscription that is to be created.
258
-
259
- */
260
-
261
- index:number;
44
+ export interface EventBasedAddon {
45
+ id: string;
46
+ quantity: number;
47
+ unit_price: number;
48
+ service_period_in_days?: number;
49
+ on_event:
50
+ | 'subscription_creation'
51
+ | 'subscription_trial_start'
52
+ | 'plan_activation'
53
+ | 'subscription_activation'
54
+ | 'contract_termination';
55
+ charge_once: boolean;
56
+ quantity_in_decimal?: string;
57
+ unit_price_in_decimal?: string;
262
58
  }
263
- export interface SubscriptionItem {
264
- /**
265
- * @description The unique identifier of the item price.
266
-
267
- */
268
-
269
- item_price_id:string;
270
-
271
- /**
272
- * @description The type of item. There must be one and only one item of type &#x60;plan&#x60; in this list. \* plan - Plan \* addon - Addon \* charge - Charge
273
-
274
- */
275
-
276
- item_type:'charge' | 'addon' | 'plan';
277
-
278
- /**
279
- * @description The quantity of the item purchased
280
-
281
- */
282
-
283
- quantity?:number;
284
-
285
- /**
286
- * @description The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
287
-
288
- */
289
-
290
- quantity_in_decimal?:string;
291
-
292
- /**
293
- * @description The price/per unit price of the item. When not provided, [the value set](/docs/api/item_prices?prod_cat_ver&#x3D;2#item_price_attributes) for the item price is used. This is only applicable when the &#x60;pricing_model&#x60; of the item price is &#x60;flat_fee&#x60; or &#x60;per_unit&#x60;. Also, it is only allowed when [price overriding](https://www.chargebee.com/docs/price-override.html) is enabled for the site. The value depends on the type of currency. If &#x60;changes_scheduled_at&#x60; is in the past and a &#x60;unit_price&#x60; is not passed, then the item price&#x27;s current unit price is considered even if the item price did not exist on the date as of when the change is scheduled.
294
-
295
- */
296
-
297
- unit_price?:number;
298
-
299
- /**
300
- * @description The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
301
-
302
- */
303
-
304
- unit_price_in_decimal?:string;
305
-
306
- /**
307
- * @description The total amount for the item as determined from &#x60;unit_price&#x60;, &#x60;free_quantity&#x60;, &#x60;quantity&#x60; and &#x60;item_tiers&#x60; as applicable. The value depends on the [type of currency](./#handling_currency_units).
308
-
309
- */
310
-
311
- amount?:number;
312
-
313
- /**
314
- * @description The decimal representation of the total amount for the item, in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
315
-
316
- */
317
-
318
- amount_in_decimal?:string;
319
-
320
- /**
321
- * @description The &#x60;free_quantity&#x60; of the plan-item as [specified](./item_prices?prod_cat_ver&#x3D;2) for the item price.
322
-
323
- */
324
-
325
- free_quantity?:number;
326
-
327
- /**
328
- * @description The &#x60;free_quantity_in_decimal&#x60; as set for the item price. Returned for quantity-based item prices when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
329
-
330
- */
331
-
332
- free_quantity_in_decimal?:string;
333
-
334
- /**
335
- * @description The date/time when the trial period of the item ends. Applies to plan-items and----when [enabled](https://www.chargebee.com/docs/2.0/addons-trial.html)----addon-items as well.
336
-
337
- */
338
-
339
- trial_end?:number;
340
-
341
- /**
342
- * @description For the plan-item price:
343
- the value determines the number of billing cycles the subscription runs before canceling automatically. If not provided, then [the value set](./item_prices?prod_cat_ver&#x3D;2#item_price_attributes) for the plan-item price is used.
344
-
345
- For addon-item prices:
346
- If [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) are enabled then this is the number of subscription billing cycles for which the addon is included. If not provided, then [the value set under attached addons](./attached_items?prod_cat_ver&#x3D;2#attached_item_attributes) is used. Further, if that value is not provided, then [the value set for the addon-item price](./item_prices?prod_cat_ver&#x3D;2#item_price_attributes) is used.
347
-
348
- */
349
-
350
- billing_cycles?:number;
351
-
352
- /**
353
- * @description The service period of the item in days from the day of charge.
354
-
355
- */
356
-
357
- service_period_days?:number;
358
-
359
- /**
360
- * @description When &#x60;charge_on_option&#x60; option is set to &#x60;on_event&#x60;, this parameter specifies the event at which the charge-item is applied to the subscription. This parameter only applies to charge-items. \* plan_activation - same as subscription activation, but also includes the case when the plan-item of the subscription is changed. \* subscription_activation - the moment a subscription enters an &#x60;active&#x60; or &#x60;non-renewing&#x60; state. Also includes reactivations of canceled subscriptions. \* contract_termination - when a contract term is [terminated](./subscriptions?prod_cat_ver&#x3D;2#cancel_subscription_for_items_contract_term_cancel_option). \* subscription_trial_start - the time when the trial period of the subscription begins. \* subscription_creation - the time of creation of the subscription.
361
-
362
- */
363
-
364
- charge_on_event?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation';
365
-
366
- /**
367
- * @description Indicates if the charge-item is to be charged only once or each time the &#x60;charge_on_event&#x60; occurs. This parameter only applies to charge-items.
368
-
369
- */
370
-
371
- charge_once?:boolean;
372
-
373
- /**
374
- * @description Indicates when the charge-item is to be charged. This parameter only applies to charge-items. \* on_event - The item is charged at the occurrence of the event specified as &#x60;charge_on_event&#x60;. \* immediately - The item is charged immediately on being added to the subscription.
375
-
376
- */
377
-
378
- charge_on_option?:'on_event' | 'immediately';
379
-
380
- /**
381
- * @description null
382
-
383
- */
384
-
385
- proration_type?:'partial_term' | 'full_term' | 'none';
386
-
387
- billing_period?:number;
388
-
389
- billing_period_unit?:'day' | 'week' | 'month' | 'year';
59
+ export interface Coupon {
60
+ coupon_id: string;
390
61
  }
391
- export interface ItemTier {
392
- /**
393
- * @description The id of the item price to which this tier belongs.
394
-
395
- */
396
-
397
- item_price_id:string;
398
-
399
- /**
400
- * @description The lowest value in the quantity tier.
401
-
402
- */
403
-
404
- starting_unit:number;
405
-
406
- /**
407
- * @description The highest value in the quantity tier.
408
-
409
- */
410
-
411
- ending_unit?:number;
412
-
413
- /**
414
- * @description The per-unit price for the tier when the &#x60;pricing_model&#x60; is &#x60;tiered&#x60; or &#x60;volume&#x60;. The total cost for the item price when the &#x60;pricing_model&#x60; is &#x60;stairstep&#x60;. The value is in the minor unit of the currency.
415
-
416
- */
417
-
418
- price:number;
419
-
420
- /**
421
- * @description 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 &#x60;ending_unit_in_decimal&#x60; of the next lower tier. Returned only when the pricing_model is &#x60;tiered&#x60;, &#x60;volume&#x60; or &#x60;stairstep&#x60; and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
422
-
423
- */
424
-
425
- starting_unit_in_decimal?:string;
426
-
427
- /**
428
- * @description 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 &#x60;starting_unit_in_decimal&#x60; of the next higher tier. Returned only when the pricing_model is &#x60;tiered&#x60;, &#x60;volume&#x60; or &#x60;stairstep&#x60; and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
429
-
430
- */
431
-
432
- ending_unit_in_decimal?:string;
433
-
434
- /**
435
- * @description The decimal representation of the per-unit price for the tier when the &#x60;pricing_model&#x60; is &#x60;tiered&#x60; or &#x60;volume&#x60;. When the &#x60;pricing_model&#x60; is &#x60;stairstep&#x60;, it is the decimal representation of the total price for the item. The value is in major units of the currency. Returned when the plan is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
436
-
437
- */
438
-
439
- price_in_decimal?:string;
440
-
441
- /**
442
- * @description The index number of the subscription to which the item price is added. Provide a unique number between &#x60;0&#x60; and &#x60;4&#x60; (inclusive) for each subscription that is to be created.
443
-
444
- */
445
-
446
- index:number;
62
+ export interface SubscriptionItem {
63
+ item_price_id: string;
64
+ item_type: 'plan' | 'addon' | 'charge';
65
+ quantity?: number;
66
+ quantity_in_decimal?: string;
67
+ metered_quantity?: string;
68
+ last_calculated_at?: number;
69
+ unit_price?: number;
70
+ unit_price_in_decimal?: string;
71
+ amount?: number;
72
+ amount_in_decimal?: string;
73
+ billing_period?: number;
74
+ billing_period_unit?: 'day' | 'week' | 'month' | 'year';
75
+ free_quantity?: number;
76
+ free_quantity_in_decimal?: string;
77
+ trial_end?: number;
78
+ billing_cycles?: number;
79
+ service_period_days?: number;
80
+ charge_on_event?:
81
+ | 'subscription_creation'
82
+ | 'subscription_trial_start'
83
+ | 'plan_activation'
84
+ | 'subscription_activation'
85
+ | 'contract_termination';
86
+ charge_once?: boolean;
87
+ charge_on_option?: 'immediately' | 'on_event';
88
+ proration_type?: 'full_term' | 'partial_term' | 'none';
447
89
  }
448
- export interface QuotedContractTerm {
449
- /**
450
- * @description The start date of the contract term
451
-
452
- */
453
-
454
- contract_start:number;
455
-
456
- /**
457
- * @description The end date of the contract term
458
-
459
- */
460
-
461
- contract_end:number;
462
-
463
- /**
464
- * @description The number of billing cycles of the subscription that the contract term is for.
465
-
466
- */
467
-
468
- billing_cycle:number;
469
-
470
- /**
471
- * @description Action to be taken when the contract term completes. \* renew -
472
- * Contract term completes and a new contract term is started for the number of billing cycles specified in [&#x60;contract_billing_cycle_on_renewal&#x60;](subscriptions#create_subscription_for_customer_contract_term_billing_cycle_on_renewal).
473
- * The &#x60;action_at_term_end&#x60; for the new contract term is set to &#x60;renew&#x60;.
474
- \* renew_once - Used when you want to renew the contract term just once. Does the following:
475
- * Contract term completes and a new contract term is started for the number of billing cycles specified in [&#x60;contract_billing_cycle_on_renewal&#x60;](subscriptions#create_subscription_for_customer_contract_term_billing_cycle_on_renewal).
476
- * The &#x60;action_at_term_end&#x60; for the new contract term is set to &#x60;cancel&#x60;.
477
- \* cancel - Contract term completes and subscription is canceled. \* evergreen - Contract term completes and the subscription renews.
478
-
479
-
480
- */
481
-
482
- action_at_term_end:'cancel' | 'renew_once' | 'renew' | 'evergreen';
483
-
484
- /**
485
- * @description The sum of the [totals](invoices#invoice_total) of all the invoices raised as part of the contract term. For &#x60;active&#x60; contract terms, this is a predicted value. The value depends on the [type of currency](./#handling_currency_units). If the subscription was [imported](#import_a_subscription) with the contract term, then this value includes the value passed for &#x60;total_amount_raised&#x60;.
486
-
487
- */
488
-
489
- total_contract_value:number;
490
-
491
- /**
492
- * @description The number of days before [&#x60;contract_end&#x60;](contract_terms#contract_term_contract_end), during which the customer is barred from canceling the contract term. The customer is allowed to cancel the contract term via the Self-Serve Portal only before this period. This allows you to have sufficient time for processing the contract term closure
493
-
494
- */
495
-
496
- cancellation_cutoff_period?:number;
90
+ export interface ItemTier {
91
+ item_price_id: string;
92
+ starting_unit: number;
93
+ ending_unit?: number;
94
+ price: number;
95
+ starting_unit_in_decimal?: string;
96
+ ending_unit_in_decimal?: string;
97
+ price_in_decimal?: string;
98
+ index: number;
99
+ }
100
+ export interface QuotedContractTerm {
101
+ contract_start: number;
102
+ contract_end: number;
103
+ billing_cycle: number;
104
+ action_at_term_end: 'renew' | 'evergreen' | 'cancel' | 'renew_once';
105
+ total_contract_value: number;
106
+ cancellation_cutoff_period?: number;
497
107
  }
108
+ // REQUEST PARAMS
109
+ //---------------
498
110
  }
499
- }
111
+ }