chargebee 2.41.0 → 3.0.0-beta.2

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 +11 -15
  2. package/LICENSE +1 -1
  3. package/README.md +90 -170
  4. package/cjs/RequestWrapper.js +84 -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 +80 -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 +90 -55
  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 +24 -35
  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 +230 -747
  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 -4336
  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 +276 -911
  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 -2935
  117. package/types/resources/NonSubscription.d.ts +0 -30
  118. package/types/resources/Session.d.ts +0 -41
@@ -1,631 +1,153 @@
1
1
  ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+ ///<reference path='./filter.d.ts'/>
2
4
  declare module 'chargebee' {
3
5
  export interface Item {
4
- [key : string] : any;
5
- /**
6
- * @description The identifier for the item. It is unique and immutable.
7
-
8
- */
9
-
10
- id:string;
11
-
12
- /**
13
- * @description A unique display name for the item. This is visible only in Chargebee and not to customers.
14
-
15
- */
16
-
17
- name:string;
18
-
19
- /**
20
- * @description A unique display name for the item.
21
-
22
- */
23
-
24
- external_name?:string;
25
-
26
- /**
27
- * @description Description of the item. This is visible only in Chargebee and not to customers.
28
-
29
- */
30
-
31
- description?:string;
32
-
33
- /**
34
- * @description The status of the item. \* archived - The item is no longer active and no new item prices can be created \* active - The item can be used to create new item prices. \* deleted - Indicates that the item has been [deleted](./items?prod_cat_ver&#x3D;2#delete_an_item). The &#x60;id&#x60; and &#x60;name&#x60; can be reused. Deleted items can be retrieved using [List items](./items?prod_cat_ver&#x3D;2#list_items).
35
-
36
- */
37
-
38
- status?:'archived' | 'deleted' | 'active';
39
-
40
- /**
41
- * @description The version number of this resource. For every change made to the resource, &#x60;resource_version&#x60; is updated with a new timestamp in milliseconds.
42
-
43
- */
44
-
45
- resource_version?:number;
46
-
47
- /**
48
- * @description Timestamp indicating when the item was last updated.
49
-
50
- */
51
-
52
- updated_at?:number;
53
-
54
- /**
55
- * @description The &#x60;id&#x60; of the [Item family](./item_families?prod_cat_ver&#x3D;2) that the item belongs to. Is mandatory when [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) have been enabled.
56
-
57
- */
58
-
59
- item_family_id?:string;
60
-
61
- /**
62
- * @description The type of the item. \* plan - An essential component of a subscription. Every subscription has exactly one plan. It has a recurring charge and its period defines the billing period of the subscription. \* charge - A non-recurring component that can be added to a subscription in addition to its plan. An charge can also be applied to a customer [directly](./invoices?prod_cat_ver&#x3D;2#create_invoice_for_a_charge-item) without being applied to a subscription. \* addon - A recurring component that can be added to a subscription in addition to its plan.
63
-
64
- */
65
-
66
- type:'charge' | 'addon' | 'plan';
67
-
68
- /**
69
- * @description Indicates that the item is a physical product. If Orders are enabled in Chargebee, subscriptions created for this item will have orders associated with them.
70
-
71
- */
72
-
73
- is_shippable?:boolean;
74
-
75
- /**
76
- * @description Specifies if gift subscriptions can be created for this item.
77
-
78
- */
79
-
80
- is_giftable:boolean;
81
-
82
- /**
83
- * @description If &#x60;enabled_for_checkout&#x60;, then the URL to be redirected to once the checkout is complete. This attribute is only available for plan-items.
84
-
85
- */
86
-
87
- redirect_url?:string;
88
-
89
- /**
90
- * @description Allow the plan to subscribed to via Checkout. Applies only for plan-items.
91
- **Note:** Only the in-app version of Checkout is supported for Product Catalog v2.
92
-
93
- */
94
-
95
- enabled_for_checkout:boolean;
96
-
97
- /**
98
- * @description Allow customers to change their subscription to this plan via the [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Applies only for plan-items. This requires the Portal configuration to [allow changing subscriptions](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription).
99
-
100
- */
101
-
102
- enabled_in_portal:boolean;
103
-
104
- /**
105
- * @description The item is included in MRR calculations for your site. This attribute is only applicable for items of &#x60;type &#x3D; charge&#x60; and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude charge-items from MRR calculations, this value is always returned &#x60;false&#x60;.
106
-
107
- */
108
-
109
- included_in_mrr?:boolean;
110
-
111
- /**
112
- * @description Indicates which addon-items and charge-items can be applied to the item. Only meant for plan-items. Other details of attaching items such as whether to attach as a mandatory item or to attach on a certain event, can be specified using the [Create](./attached_items?prod_cat_ver&#x3D;2#create_an_attached_item) or [Update an attached item](./attached_items?prod_cat_ver&#x3D;2#update_an_attached_item) API. \* all - all addon-items and charge-items are applicable to this plan-item. \* restricted - only the addon-items or charge-items provided in &#x60;applicable_items&#x60; can be applied to this plan-item.
113
-
114
- */
115
-
116
- item_applicability:'all' | 'restricted';
117
-
118
- /**
119
- * @description The URL to redirect to once the gift has been claimed by the receiver.
120
-
121
- */
122
-
123
- gift_claim_redirect_url?:string;
124
-
125
- /**
126
- * @description The unit of measure for a quantity-based item. This is displayed on the Chargebee UI and on customer facing documents/pages. The latter includes [hosted pages](./hosted_pages?prod_cat_ver&#x3D;2), [invoices](./invoices?prod_cat_ver&#x3D;2) and [quotes](./quotes?prod_cat_ver&#x3D;2#). Examples follow:
127
-
128
- * &quot;user&quot; for a cloud-collaboration platform.
129
- * &quot;GB&quot; for a data service.
130
- * &quot;issue&quot; for a magazine.
131
-
132
- **Note:** &#x60;unit&#x60; is only exposed via the API to quantity-based addons; it is however NOT exposed to quantity-based plans.
133
-
134
- */
135
-
136
- unit?:string;
137
-
138
- /**
139
- * @description Specifies whether the item undergoes metered billing. When &#x60;true&#x60;, the quantity is calculated from [usage records](/docs/api/usages?prod_cat_ver&#x3D;2). When &#x60;false&#x60;, the &#x60;quantity&#x60; is as determined while adding an item price to the subscription. Applicable only for items of &#x60;type&#x60; &#x60;plan&#x60; or &#x60;addon&#x60; and when [Metered Billing](https://www.chargebee.com/docs/2.0/metered_billing.html) is enabled. The value of this attribute cannot be changed.
140
-
141
- */
142
-
143
- metered:boolean;
144
-
145
- /**
146
- * @description How the quantity is calculated from usage data for the item prices belonging to this item. Only applicable when the item is &#x60;metered&#x60;. This value overrides the one [set at the site level](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing). \* sum_of_usages - the net quantity is the sum of the &#x60;quantity&#x60; of all usages for the current term. \* last_usage - from among the usage records for the [item price](/docs/api/subscriptions?prod_cat_ver&#x3D;2#subscription_subscription_items_item_price_id) with &#x60;usage_date&#x60; within the relevant billing period, the &#x60;quantity&#x60; of the usage record with the most recent &#x60;usage_date&#x60; is taken as the net quantity consumed. \* max_usage - from among the usage records for the [item price](/docs/api/subscriptions?prod_cat_ver&#x3D;2#subscription_subscription_items_item_price_id) with &#x60;usage_date&#x60; within the relevant billing period, the &#x60;quantity&#x60; of the usage record with the maximum value is taken as the net quantity consumed.
147
-
148
- */
149
-
150
- usage_calculation?:'max_usage' | 'sum_of_usages' | 'last_usage';
151
-
152
- /**
153
- * @description Timestamp indicating when this item was archived.
154
-
155
- */
156
-
157
- archived_at?:number;
158
-
159
- /**
160
- * @description The subscription channel this object originated from and is maintained in. \* app_store - The object data is synchronized with data from [in-app subscription(s)](https://apidocs.chargebee.com/docs/api/in_app_subscriptions) created in Apple App Store. Direct manipulation of this object via UI or API is disallowed. \* web - The object was created (and is maintained) for the web channel directly in Chargebee via API or UI. \* play_store - The object data is synchronized with data from [in-app subscription(s)](https://apidocs.chargebee.com/docs/api/in_app_subscriptions) created in Google Play Store. Direct manipulation of this object via UI or API is disallowed.
161
-
162
- In-App Subscriptions is currently in early access. Contact [eap@chargebee.com](mailto:eap@chargebee.com) for more information.
163
-
164
- */
165
-
166
- channel?:Channel;
167
-
168
- /**
169
- * @description A collection of key-value pairs that provides extra information about the item. [Learn more](advanced-features#metadata).
170
-
171
- */
172
-
173
- metadata?:object;
174
-
175
- /**
176
- * @description The list of addons and charges that are allowed to be applied to the plan. This attribute is applicable only for plan-items and that too when &#x60;item_applicability&#x60; is &#x60;restricted&#x60;.
177
-
178
- Other details of attaching items can be specified using the [Create](./attached_items?prod_cat_ver&#x3D;2#create_an_attached_item) or [Update an attached item](./attached_items?prod_cat_ver&#x3D;2#update_an_attached_item) API.
179
-
180
- */
181
-
182
- applicable_items?:Item.ApplicableItem[];
6
+ [key: string]: unknown;
7
+ id: string;
8
+ name: string;
9
+ external_name?: string;
10
+ description?: string;
11
+ status?: 'active' | 'archived' | 'deleted';
12
+ resource_version?: number;
13
+ updated_at?: number;
14
+ item_family_id?: string;
15
+ type: 'plan' | 'addon' | 'charge';
16
+ is_shippable?: boolean;
17
+ is_giftable: boolean;
18
+ redirect_url?: string;
19
+ enabled_for_checkout: boolean;
20
+ enabled_in_portal: boolean;
21
+ included_in_mrr?: boolean;
22
+ item_applicability: 'all' | 'restricted';
23
+ gift_claim_redirect_url?: string;
24
+ unit?: string;
25
+ metered: boolean;
26
+ usage_calculation?: 'sum_of_usages' | 'last_usage' | 'max_usage';
27
+ archived_at?: number;
28
+ channel?: Channel;
29
+ applicable_items?: Item.ApplicableItem[];
30
+ metadata?: any;
183
31
  }
184
- export namespace Item {
185
- export class ItemResource {
186
- /**
187
- * @description Creates a new item.
188
-
189
- */
190
-
191
- create(input:CreateInputParam):ChargebeeRequest<CreateResponse>;
192
-
193
- /**
194
- * @description Retrieve an item resource.
195
32
 
196
- */
197
-
198
- retrieve(item_id:string):ChargebeeRequest<RetrieveResponse>;
199
-
200
- /**
201
- * @description Updates an item with the changes specified. Unspecified item parameters are not modified.
202
-
203
- */
204
-
205
- update(item_id:string, input?:UpdateInputParam):ChargebeeRequest<UpdateResponse>;
206
-
207
- /**
208
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
209
-
210
- */
211
-
212
- list(input?:ListInputParam):ChargebeeRequest<ListResponse>;
213
-
214
- /**
215
- * @description Deletes an item, marking its &#x60;status&#x60; as deleted. This is not allowed if there are &#x60;active&#x60; or &#x60;archived&#x60; item prices under the item. Once deleted, the id and name of the item can be reused.
216
-
217
- */
218
-
219
- delete(item_id:string):ChargebeeRequest<DeleteResponse>;
220
- }
221
- export interface CreateResponse {
222
- item:Item;
33
+ export namespace Item {
34
+ export class ItemResource {
35
+ create(
36
+ input: CreateInputParam,
37
+ headers?: ChargebeeRequestHeader,
38
+ ): Promise<ChargebeeResponse<CreateResponse>>;
39
+
40
+ retrieve(
41
+ item_id: string,
42
+ headers?: ChargebeeRequestHeader,
43
+ ): Promise<ChargebeeResponse<RetrieveResponse>>;
44
+
45
+ update(
46
+ item_id: string,
47
+ input?: UpdateInputParam,
48
+ headers?: ChargebeeRequestHeader,
49
+ ): Promise<ChargebeeResponse<UpdateResponse>>;
50
+
51
+ list(
52
+ input?: ListInputParam,
53
+ headers?: ChargebeeRequestHeader,
54
+ ): Promise<ChargebeeResponse<ListResponse>>;
55
+
56
+ delete(
57
+ item_id: string,
58
+ headers?: ChargebeeRequestHeader,
59
+ ): Promise<ChargebeeResponse<DeleteResponse>>;
223
60
  }
224
- export interface CreateInputParam {
225
- [key : string] : any;
226
- /**
227
- * @description The identifier for the item. Must be unique and is immutable once set.
228
-
229
- */
230
-
231
- id:string;
232
-
233
- /**
234
- * @description A unique display name for the item. Must be unique. This is visible only in Chargebee and not to customers.
235
-
236
- */
237
-
238
- name:string;
239
-
240
- /**
241
- * @description The type of the item. \* plan - An essential component of a subscription. Every subscription has exactly one plan. It has a recurring charge and its period defines the billing period of the subscription. \* charge - A non-recurring component that can be added to a subscription in addition to its plan. An charge can also be applied to a customer [directly](./invoices?prod_cat_ver&#x3D;2#create_invoice_for_a_charge-item) without being applied to a subscription. \* addon - A recurring component that can be added to a subscription in addition to its plan.
242
-
243
- */
244
-
245
- type:'charge' | 'addon' | 'plan';
246
-
247
- /**
248
- * @description Description of the item. This is visible only in Chargebee and not to customers.
249
-
250
- */
251
-
252
- description?:string;
253
-
254
- /**
255
- * @description The &#x60;id&#x60; of the [Item family](./item_families?prod_cat_ver&#x3D;2) that the item belongs to. Is mandatory when [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) have been enabled.
256
-
257
- */
258
-
259
- item_family_id:string;
260
-
261
- /**
262
- * @description Specifies if gift subscriptions can be created for this item.
263
-
264
- */
265
-
266
- is_giftable?:boolean;
267
-
268
- /**
269
- * @description Indicates that the item is a physical product. If Orders are enabled in Chargebee, subscriptions created for this item will have orders associated with them.
270
-
271
- */
272
-
273
- is_shippable?:boolean;
274
-
275
- /**
276
- * @description A unique display name for the item.
277
-
278
- */
279
-
280
- external_name?:string;
281
-
282
- /**
283
- * @description Allow customers to change their subscription to this plan via the [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Applies only for plan-items. This requires the Portal configuration to [allow changing subscriptions](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). Only the in-app version of the Portal is supported for Product Catalog v2.
284
-
285
- */
286
-
287
- enabled_in_portal?:boolean;
288
-
289
- /**
290
- * @description If &#x60;enabled_for_checkout&#x60;, then the URL to be redirected to once the checkout is complete. This attribute is only available for plan-items.
291
-
292
- */
293
-
294
- redirect_url?:string;
295
-
296
- /**
297
- * @description Allow the plan to subscribed to via Checkout. Applies only for plan-items.
298
- **Note:** Only the in-app version of Checkout is supported for Product Catalog v2.
299
-
300
- */
301
-
302
- enabled_for_checkout?:boolean;
303
-
304
- /**
305
- * @description Indicates which addon-items and charge-items can be applied to the item. Only possible for plan-items. Other details of attaching items such as whether to attach as a mandatory item or to attach on a certain event, can be specified using the [Create](./attached_items?prod_cat_ver&#x3D;2#create_an_attached_item) or [Update an attached item](./attached_items?prod_cat_ver&#x3D;2#update_an_attached_item) API. \* all - all addon-items and charge-items are applicable to this plan-item. \* restricted - only the addon-items or charge-items provided in &#x60;applicable_items&#x60; can be applied to this plan-item.
306
-
307
- */
308
-
309
- item_applicability?:'all' | 'restricted';
310
-
311
- /**
312
- * @description The list of ids of addon-items and charge-items that can be applied to the plan-item. This parameter can be provided only for plan-items and that too when item_applicability is restricted. Other details of attaching items can be specified using the [Create](./attached_items?prod_cat_ver&#x3D;2#create_an_attached_item) or [Update an attached item](./attached_items?prod_cat_ver&#x3D;2#update_an_attached_item) API.
313
61
 
314
- */
315
-
316
- applicable_items?:string[];
317
-
318
- /**
319
- * @description The unit of measure for a quantity-based item. This is displayed on the Chargebee UI and on customer facing documents/pages. The latter includes [hosted pages](./hosted_pages?prod_cat_ver&#x3D;2), [invoices](./invoices?prod_cat_ver&#x3D;2) and [quotes](./quotes?prod_cat_ver&#x3D;2#). Examples follow:
320
-
321
- * &quot;user&quot; for a cloud-collaboration platform.
322
- * &quot;GB&quot; for a data service.
323
- * &quot;issue&quot; for a magazine.
324
-
325
- **Note:** &#x60;unit&#x60; is only exposed via the API to quantity-based addons; it is however NOT exposed to quantity-based plans. .
326
-
327
- */
328
-
329
- unit?:string;
330
-
331
- /**
332
- * @description The URL to redirect to once the gift has been claimed by the receiver.
333
-
334
- */
335
-
336
- gift_claim_redirect_url?:string;
337
-
338
- /**
339
- * @description The item is included in MRR calculations for your site. This attribute is only applicable for items of &#x60;type &#x3D; charge&#x60; and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude charge-items from MRR calculations, this value is always returned &#x60;false&#x60;.
340
-
341
- */
342
-
343
- included_in_mrr?:boolean;
344
-
345
- /**
346
- * @description Specifies whether the item undergoes metered billing. When &#x60;true&#x60;, the quantity is calculated from [usage records](/docs/api/usages?prod_cat_ver&#x3D;2). When &#x60;false&#x60;, the &#x60;quantity&#x60; is as determined while adding an item price to the subscription. Applicable only for items of &#x60;type&#x60; &#x60;plan&#x60; or &#x60;addon&#x60; and when [Metered Billing](https://www.chargebee.com/docs/2.0/metered_billing.html) is enabled. The value of this attribute cannot be changed.
347
-
348
- */
349
-
350
- metered?:boolean;
351
-
352
- /**
353
- * @description How the quantity is calculated from usage data for the item prices belonging to this item. Only applicable when the item is &#x60;metered&#x60;. This value overrides the one [set at the site level](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing). . \* sum_of_usages - the net quantity is the sum of the &#x60;quantity&#x60; of all usages for the current term. \* last_usage - from among the usage records for the [item price](/docs/api/subscriptions?prod_cat_ver&#x3D;2#subscription_subscription_items_item_price_id) with &#x60;usage_date&#x60; within the relevant billing period, the &#x60;quantity&#x60; of the usage record with the most recent &#x60;usage_date&#x60; is taken as the net quantity consumed. \* max_usage - from among the usage records for the [item price](/docs/api/subscriptions?prod_cat_ver&#x3D;2#subscription_subscription_items_item_price_id) with &#x60;usage_date&#x60; within the relevant billing period, the &#x60;quantity&#x60; of the usage record with the maximum value is taken as the net quantity consumed.
354
-
355
- */
356
-
357
- usage_calculation?:'max_usage' | 'sum_of_usages' | 'last_usage';
358
-
359
- /**
360
- * @description A collection of key-value pairs that provides extra information about the item.
361
- **Note:** There&#x27;s a character limit of 65,535.
362
- [Learn more](advanced-features#metadata).
363
-
364
- */
365
-
366
- metadata?:object;
367
- }
368
- export interface RetrieveResponse {
369
- item:Item;
62
+ export interface CreateResponse {
63
+ item: Item;
370
64
  }
371
-
372
- export interface UpdateResponse {
373
- item:Item;
374
- }
375
- export interface UpdateInputParam {
376
- [key : string] : any;
377
- /**
378
- * @description The display name for the item. Must be unique. This is visible only in Chargebee and not to customers.
379
-
380
- */
381
-
382
- name?:string;
383
-
384
- /**
385
- * @description Description of the item. This is visible only in Chargebee and not to customers.
386
-
387
- */
388
-
389
- description?:string;
390
-
391
- /**
392
- * @description Indicates that the item is a physical product. If Orders are enabled in Chargebee, subscriptions created for this item will have orders associated with them.
393
-
394
- */
395
-
396
- is_shippable?:boolean;
397
-
398
- /**
399
- * @description A unique display name for the item.
400
-
401
- */
402
-
403
- external_name?:string;
404
-
405
- /**
406
- * @description The &#x60;id&#x60; of the [Item family](./item_families?prod_cat_ver&#x3D;2) that the item belongs to. Is mandatory when [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) have been enabled.
407
-
408
- */
409
-
410
- item_family_id?:string;
411
-
412
- /**
413
- * @description Allow customers to change their subscription to this plan via the [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Applies only for plan-items. This requires the Portal configuration to [allow changing subscriptions](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription).
414
-
415
- */
416
-
417
- enabled_in_portal?:boolean;
418
-
419
- /**
420
- * @description If &#x60;enabled_for_checkout&#x60;, then the URL to be redirected to once the checkout is complete. This parameter is only meant for plan-items.
421
-
422
- */
423
-
424
- redirect_url?:string;
425
-
426
- /**
427
- * @description Allow the plan to subscribed to via Checkout. Applies only for plan-items.
428
- **Note:** Only the in-app version of Checkout is supported for Product Catalog v2.
429
-
430
- */
431
-
432
- enabled_for_checkout?:boolean;
433
-
434
- /**
435
- * @description Indicates which addon-items and charge-items can be applied to the item. Only possible for plan-items. Other details of attaching items such as whether to attach as a mandatory item or to attach on a certain event, can be specified using the [Create](./attached_items?prod_cat_ver&#x3D;2#create_an_attached_item) or [Update an attached item](./attached_items?prod_cat_ver&#x3D;2#update_an_attached_item) API. \* all - all addon-items and charge-items are applicable to this plan-item. \* restricted - only the addon-items or charge-items provided in &#x60;applicable_items&#x60; can be applied to this plan-item.
436
-
437
- */
438
-
439
- item_applicability?:'all' | 'restricted';
440
-
441
- /**
442
- * @description The list of ids of addon-items and charge-items that can be applied to the plan-item. This parameter can be provided only for plan-items and that too when item_applicability is restricted. Other details of attaching items can be specified using the [Create](./attached_items?prod_cat_ver&#x3D;2#create_an_attached_item) or [Update an attached item](./attached_items?prod_cat_ver&#x3D;2#update_an_attached_item) API.
443
-
444
- */
445
-
446
- applicable_items?:string[];
447
-
448
- /**
449
- * @description The unit of measure for a quantity-based item. This is displayed on the Chargebee UI and on customer facing documents/pages. The latter includes [hosted pages](./hosted_pages?prod_cat_ver&#x3D;2), [invoices](./invoices?prod_cat_ver&#x3D;2) and [quotes](./quotes?prod_cat_ver&#x3D;2#). Examples follow:
450
-
451
- * &quot;user&quot; for a cloud-collaboration platform.
452
- * &quot;GB&quot; for a data service.
453
- * &quot;issue&quot; for a magazine.
454
-
455
- **Note:** &#x60;unit&#x60; is only exposed via the API to quantity-based addons; it is however NOT exposed to quantity-based plans. .
456
-
457
- */
458
-
459
- unit?:string;
460
-
461
- /**
462
- * @description The URL to redirect to once the gift has been claimed by the receiver.
463
65
 
464
- */
465
-
466
- gift_claim_redirect_url?:string;
467
-
468
- /**
469
- * @description A collection of key-value pairs that provides extra information about the item. [Learn more](advanced-features#metadata).
470
-
471
- */
472
-
473
- metadata?:object;
474
-
475
- /**
476
- * @description The item is included in MRR calculations for your site. This attribute is only applicable for items of &#x60;type &#x3D; charge&#x60; and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude charge-items from MRR calculations, this value is always returned &#x60;false&#x60;.
477
-
478
- */
479
-
480
- included_in_mrr?:boolean;
481
-
482
- /**
483
- * @description The status of the item. \* active - The item can be used to create new item prices. \* deleted - Indicates that the item has been [deleted](./items?prod_cat_ver&#x3D;2#delete_an_item). The &#x60;id&#x60; and &#x60;name&#x60; can be reused. Deleted items can be retrieved using [List items](./items?prod_cat_ver&#x3D;2#list_items). \* archived - The item is no longer active and no new item prices can be created
484
-
485
- */
486
-
487
- status?:'archived' | 'active';
66
+ export interface RetrieveResponse {
67
+ item: Item;
488
68
  }
489
- export interface ListResponse {
490
- /**
491
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
492
69
 
493
- */
494
-
495
- list:{item:Item}[];
496
-
497
- /**
498
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
499
-
500
- */
501
-
502
- next_offset?:string;
70
+ export interface UpdateResponse {
71
+ item: Item;
503
72
  }
504
- export interface ListInputParam {
505
- [key : string]: any;
506
- /**
507
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
508
-
509
- */
510
-
511
- limit?:number;
512
-
513
- /**
514
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
515
-
516
- */
517
-
518
- offset?:string;
519
-
520
- /**
521
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
522
-
523
- */
524
-
525
- id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
526
-
527
- /**
528
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
529
-
530
- */
531
-
532
- item_family_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
533
-
534
- /**
535
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
536
-
537
- */
538
-
539
- type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string};
540
-
541
- /**
542
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
543
-
544
- */
545
-
546
- name?:{is?:string,is_not?:string,starts_with?:string};
547
-
548
- /**
549
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
550
-
551
- */
552
-
553
- item_applicability?:{in?:string,is?:'all' | 'restricted',is_not?:'all' | 'restricted',not_in?:string};
554
-
555
- /**
556
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
557
73
 
558
- */
559
-
560
- status?:{in?:string,is?:'archived' | 'deleted' | 'active',is_not?:'archived' | 'deleted' | 'active',not_in?:string};
561
-
562
- /**
563
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
564
-
565
- */
566
-
567
- is_giftable?:{is?:'true' | 'false'};
568
-
569
- /**
570
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
571
-
572
- */
573
-
574
- updated_at?:{after?:string,before?:string,between?:string,on?:string};
575
-
576
- /**
577
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
578
-
579
- */
580
-
581
- enabled_for_checkout?:{is?:'true' | 'false'};
582
-
583
- /**
584
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
585
-
586
- */
587
-
588
- enabled_in_portal?:{is?:'true' | 'false'};
589
-
590
- /**
591
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
592
-
593
- */
594
-
595
- metered?:{is?:'true' | 'false'};
596
-
597
- /**
598
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
74
+ export interface ListResponse {
75
+ list: { item: Item }[];
76
+ next_offset?: string;
77
+ }
599
78
 
600
- */
601
-
602
- usage_calculation?:{in?:string,is?:'max_usage' | 'sum_of_usages' | 'last_usage',is_not?:'max_usage' | 'sum_of_usages' | 'last_usage',not_in?:string};
603
-
604
- /**
605
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
79
+ export interface DeleteResponse {
80
+ item: Item;
81
+ }
606
82
 
607
- */
608
-
609
- channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string};
610
-
611
- /**
612
- * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.
83
+ export interface ApplicableItem {
84
+ id?: string;
85
+ }
86
+ // REQUEST PARAMS
87
+ //---------------
613
88
 
614
- */
615
-
616
- sort_by?:{asc?:'updated_at' | 'name' | 'id',desc?:'updated_at' | 'name' | 'id'};
89
+ export interface CreateInputParam {
90
+ id: string;
91
+ name: string;
92
+ type: 'plan' | 'addon' | 'charge';
93
+ description?: string;
94
+ item_family_id: string;
95
+ is_giftable?: boolean;
96
+ is_shippable?: boolean;
97
+ external_name?: string;
98
+ enabled_in_portal?: boolean;
99
+ redirect_url?: string;
100
+ enabled_for_checkout?: boolean;
101
+ item_applicability?: 'all' | 'restricted';
102
+ applicable_items?: string[];
103
+ unit?: string;
104
+ gift_claim_redirect_url?: string;
105
+ included_in_mrr?: boolean;
106
+ metered?: boolean;
107
+ usage_calculation?: 'sum_of_usages' | 'last_usage' | 'max_usage';
108
+ metadata?: any;
109
+ [key: string]: unknown;
617
110
  }
618
- export interface DeleteResponse {
619
- item:Item;
111
+ export interface UpdateInputParam {
112
+ name?: string;
113
+ description?: string;
114
+ is_shippable?: boolean;
115
+ external_name?: string;
116
+ item_family_id?: string;
117
+ enabled_in_portal?: boolean;
118
+ redirect_url?: string;
119
+ enabled_for_checkout?: boolean;
120
+ item_applicability?: 'all' | 'restricted' /**
121
+ * @deprecated Please refer API docs to use other attributes
122
+ */;
123
+
124
+ clear_applicable_items?: boolean;
125
+ applicable_items?: string[];
126
+ unit?: string;
127
+ gift_claim_redirect_url?: string;
128
+ metadata?: any;
129
+ included_in_mrr?: boolean;
130
+ status?: 'active' | 'archived';
131
+ [key: string]: unknown;
620
132
  }
621
-
622
- export interface ApplicableItem {
623
- /**
624
- * @description Id of the addon-item or plan-item that can be applied to the plan-item.
625
-
626
- */
627
-
628
- id?:string;
133
+ export interface ListInputParam {
134
+ limit?: number;
135
+ offset?: string;
136
+ id?: filter.String;
137
+ item_family_id?: filter.String;
138
+ type?: filter.Enum;
139
+ name?: filter.String;
140
+ item_applicability?: filter.Enum;
141
+ status?: filter.Enum;
142
+ is_giftable?: filter.Boolean;
143
+ updated_at?: filter.Timestamp;
144
+ enabled_for_checkout?: filter.Boolean;
145
+ enabled_in_portal?: filter.Boolean;
146
+ metered?: filter.Boolean;
147
+ usage_calculation?: filter.Enum;
148
+ channel?: filter.Enum;
149
+ 'sort_by[asc]'?: string;
150
+ 'sort_by[desc]'?: string;
629
151
  }
630
152
  }
631
- }
153
+ }