chargebee 3.11.0 → 3.12.0

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 (33) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/cjs/environment.js +1 -1
  3. package/cjs/resources/api_endpoints.js +75 -4
  4. package/cjs/util.js +5 -14
  5. package/esm/environment.js +1 -1
  6. package/esm/resources/api_endpoints.js +75 -4
  7. package/esm/util.js +5 -14
  8. package/package.json +5 -1
  9. package/types/core.d.ts +8 -1
  10. package/types/index.d.ts +8 -0
  11. package/types/resources/Comment.d.ts +4 -0
  12. package/types/resources/CreditNote.d.ts +83 -76
  13. package/types/resources/Customer.d.ts +1 -0
  14. package/types/resources/CustomerEntitlement.d.ts +1 -0
  15. package/types/resources/Discount.d.ts +2 -1
  16. package/types/resources/Estimate.d.ts +4 -0
  17. package/types/resources/HostedPage.d.ts +3 -0
  18. package/types/resources/ImpactedCustomer.d.ts +19 -0
  19. package/types/resources/Invoice.d.ts +86 -79
  20. package/types/resources/OmnichannelOneTimeOrder.d.ts +62 -0
  21. package/types/resources/OmnichannelOneTimeOrderItem.d.ts +20 -0
  22. package/types/resources/OmnichannelSubscriptionItemScheduledChange.d.ts +1 -1
  23. package/types/resources/PricingPageSession.d.ts +2 -0
  24. package/types/resources/PromotionalCredit.d.ts +1 -0
  25. package/types/resources/Purchase.d.ts +2 -0
  26. package/types/resources/Quote.d.ts +6 -0
  27. package/types/resources/QuotedCharge.d.ts +5 -0
  28. package/types/resources/RecordedPurchase.d.ts +6 -0
  29. package/types/resources/Subscription.d.ts +9 -2
  30. package/types/resources/SubscriptionEntitlementsCreatedDetail.d.ts +9 -0
  31. package/types/resources/SubscriptionEntitlementsUpdatedDetail.d.ts +9 -0
  32. package/types/resources/UsageFile.d.ts +8 -8
  33. package/types/resources/WebhookEndpoint.d.ts +98 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,67 @@
1
+ ### v3.12.0 (2025-08-19)
2
+ * * *
3
+
4
+ ### New Resources:
5
+ * WebhookEndpoints has been added.
6
+ * OmnichannelOneTimeOrder has been added.
7
+ * OmnichannelOneTimeOrderItem has been added.
8
+
9
+ ### New Attributes:
10
+ * business_entity_id has been added to Comment.
11
+ * business_entity_id has been added to PromotionalCredit.
12
+ * quantity has been added to Discount.
13
+ * business_entity_id has been added to PromotionalCredit.
14
+ * coupon_applicability_mappings[] has been added to QuotedCharge.
15
+ * linked_omnichannel_one_time_orders[] has been added to RecordedPurchase.
16
+ * quantity has been added to Subscripiton#Discount.
17
+
18
+ ### New Input Parameters:
19
+ * transaction[id] has been added to Customer#RecordExcessPaymentRequest.
20
+ * discounts[quantity][] has been added to Estimate#CreateSubItemEstimateRequest.
21
+ * consolidate_entitlements has been added to CustomerEntitlement#EntitlementsForCustomer.
22
+ * discounts[quantity][] has been added to Estimate#CreateSubItemEstimateRequest.
23
+ * discounts[quantity][] has been added to Estimate#CreateSubItemForCustomerEstimateRequest.
24
+ * discounts[quantity][] has been added to Estimate#UpdateSubscriptionForItemsRequest.
25
+ * discounts[quantity][] has been added to Estimate#CreateInvoiceForItemsRequest.
26
+ * discounts[quantity][] has been added to HostedPage#CheckoutOneTimeForItemsRequest.
27
+ * discounts[quantity][] has been added to HostedPage#CheckoutNewForItemsRequest.
28
+ * discounts[quantity][] has been added to HostedPage#CheckoutExistingForItemsRequest.
29
+ * discounts[quantity][] has been added to PricingPageSession#CreateForNewSubscriptionRequest.
30
+ * discounts[quantity][] has been added to PricingPageSession#CreateForExistingSubscriptionRequest.
31
+ * discounts[quantity][] has been added to Purchase#CreateRequest.
32
+ * discounts[quantity][] has been added to Purchase#EstimateRequest.
33
+ * discounts[quantity][] has been added to Quote#CreateSubItemsForCustomerQuoteRequest.
34
+ * discounts[quantity][] has been added to Quote#EditCreateSubCustomerQuoteForItemsRequest.
35
+ * discounts[quantity][] has been added to Quote#UpdateSubscriptionQuoteForItemsRequest.
36
+ * discounts[quantity][] has been added to Quote#EditUpdateSubscriptionQuoteForItemsRequest.
37
+ * discounts[quantity][] has been added to Quote#CreateForChargeItemsAndChargesRequest.
38
+ * discounts[quantity][] has been added to Quote#EditForChargeItemsAndChargesRequest.
39
+ * discounts[quantity][] has been added to Subscription#CreateWithItemsRequest.
40
+ * discounts[quantity][] has been added to Subscription#UpdateForItemsRequest.
41
+ * discounts[quantity][] has been added to Subscription#ImportForItemsRequest.
42
+ * google_play_store[product_id] has been added to RecordedPurchase#CreateRequest.
43
+ * google_play_store[order_id] has been added to RecordedPurchase#CreateRequest.
44
+
45
+ ### New Enums
46
+ * PAUSE has been added to OmnichannelSubscriptionItemScheduledChange#ChangeType.
47
+ * OFFER_QUANTITY has been added to Discount#Type.
48
+ * OFFER_QUANTITY has been added to Subscription#Discount#Type.
49
+ * OMNICHANNEL_ONE_TIME_ORDER has been added to EntityType.
50
+ * OMNICHANNEL_ONE_TIME_ORDER_ITEM has been added to EntityType.
51
+ * USAGE_FILE has been added to EntityType.
52
+ * OMNICHANNEL_ONE_TIME_ORDER_CREATED has been added to EventType.
53
+ * OMNICHANNEL_ONE_TIME_ORDER_ITEM_CANCELLED has been added to EventType.
54
+ * USAGE_FILE_INGESTED has been added to EventType.
55
+ * OMNICHANNEL_SUBSCRIPTION_ITEM_PAUSE_SCHEDULED has been added to EventType.
56
+
57
+
58
+ ### v3.12.0-beta.1 (2025-07-23)
59
+ * * *
60
+
61
+ ### Bug Fixes:
62
+ * Resolved a module dependency issue that was causing runtime failures in the Edge environment.
63
+
64
+
1
65
  ### v3.11.0 (2025-07-18)
2
66
  * * *
3
67
 
@@ -11,7 +11,7 @@ exports.Environment = {
11
11
  hostSuffix: '.chargebee.com',
12
12
  apiPath: '/api/v2',
13
13
  timeout: DEFAULT_TIME_OUT,
14
- clientVersion: 'v3.11.0',
14
+ clientVersion: 'v3.12.0',
15
15
  port: DEFAULT_PORT,
16
16
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
17
17
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -4676,6 +4676,31 @@ exports.Endpoints = {
4676
4676
  ],
4677
4677
  ['retrieve', 'GET', '/recorded_purchases', null, true, null, false, {}, {}],
4678
4678
  ],
4679
+ omnichannelOneTimeOrder: [
4680
+ [
4681
+ 'retrieve',
4682
+ 'GET',
4683
+ '/omnichannel_one_time_orders',
4684
+ null,
4685
+ true,
4686
+ null,
4687
+ false,
4688
+ {},
4689
+ {},
4690
+ ],
4691
+ [
4692
+ 'list',
4693
+ 'GET',
4694
+ '/omnichannel_one_time_orders',
4695
+ null,
4696
+ false,
4697
+ null,
4698
+ false,
4699
+ {},
4700
+ {},
4701
+ ],
4702
+ ],
4703
+ omnichannelOneTimeOrderItem: [],
4679
4704
  rule: [['retrieve', 'GET', '/rules', null, true, null, false, {}, {}]],
4680
4705
  usageEvent: [
4681
4706
  [
@@ -4708,10 +4733,10 @@ exports.Endpoints = {
4708
4733
  omnichannelSubscriptionItemScheduledChange: [],
4709
4734
  usageFile: [
4710
4735
  [
4711
- 'upload',
4736
+ 'uploadUrl',
4712
4737
  'POST',
4713
4738
  '/usage_files',
4714
- '/upload',
4739
+ '/upload_url',
4715
4740
  false,
4716
4741
  'file-ingest',
4717
4742
  false,
@@ -4719,10 +4744,10 @@ exports.Endpoints = {
4719
4744
  {},
4720
4745
  ],
4721
4746
  [
4722
- 'status',
4747
+ 'processingStatus',
4723
4748
  'GET',
4724
4749
  '/usage_files',
4725
- '/status',
4750
+ '/processing_status',
4726
4751
  true,
4727
4752
  'file-ingest',
4728
4753
  false,
@@ -4731,4 +4756,50 @@ exports.Endpoints = {
4731
4756
  ],
4732
4757
  ],
4733
4758
  brand: [],
4759
+ webhookEndpoint: [
4760
+ [
4761
+ 'create',
4762
+ 'POST',
4763
+ '/webhook_endpoints',
4764
+ null,
4765
+ false,
4766
+ null,
4767
+ false,
4768
+ {},
4769
+ {
4770
+ isIdempotent: true,
4771
+ },
4772
+ ],
4773
+ [
4774
+ 'update',
4775
+ 'POST',
4776
+ '/webhook_endpoints',
4777
+ null,
4778
+ true,
4779
+ null,
4780
+ false,
4781
+ {},
4782
+ {
4783
+ isIdempotent: true,
4784
+ },
4785
+ ],
4786
+ ['retrieve', 'GET', '/webhook_endpoints', null, true, null, false, {}, {}],
4787
+ [
4788
+ 'delete',
4789
+ 'POST',
4790
+ '/webhook_endpoints',
4791
+ '/delete',
4792
+ true,
4793
+ null,
4794
+ false,
4795
+ {},
4796
+ {
4797
+ isIdempotent: true,
4798
+ },
4799
+ ],
4800
+ ['list', 'GET', '/webhook_endpoints', null, false, null, false, {}, {}],
4801
+ ],
4802
+ impactedCustomer: [],
4803
+ subscriptionEntitlementsUpdatedDetail: [],
4804
+ subscriptionEntitlementsCreatedDetail: [],
4734
4805
  };
package/cjs/util.js CHANGED
@@ -230,19 +230,10 @@ function log(env, { level = 'INFO', message = '', context = {}, functionName = '
230
230
  const logLine = `[${timestamp}] [${level.toUpperCase()}] [${service}] ${functionName} - ${message}${metaString ? ` (${metaString})` : ''}`;
231
231
  console.debug(logLine);
232
232
  }
233
- const crypto_1 = require("crypto");
234
233
  function generateUUIDv4() {
235
- const bytes = (0, crypto_1.randomBytes)(16);
236
- // Set version to 4 (UUIDv4)
237
- bytes[6] = (bytes[6] & 0x0f) | 0x40;
238
- // Set variant to 10xxxxxx
239
- bytes[8] = (bytes[8] & 0x3f) | 0x80;
240
- const hex = bytes.toString('hex');
241
- return [
242
- hex.slice(0, 8),
243
- hex.slice(8, 12),
244
- hex.slice(12, 16),
245
- hex.slice(16, 20),
246
- hex.slice(20),
247
- ].join('-');
234
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
235
+ const r = (Math.random() * 16) | 0;
236
+ const v = c === 'x' ? r : (r & 0x3) | 0x8;
237
+ return v.toString(16);
238
+ });
248
239
  }
@@ -8,7 +8,7 @@ export const Environment = {
8
8
  hostSuffix: '.chargebee.com',
9
9
  apiPath: '/api/v2',
10
10
  timeout: DEFAULT_TIME_OUT,
11
- clientVersion: 'v3.11.0',
11
+ clientVersion: 'v3.12.0',
12
12
  port: DEFAULT_PORT,
13
13
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
14
14
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -4673,6 +4673,31 @@ export const Endpoints = {
4673
4673
  ],
4674
4674
  ['retrieve', 'GET', '/recorded_purchases', null, true, null, false, {}, {}],
4675
4675
  ],
4676
+ omnichannelOneTimeOrder: [
4677
+ [
4678
+ 'retrieve',
4679
+ 'GET',
4680
+ '/omnichannel_one_time_orders',
4681
+ null,
4682
+ true,
4683
+ null,
4684
+ false,
4685
+ {},
4686
+ {},
4687
+ ],
4688
+ [
4689
+ 'list',
4690
+ 'GET',
4691
+ '/omnichannel_one_time_orders',
4692
+ null,
4693
+ false,
4694
+ null,
4695
+ false,
4696
+ {},
4697
+ {},
4698
+ ],
4699
+ ],
4700
+ omnichannelOneTimeOrderItem: [],
4676
4701
  rule: [['retrieve', 'GET', '/rules', null, true, null, false, {}, {}]],
4677
4702
  usageEvent: [
4678
4703
  [
@@ -4705,10 +4730,10 @@ export const Endpoints = {
4705
4730
  omnichannelSubscriptionItemScheduledChange: [],
4706
4731
  usageFile: [
4707
4732
  [
4708
- 'upload',
4733
+ 'uploadUrl',
4709
4734
  'POST',
4710
4735
  '/usage_files',
4711
- '/upload',
4736
+ '/upload_url',
4712
4737
  false,
4713
4738
  'file-ingest',
4714
4739
  false,
@@ -4716,10 +4741,10 @@ export const Endpoints = {
4716
4741
  {},
4717
4742
  ],
4718
4743
  [
4719
- 'status',
4744
+ 'processingStatus',
4720
4745
  'GET',
4721
4746
  '/usage_files',
4722
- '/status',
4747
+ '/processing_status',
4723
4748
  true,
4724
4749
  'file-ingest',
4725
4750
  false,
@@ -4728,4 +4753,50 @@ export const Endpoints = {
4728
4753
  ],
4729
4754
  ],
4730
4755
  brand: [],
4756
+ webhookEndpoint: [
4757
+ [
4758
+ 'create',
4759
+ 'POST',
4760
+ '/webhook_endpoints',
4761
+ null,
4762
+ false,
4763
+ null,
4764
+ false,
4765
+ {},
4766
+ {
4767
+ isIdempotent: true,
4768
+ },
4769
+ ],
4770
+ [
4771
+ 'update',
4772
+ 'POST',
4773
+ '/webhook_endpoints',
4774
+ null,
4775
+ true,
4776
+ null,
4777
+ false,
4778
+ {},
4779
+ {
4780
+ isIdempotent: true,
4781
+ },
4782
+ ],
4783
+ ['retrieve', 'GET', '/webhook_endpoints', null, true, null, false, {}, {}],
4784
+ [
4785
+ 'delete',
4786
+ 'POST',
4787
+ '/webhook_endpoints',
4788
+ '/delete',
4789
+ true,
4790
+ null,
4791
+ false,
4792
+ {},
4793
+ {
4794
+ isIdempotent: true,
4795
+ },
4796
+ ],
4797
+ ['list', 'GET', '/webhook_endpoints', null, false, null, false, {}, {}],
4798
+ ],
4799
+ impactedCustomer: [],
4800
+ subscriptionEntitlementsUpdatedDetail: [],
4801
+ subscriptionEntitlementsCreatedDetail: [],
4731
4802
  };
package/esm/util.js CHANGED
@@ -212,19 +212,10 @@ export function log(env, { level = 'INFO', message = '', context = {}, functionN
212
212
  const logLine = `[${timestamp}] [${level.toUpperCase()}] [${service}] ${functionName} - ${message}${metaString ? ` (${metaString})` : ''}`;
213
213
  console.debug(logLine);
214
214
  }
215
- import { randomBytes } from 'crypto';
216
215
  export function generateUUIDv4() {
217
- const bytes = randomBytes(16);
218
- // Set version to 4 (UUIDv4)
219
- bytes[6] = (bytes[6] & 0x0f) | 0x40;
220
- // Set variant to 10xxxxxx
221
- bytes[8] = (bytes[8] & 0x3f) | 0x80;
222
- const hex = bytes.toString('hex');
223
- return [
224
- hex.slice(0, 8),
225
- hex.slice(8, 12),
226
- hex.slice(12, 16),
227
- hex.slice(16, 20),
228
- hex.slice(20),
229
- ].join('-');
216
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
217
+ const r = (Math.random() * 16) | 0;
218
+ const v = c === 'x' ? r : (r & 0x3) | 0x8;
219
+ return v.toString(16);
220
+ });
230
221
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.11.0",
3
+ "version": "3.12.0",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
6
  "prepack": "npm install && npm run build",
@@ -36,6 +36,10 @@
36
36
  },
37
37
  "exports": {
38
38
  "types": "./types/index.d.ts",
39
+ "browser": {
40
+ "import": "./esm/chargebee.esm.worker.js",
41
+ "require": "./cjs/chargebee.cjs.worker.js"
42
+ },
39
43
  "worker": {
40
44
  "import": "./esm/chargebee.esm.worker.js",
41
45
  "require": "./cjs/chargebee.cjs.worker.js"
package/types/core.d.ts CHANGED
@@ -144,7 +144,10 @@ declare module 'chargebee' {
144
144
  | 'omnichannel_transaction'
145
145
  | 'recorded_purchase'
146
146
  | 'omnichannel_subscription_item_scheduled_change'
147
- | 'sales_order';
147
+ | 'sales_order'
148
+ | 'omnichannel_one_time_order'
149
+ | 'omnichannel_one_time_order_item'
150
+ | 'usage_file';
148
151
  type EventNameEnum = 'cancellation_page_loaded';
149
152
  type EventTypeEnum =
150
153
  | 'coupon_created'
@@ -349,6 +352,10 @@ declare module 'chargebee' {
349
352
  | 'omnichannel_subscription_item_changed'
350
353
  | 'omnichannel_subscription_item_paused'
351
354
  | 'omnichannel_subscription_item_resumed'
355
+ | 'omnichannel_one_time_order_created'
356
+ | 'omnichannel_one_time_order_item_cancelled'
357
+ | 'usage_file_ingested'
358
+ | 'omnichannel_subscription_item_pause_scheduled'
352
359
  | 'plan_created'
353
360
  | 'plan_updated'
354
361
  | 'plan_deleted'
package/types/index.d.ts CHANGED
@@ -33,6 +33,7 @@
33
33
  ///<reference path='./resources/Gift.d.ts' />
34
34
  ///<reference path='./resources/Hierarchy.d.ts' />
35
35
  ///<reference path='./resources/HostedPage.d.ts' />
36
+ ///<reference path='./resources/ImpactedCustomer.d.ts' />
36
37
  ///<reference path='./resources/ImpactedItem.d.ts' />
37
38
  ///<reference path='./resources/ImpactedItemPrice.d.ts' />
38
39
  ///<reference path='./resources/ImpactedSubscription.d.ts' />
@@ -45,6 +46,8 @@
45
46
  ///<reference path='./resources/ItemPrice.d.ts' />
46
47
  ///<reference path='./resources/Metadata.d.ts' />
47
48
  ///<reference path='./resources/NonSubscription.d.ts' />
49
+ ///<reference path='./resources/OmnichannelOneTimeOrder.d.ts' />
50
+ ///<reference path='./resources/OmnichannelOneTimeOrderItem.d.ts' />
48
51
  ///<reference path='./resources/OmnichannelSubscription.d.ts' />
49
52
  ///<reference path='./resources/OmnichannelSubscriptionItem.d.ts' />
50
53
  ///<reference path='./resources/OmnichannelSubscriptionItemScheduledChange.d.ts' />
@@ -75,6 +78,8 @@
75
78
  ///<reference path='./resources/SiteMigrationDetail.d.ts' />
76
79
  ///<reference path='./resources/Subscription.d.ts' />
77
80
  ///<reference path='./resources/SubscriptionEntitlement.d.ts' />
81
+ ///<reference path='./resources/SubscriptionEntitlementsCreatedDetail.d.ts' />
82
+ ///<reference path='./resources/SubscriptionEntitlementsUpdatedDetail.d.ts' />
78
83
  ///<reference path='./resources/SubscriptionEstimate.d.ts' />
79
84
  ///<reference path='./resources/TaxWithheld.d.ts' />
80
85
  ///<reference path='./resources/ThirdPartyPaymentMethod.d.ts' />
@@ -86,6 +91,7 @@
86
91
  ///<reference path='./resources/UsageEvent.d.ts' />
87
92
  ///<reference path='./resources/UsageFile.d.ts' />
88
93
  ///<reference path='./resources/VirtualBankAccount.d.ts' />
94
+ ///<reference path='./resources/WebhookEndpoint.d.ts' />
89
95
 
90
96
  export type Config = {
91
97
  /**
@@ -186,6 +192,7 @@ declare module 'chargebee' {
186
192
  itemFamily: ItemFamily.ItemFamilyResource;
187
193
  itemPrice: ItemPrice.ItemPriceResource;
188
194
  nonSubscription: NonSubscription.NonSubscriptionResource;
195
+ omnichannelOneTimeOrder: OmnichannelOneTimeOrder.OmnichannelOneTimeOrderResource;
189
196
  omnichannelSubscription: OmnichannelSubscription.OmnichannelSubscriptionResource;
190
197
  omnichannelSubscriptionItem: OmnichannelSubscriptionItem.OmnichannelSubscriptionItemResource;
191
198
  order: Order.OrderResource;
@@ -214,5 +221,6 @@ declare module 'chargebee' {
214
221
  usageEvent: UsageEvent.UsageEventResource;
215
222
  usageFile: UsageFile.UsageFileResource;
216
223
  virtualBankAccount: VirtualBankAccount.VirtualBankAccountResource;
224
+ webhookEndpoint: WebhookEndpoint.WebhookEndpointResource;
217
225
  }
218
226
  }
@@ -10,6 +10,7 @@ declare module 'chargebee' {
10
10
  created_at: number;
11
11
  type: 'user' | 'system';
12
12
  entity_id: string;
13
+ business_entity_id?: string;
13
14
  }
14
15
 
15
16
  export namespace Comment {
@@ -82,6 +83,9 @@ declare module 'chargebee' {
82
83
  | 'recorded_purchase'
83
84
  | 'omnichannel_subscription_item_scheduled_change'
84
85
  | 'sales_order'
86
+ | 'omnichannel_one_time_order'
87
+ | 'omnichannel_one_time_order_item'
88
+ | 'usage_file'
85
89
  | 'item_family'
86
90
  | 'item'
87
91
  | 'item_price'