chargebee 3.30.1 → 3.32.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 (89) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +14 -0
  3. package/cjs/RequestWrapper.js +12 -1
  4. package/cjs/chargebee.cjs.js +1 -0
  5. package/cjs/createChargebee.js +5 -1
  6. package/cjs/environment.js +1 -1
  7. package/cjs/resources/api_endpoints.js +84 -2
  8. package/cjs/resources/webhook/eventType.js +4 -0
  9. package/cjs/schema/coupon.schema.js +1 -1
  10. package/cjs/schema/credit_note.schema.js +7 -2
  11. package/cjs/schema/credit_unit.schema.js +2 -2
  12. package/cjs/schema/entitlement.schema.js +4 -4
  13. package/cjs/schema/entitlement_override.schema.js +1 -1
  14. package/cjs/schema/estimate.schema.js +2 -2
  15. package/cjs/schema/event.schema.js +16 -0
  16. package/cjs/schema/export.schema.js +35 -3
  17. package/cjs/schema/hosted_page.schema.js +1 -0
  18. package/cjs/schema/index.js +1 -0
  19. package/cjs/schema/invoice.schema.js +11 -4
  20. package/cjs/schema/ledger_operation.schema.js +2 -2
  21. package/cjs/schema/meter.schema.js +1 -1
  22. package/cjs/schema/omnichannel_subscription.schema.js +6 -2
  23. package/cjs/schema/payment_intent.schema.js +4 -0
  24. package/cjs/schema/payment_source.schema.js +9 -2
  25. package/cjs/schema/pricing_page_session.schema.js +1 -1
  26. package/cjs/schema/quote.schema.js +60 -0
  27. package/cjs/schema/quote_entitlement.schema.js +25 -0
  28. package/cjs/schema/ramp.schema.js +2 -2
  29. package/cjs/schema/subscription.schema.js +2 -2
  30. package/cjs/schema/webhook_endpoint.schema.js +8 -0
  31. package/cjs/telemetry/index.js +13 -1
  32. package/cjs/telemetry/sdkTelemetryEmitter.js +64 -0
  33. package/cjs/telemetry/sdkTelemetryFeature.js +22 -0
  34. package/cjs/telemetry/sdkTelemetryHeader.js +15 -0
  35. package/cjs/telemetry/sdkTelemetryHeaderBuilder.js +34 -0
  36. package/cjs/telemetry/sdkTelemetryState.js +36 -0
  37. package/esm/RequestWrapper.js +13 -2
  38. package/esm/chargebee.esm.js +1 -1
  39. package/esm/createChargebee.js +5 -1
  40. package/esm/environment.js +1 -1
  41. package/esm/resources/api_endpoints.js +84 -2
  42. package/esm/resources/webhook/eventType.js +4 -0
  43. package/esm/schema/coupon.schema.js +1 -1
  44. package/esm/schema/credit_note.schema.js +6 -1
  45. package/esm/schema/credit_unit.schema.js +2 -2
  46. package/esm/schema/entitlement.schema.js +4 -4
  47. package/esm/schema/entitlement_override.schema.js +1 -1
  48. package/esm/schema/estimate.schema.js +2 -2
  49. package/esm/schema/event.schema.js +16 -0
  50. package/esm/schema/export.schema.js +34 -2
  51. package/esm/schema/hosted_page.schema.js +1 -0
  52. package/esm/schema/index.js +1 -0
  53. package/esm/schema/invoice.schema.js +10 -3
  54. package/esm/schema/ledger_operation.schema.js +2 -2
  55. package/esm/schema/meter.schema.js +1 -1
  56. package/esm/schema/omnichannel_subscription.schema.js +6 -2
  57. package/esm/schema/payment_intent.schema.js +4 -0
  58. package/esm/schema/payment_source.schema.js +8 -1
  59. package/esm/schema/pricing_page_session.schema.js +1 -1
  60. package/esm/schema/quote.schema.js +60 -0
  61. package/esm/schema/quote_entitlement.schema.js +22 -0
  62. package/esm/schema/ramp.schema.js +2 -2
  63. package/esm/schema/subscription.schema.js +2 -2
  64. package/esm/schema/webhook_endpoint.schema.js +8 -0
  65. package/esm/telemetry/index.js +5 -0
  66. package/esm/telemetry/sdkTelemetryEmitter.js +61 -0
  67. package/esm/telemetry/sdkTelemetryFeature.js +19 -0
  68. package/esm/telemetry/sdkTelemetryHeader.js +12 -0
  69. package/esm/telemetry/sdkTelemetryHeaderBuilder.js +31 -0
  70. package/esm/telemetry/sdkTelemetryState.js +32 -0
  71. package/package.json +5 -9
  72. package/types/core.d.ts +78 -3
  73. package/types/index.d.ts +15 -2
  74. package/types/resources/Content.d.ts +4 -0
  75. package/types/resources/CreditNote.d.ts +14 -0
  76. package/types/resources/Event.d.ts +4 -0
  77. package/types/resources/Export.d.ts +20 -0
  78. package/types/resources/GatewayPaymentMethodToken.d.ts +15 -0
  79. package/types/resources/HostedPage.d.ts +1 -0
  80. package/types/resources/Invoice.d.ts +17 -1
  81. package/types/resources/OmnichannelSubscriptionItemMetric.d.ts +18 -0
  82. package/types/resources/PaymentIntent.d.ts +14 -11
  83. package/types/resources/PaymentSource.d.ts +17 -0
  84. package/types/resources/PricingPageSession.d.ts +1 -1
  85. package/types/resources/Quote.d.ts +45 -0
  86. package/types/resources/QuoteEntitlement.d.ts +49 -0
  87. package/types/resources/QuotedRamp.d.ts +1 -0
  88. package/types/resources/VaultedPaymentMethod.d.ts +28 -0
  89. package/types/resources/WebhookEvent.d.ts +24 -0
@@ -717,6 +717,7 @@ const CreateSubItemsForCustomerQuoteQuoteSubscriptionItemsSchema = z.object({
717
717
  .optional(),
718
718
  start_date: z.array(z.number().int().optional()).optional(),
719
719
  end_date: z.array(z.number().int().optional()).optional(),
720
+ description: z.array(z.string().max(2000).optional()).optional(),
720
721
  ramp_tier_id: z.array(z.string().max(105).optional()).optional(),
721
722
  });
722
723
  const CreateSubItemsForCustomerQuoteQuoteDiscountsSchema = z.object({
@@ -755,6 +756,19 @@ const CreateSubItemsForCustomerQuoteQuoteCouponsSchema = z.object({
755
756
  start_date: z.array(z.number().int().optional()).optional(),
756
757
  end_date: z.array(z.number().int().optional()).optional(),
757
758
  });
759
+ const CreateSubItemsForCustomerQuoteQuoteEntitlementOverridesSchema = z.object({
760
+ feature_id: z.array(z.string().max(50).optional()).optional(),
761
+ entity_id: z.array(z.string().max(100).optional()).optional(),
762
+ entity_type: z
763
+ .array(z
764
+ .enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
765
+ .optional())
766
+ .optional(),
767
+ value: z.array(z.string().max(50).optional()).optional(),
768
+ is_enabled: z.array(z.boolean().optional()).optional(),
769
+ start_date: z.array(z.number().int().optional()).optional(),
770
+ end_date: z.array(z.number().int().optional()).optional(),
771
+ });
758
772
  const CreateSubItemsForCustomerQuoteQuoteBodySchema = z.looseObject({
759
773
  name: z.string().max(100).optional(),
760
774
  notes: z.string().max(10000).optional(),
@@ -774,6 +788,7 @@ const CreateSubItemsForCustomerQuoteQuoteBodySchema = z.looseObject({
774
788
  discounts: CreateSubItemsForCustomerQuoteQuoteDiscountsSchema.optional(),
775
789
  item_tiers: CreateSubItemsForCustomerQuoteQuoteItemTiersSchema.optional(),
776
790
  coupons: CreateSubItemsForCustomerQuoteQuoteCouponsSchema.optional(),
791
+ entitlement_overrides: CreateSubItemsForCustomerQuoteQuoteEntitlementOverridesSchema.optional(),
777
792
  });
778
793
  export { CreateSubItemsForCustomerQuoteQuoteBodySchema };
779
794
  //Quote.editCreateSubCustomerQuoteForItems
@@ -880,6 +895,7 @@ const EditCreateSubCustomerQuoteForItemsQuoteSubscriptionItemsSchema = z.object(
880
895
  .optional(),
881
896
  start_date: z.array(z.number().int().optional()).optional(),
882
897
  end_date: z.array(z.number().int().optional()).optional(),
898
+ description: z.array(z.string().max(2000).optional()).optional(),
883
899
  ramp_tier_id: z.array(z.string().max(105).optional()).optional(),
884
900
  });
885
901
  const EditCreateSubCustomerQuoteForItemsQuoteDiscountsSchema = z.object({
@@ -918,6 +934,19 @@ const EditCreateSubCustomerQuoteForItemsQuoteCouponsSchema = z.object({
918
934
  start_date: z.array(z.number().int().optional()).optional(),
919
935
  end_date: z.array(z.number().int().optional()).optional(),
920
936
  });
937
+ const EditCreateSubCustomerQuoteForItemsQuoteEntitlementOverridesSchema = z.object({
938
+ feature_id: z.array(z.string().max(50).optional()).optional(),
939
+ entity_id: z.array(z.string().max(100).optional()).optional(),
940
+ entity_type: z
941
+ .array(z
942
+ .enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
943
+ .optional())
944
+ .optional(),
945
+ value: z.array(z.string().max(50).optional()).optional(),
946
+ is_enabled: z.array(z.boolean().optional()).optional(),
947
+ start_date: z.array(z.number().int().optional()).optional(),
948
+ end_date: z.array(z.number().int().optional()).optional(),
949
+ });
921
950
  const EditCreateSubCustomerQuoteForItemsQuoteBodySchema = z.looseObject({
922
951
  notes: z.string().max(10000).optional(),
923
952
  expires_at: z.number().int().optional(),
@@ -936,6 +965,7 @@ const EditCreateSubCustomerQuoteForItemsQuoteBodySchema = z.looseObject({
936
965
  discounts: EditCreateSubCustomerQuoteForItemsQuoteDiscountsSchema.optional(),
937
966
  item_tiers: EditCreateSubCustomerQuoteForItemsQuoteItemTiersSchema.optional(),
938
967
  coupons: EditCreateSubCustomerQuoteForItemsQuoteCouponsSchema.optional(),
968
+ entitlement_overrides: EditCreateSubCustomerQuoteForItemsQuoteEntitlementOverridesSchema.optional(),
939
969
  });
940
970
  export { EditCreateSubCustomerQuoteForItemsQuoteBodySchema };
941
971
  //Quote.updateSubscriptionQuoteForItems
@@ -1046,6 +1076,7 @@ const UpdateSubscriptionQuoteForItemsQuoteSubscriptionItemsSchema = z.object({
1046
1076
  item_type: z.array(z.enum(['plan', 'addon', 'charge']).optional()).optional(),
1047
1077
  start_date: z.array(z.number().int().optional()).optional(),
1048
1078
  end_date: z.array(z.number().int().optional()).optional(),
1079
+ description: z.array(z.string().max(2000).optional()).optional(),
1049
1080
  ramp_tier_id: z.array(z.string().max(105).optional()).optional(),
1050
1081
  });
1051
1082
  const UpdateSubscriptionQuoteForItemsQuoteDiscountsSchema = z.object({
@@ -1086,6 +1117,19 @@ const UpdateSubscriptionQuoteForItemsQuoteCouponsSchema = z.object({
1086
1117
  start_date: z.array(z.number().int().optional()).optional(),
1087
1118
  end_date: z.array(z.number().int().optional()).optional(),
1088
1119
  });
1120
+ const UpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema = z.object({
1121
+ feature_id: z.array(z.string().max(50).optional()).optional(),
1122
+ entity_id: z.array(z.string().max(100).optional()).optional(),
1123
+ entity_type: z
1124
+ .array(z
1125
+ .enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
1126
+ .optional())
1127
+ .optional(),
1128
+ value: z.array(z.string().max(50).optional()).optional(),
1129
+ is_enabled: z.array(z.boolean().optional()).optional(),
1130
+ start_date: z.array(z.number().int().optional()).optional(),
1131
+ end_date: z.array(z.number().int().optional()).optional(),
1132
+ });
1089
1133
  const UpdateSubscriptionQuoteForItemsQuoteBodySchema = z.looseObject({
1090
1134
  name: z.string().max(100).optional(),
1091
1135
  notes: z.string().max(10000).optional(),
@@ -1112,6 +1156,7 @@ const UpdateSubscriptionQuoteForItemsQuoteBodySchema = z.looseObject({
1112
1156
  discounts: UpdateSubscriptionQuoteForItemsQuoteDiscountsSchema.optional(),
1113
1157
  item_tiers: UpdateSubscriptionQuoteForItemsQuoteItemTiersSchema.optional(),
1114
1158
  coupons: UpdateSubscriptionQuoteForItemsQuoteCouponsSchema.optional(),
1159
+ entitlement_overrides: UpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema.optional(),
1115
1160
  });
1116
1161
  export { UpdateSubscriptionQuoteForItemsQuoteBodySchema };
1117
1162
  //Quote.editUpdateSubscriptionQuoteForItems
@@ -1223,6 +1268,7 @@ const EditUpdateSubscriptionQuoteForItemsQuoteSubscriptionItemsSchema = z.object
1223
1268
  .optional(),
1224
1269
  start_date: z.array(z.number().int().optional()).optional(),
1225
1270
  end_date: z.array(z.number().int().optional()).optional(),
1271
+ description: z.array(z.string().max(2000).optional()).optional(),
1226
1272
  ramp_tier_id: z.array(z.string().max(105).optional()).optional(),
1227
1273
  });
1228
1274
  const EditUpdateSubscriptionQuoteForItemsQuoteDiscountsSchema = z.object({
@@ -1263,6 +1309,19 @@ const EditUpdateSubscriptionQuoteForItemsQuoteCouponsSchema = z.object({
1263
1309
  start_date: z.array(z.number().int().optional()).optional(),
1264
1310
  end_date: z.array(z.number().int().optional()).optional(),
1265
1311
  });
1312
+ const EditUpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema = z.object({
1313
+ feature_id: z.array(z.string().max(50).optional()).optional(),
1314
+ entity_id: z.array(z.string().max(100).optional()).optional(),
1315
+ entity_type: z
1316
+ .array(z
1317
+ .enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
1318
+ .optional())
1319
+ .optional(),
1320
+ value: z.array(z.string().max(50).optional()).optional(),
1321
+ is_enabled: z.array(z.boolean().optional()).optional(),
1322
+ start_date: z.array(z.number().int().optional()).optional(),
1323
+ end_date: z.array(z.number().int().optional()).optional(),
1324
+ });
1266
1325
  const EditUpdateSubscriptionQuoteForItemsQuoteBodySchema = z.looseObject({
1267
1326
  notes: z.string().max(10000).optional(),
1268
1327
  expires_at: z.number().int().optional(),
@@ -1288,6 +1347,7 @@ const EditUpdateSubscriptionQuoteForItemsQuoteBodySchema = z.looseObject({
1288
1347
  discounts: EditUpdateSubscriptionQuoteForItemsQuoteDiscountsSchema.optional(),
1289
1348
  item_tiers: EditUpdateSubscriptionQuoteForItemsQuoteItemTiersSchema.optional(),
1290
1349
  coupons: EditUpdateSubscriptionQuoteForItemsQuoteCouponsSchema.optional(),
1350
+ entitlement_overrides: EditUpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema.optional(),
1291
1351
  });
1292
1352
  export { EditUpdateSubscriptionQuoteForItemsQuoteBodySchema };
1293
1353
  //Quote.createForChargeItemsAndCharges
@@ -0,0 +1,22 @@
1
+ // Generated Zod schemas: QuoteEntitlement
2
+ // Actions: listQuoteEntitlements
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //QuoteEntitlement.listQuoteEntitlements
6
+ const ListQuoteEntitlementsQuoteEntitlementEntityIdSchema = z.object({
7
+ is: z.string().min(1).optional(),
8
+ });
9
+ const ListQuoteEntitlementsQuoteEntitlementStartDateSchema = z.object({
10
+ on: z.string().regex(RegExp('^\\d{10}$')).optional(),
11
+ });
12
+ const ListQuoteEntitlementsQuoteEntitlementEndDateSchema = z.object({
13
+ on: z.string().regex(RegExp('^\\d{10}$')).optional(),
14
+ });
15
+ const ListQuoteEntitlementsQuoteEntitlementBodySchema = z.looseObject({
16
+ limit: z.number().int().min(1).max(100).optional(),
17
+ offset: z.string().max(1000).optional(),
18
+ entity_id: ListQuoteEntitlementsQuoteEntitlementEntityIdSchema.optional(),
19
+ start_date: ListQuoteEntitlementsQuoteEntitlementStartDateSchema.optional(),
20
+ end_date: ListQuoteEntitlementsQuoteEntitlementEndDateSchema.optional(),
21
+ });
22
+ export { ListQuoteEntitlementsQuoteEntitlementBodySchema };
@@ -208,12 +208,12 @@ const UpdateRampBodySchema = z.looseObject({
208
208
  export { UpdateRampBodySchema };
209
209
  //Ramp.list
210
210
  const ListRampStatusSchema = z.object({
211
- in: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
212
211
  is: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
212
+ in: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
213
213
  });
214
214
  const ListRampSubscriptionIdSchema = z.object({
215
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
216
215
  is: z.string().min(1).optional(),
216
+ in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
217
217
  });
218
218
  const ListRampEffectiveFromSchema = z.object({
219
219
  after: z.string().regex(RegExp('^\\d{10}$')).optional(),
@@ -3279,7 +3279,7 @@ const CancelSubscriptionBodySchema = z.looseObject({
3279
3279
  end_of_term: z.boolean().default(false).optional(),
3280
3280
  cancel_at: z.number().int().optional(),
3281
3281
  credit_option_for_current_term_charges: z
3282
- .enum(['none', 'prorate', 'full'])
3282
+ .enum(['none', 'prorate', 'full', 'consumption_based'])
3283
3283
  .optional(),
3284
3284
  unbilled_charges_option: z.enum(['invoice', 'delete']).optional(),
3285
3285
  account_receivables_handling: z
@@ -3324,7 +3324,7 @@ const CancelForItemsSubscriptionBodySchema = z.looseObject({
3324
3324
  end_of_term: z.boolean().default(false).optional(),
3325
3325
  cancel_at: z.number().int().optional(),
3326
3326
  credit_option_for_current_term_charges: z
3327
- .enum(['none', 'prorate', 'full'])
3327
+ .enum(['none', 'prorate', 'full', 'consumption_based'])
3328
3328
  .optional(),
3329
3329
  unbilled_charges_option: z.enum(['invoice', 'delete']).optional(),
3330
3330
  account_receivables_handling: z
@@ -241,10 +241,14 @@ const CreateWebhookEndpointBodySchema = z.looseObject({
241
241
  'alert_status_changed',
242
242
  'omnichannel_subscription_item_updated',
243
243
  'omnichannel_subscription_item_recovered',
244
+ 'omnichannel_subscription_item_mrr_updated',
244
245
  'ledger_account_balance_updated',
245
246
  'grant_blocks_created',
246
247
  'grant_blocks_updated',
247
248
  'ledger_updated',
249
+ 'vault_token_created',
250
+ 'vault_token_updated',
251
+ 'vault_token_deleted',
248
252
  'plan_created',
249
253
  'plan_updated',
250
254
  'plan_deleted',
@@ -492,10 +496,14 @@ const UpdateWebhookEndpointBodySchema = z.looseObject({
492
496
  'alert_status_changed',
493
497
  'omnichannel_subscription_item_updated',
494
498
  'omnichannel_subscription_item_recovered',
499
+ 'omnichannel_subscription_item_mrr_updated',
495
500
  'ledger_account_balance_updated',
496
501
  'grant_blocks_created',
497
502
  'grant_blocks_updated',
498
503
  'ledger_updated',
504
+ 'vault_token_created',
505
+ 'vault_token_updated',
506
+ 'vault_token_deleted',
499
507
  'plan_created',
500
508
  'plan_updated',
501
509
  'plan_deleted',
@@ -6,3 +6,8 @@
6
6
  */
7
7
  export { CHARGEBEE_SDK_NAME, CHARGEBEE_TELEMETRY_HEADER_EXCLUDE_PREFIX, CHARGEBEE_TELEMETRY_HEADER_PREFIX, HTTP_REQUEST_HEADER_ATTRIBUTE_PREFIX, TELEMETRY_SPAN_NAME_PREFIX, TelemetryAttributeKeys, } from './types.js';
8
8
  export { NO_OP_TELEMETRY_ADAPTER, NoOpTelemetryAdapter, buildRequestEndSpanAttributes, buildRequestHeaderSpanAttributes, buildRequestStartSpanAttributes, buildRequestTelemetryContext, buildRequestTelemetryResult, buildSpanName, extractHttpStatusCode, extractRequestTelemetryError, resolveChargebeeApiVersion, } from './TelemetryAdapter.js';
9
+ export { SDK_TELEMETRY_FEATURES_KEY, SDK_TELEMETRY_HEADER_NAME, SDK_TELEMETRY_MAX_HEADER_BYTES, } from './sdkTelemetryHeader.js';
10
+ export { SdkTelemetryFeature } from './sdkTelemetryFeature.js';
11
+ export { SdkTelemetryState } from './sdkTelemetryState.js';
12
+ export { buildSdkTelemetryHeader } from './sdkTelemetryHeaderBuilder.js';
13
+ export { attachSdkTelemetryHeader, } from './sdkTelemetryEmitter.js';
@@ -0,0 +1,61 @@
1
+ /*
2
+ * This file is auto-generated by Chargebee.
3
+ * For more information on how to make changes to this file, please see the README.
4
+ * Reach out to dx@chargebee.com for any questions.
5
+ * Copyright 2026 Chargebee Inc.
6
+ */
7
+ import { buildSdkTelemetryHeader } from './sdkTelemetryHeaderBuilder.js';
8
+ import { SdkTelemetryFeature } from './sdkTelemetryFeature.js';
9
+ import { SDK_TELEMETRY_HEADER_NAME } from './sdkTelemetryHeader.js';
10
+ /**
11
+ * Emits the anonymous SDK telemetry request header, independently of any customer telemetry
12
+ * adapter.
13
+ *
14
+ * On the first API call of a client instance, attaches {@code f;…} with enabled feature codes when
15
+ * any are present; omits the header when none are enabled. Later calls on the same client never
16
+ * attach again. SDK identity is correlated via User-Agent. Every failure path is swallowed and
17
+ * logged at WARNING: telemetry must never fail an API call.
18
+ */
19
+ export function attachSdkTelemetryHeader(env, headers) {
20
+ var _a;
21
+ if (env.sdkTelemetryEnabled === false) {
22
+ return;
23
+ }
24
+ try {
25
+ if (!((_a = env.sdkTelemetryState) === null || _a === void 0 ? void 0 : _a.tryMarkEmitted())) {
26
+ return;
27
+ }
28
+ const headerValue = buildSdkTelemetryHeader(resolveFeatures(env));
29
+ if (!headerValue) {
30
+ return;
31
+ }
32
+ headers[SDK_TELEMETRY_HEADER_NAME] = headerValue;
33
+ }
34
+ catch (err) {
35
+ logSuppressed('attach header', err);
36
+ }
37
+ }
38
+ /** Collects enabled feature codes for the current client configuration. */
39
+ function resolveFeatures(env) {
40
+ const features = [];
41
+ if (env.telemetryAdapter !== undefined) {
42
+ features.push(SdkTelemetryFeature.TELEMETRY_ADAPTER);
43
+ }
44
+ if (env.httpClientIsCustom) {
45
+ features.push(SdkTelemetryFeature.CUSTOM_TRANSPORT);
46
+ }
47
+ if (isRetryConfigActive(env)) {
48
+ features.push(SdkTelemetryFeature.RETRY_CONFIG);
49
+ }
50
+ return features;
51
+ }
52
+ /** Whether retries are enabled on the client. */
53
+ function isRetryConfigActive(env) {
54
+ var _a;
55
+ return ((_a = env.retryConfig) === null || _a === void 0 ? void 0 : _a.enabled) === true;
56
+ }
57
+ /** Logs a suppressed telemetry failure without affecting the API call. */
58
+ function logSuppressed(step, err) {
59
+ const message = err instanceof Error ? err.message : String(err);
60
+ console.warn(`SDK telemetry could not ${step} (${message}); API call unaffected.`, err);
61
+ }
@@ -0,0 +1,19 @@
1
+ /*
2
+ * This file is auto-generated by Chargebee.
3
+ * For more information on how to make changes to this file, please see the README.
4
+ * Reach out to dx@chargebee.com for any questions.
5
+ * Copyright 2026 Chargebee Inc.
6
+ */
7
+ /**
8
+ * SDK configuration features reported under the {@code f} segment of
9
+ * {@link SDK_TELEMETRY_HEADER_NAME}. Wire codes are maintained in sdk-generator.
10
+ */
11
+ export var SdkTelemetryFeature;
12
+ (function (SdkTelemetryFeature) {
13
+ /** Customer TelemetryAdapter configured. */
14
+ SdkTelemetryFeature["TELEMETRY_ADAPTER"] = "ta";
15
+ /** Custom HTTP client configured. */
16
+ SdkTelemetryFeature["CUSTOM_TRANSPORT"] = "ct";
17
+ /** Retries enabled on the client. */
18
+ SdkTelemetryFeature["RETRY_CONFIG"] = "rc";
19
+ })(SdkTelemetryFeature || (SdkTelemetryFeature = {}));
@@ -0,0 +1,12 @@
1
+ /*
2
+ * This file is auto-generated by Chargebee.
3
+ * For more information on how to make changes to this file, please see the README.
4
+ * Reach out to dx@chargebee.com for any questions.
5
+ * Copyright 2026 Chargebee Inc.
6
+ */
7
+ /** Constants for the anonymous SDK telemetry request header. */
8
+ export const SDK_TELEMETRY_HEADER_NAME = 'x-chargebee-sdk-telemetry';
9
+ /** Defensive size cap; feature-only values are tiny. */
10
+ export const SDK_TELEMETRY_MAX_HEADER_BYTES = 4096;
11
+ /** RFC 9651 sf-list item name for the features segment. */
12
+ export const SDK_TELEMETRY_FEATURES_KEY = 'f';
@@ -0,0 +1,31 @@
1
+ /*
2
+ * This file is auto-generated by Chargebee.
3
+ * For more information on how to make changes to this file, please see the README.
4
+ * Reach out to dx@chargebee.com for any questions.
5
+ * Copyright 2026 Chargebee Inc.
6
+ */
7
+ import { SDK_TELEMETRY_FEATURES_KEY, SDK_TELEMETRY_MAX_HEADER_BYTES, } from './sdkTelemetryHeader.js';
8
+ /**
9
+ * Builds RFC 9651 values for {@link SDK_TELEMETRY_HEADER_NAME}: a features segment keyed by
10
+ * {@link SDK_TELEMETRY_FEATURES_KEY} with enabled feature codes as boolean params
11
+ * (for example {@code f;ta;rc}). Correlate SDK identity via User-Agent.
12
+ */
13
+ export function buildSdkTelemetryHeader(features) {
14
+ if (!features || features.length === 0) {
15
+ return undefined;
16
+ }
17
+ let value = SDK_TELEMETRY_FEATURES_KEY;
18
+ for (const feature of features) {
19
+ if (feature == null) {
20
+ continue;
21
+ }
22
+ value += `;${feature}`;
23
+ }
24
+ if (value.length === SDK_TELEMETRY_FEATURES_KEY.length) {
25
+ return undefined;
26
+ }
27
+ if (new TextEncoder().encode(value).length > SDK_TELEMETRY_MAX_HEADER_BYTES) {
28
+ return undefined;
29
+ }
30
+ return value;
31
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ * This file is auto-generated by Chargebee.
3
+ * For more information on how to make changes to this file, please see the README.
4
+ * Reach out to dx@chargebee.com for any questions.
5
+ * Copyright 2026 Chargebee Inc.
6
+ */
7
+ /**
8
+ * Per-client gate so the SDK telemetry header is considered at most once per client instance.
9
+ */
10
+ export class SdkTelemetryState {
11
+ constructor() {
12
+ this.emitted = false;
13
+ }
14
+ /**
15
+ * Claims the single emission slot for this client. Returns true only for the first caller.
16
+ */
17
+ tryMarkEmitted() {
18
+ if (this.emitted) {
19
+ return false;
20
+ }
21
+ this.emitted = true;
22
+ return true;
23
+ }
24
+ /** Whether this client has already considered emitting the telemetry header. */
25
+ hasEmitted() {
26
+ return this.emitted;
27
+ }
28
+ /** Clears the emission gate (tests only). */
29
+ clear() {
30
+ this.emitted = false;
31
+ }
32
+ }
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.30.1",
3
+ "version": "3.32.0",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
- "prepack": "npm install && npm run build",
6
+ "prepack": "npm ci && npm run build",
7
7
  "test": "TS_NODE_PROJECT=./tsconfig.test.json mocha -r ts-node/register 'test/**/*.test.ts'",
8
8
  "build": "npm run build-esm && npm run build-cjs",
9
9
  "build-esm": "rm -rf esm && mkdir -p esm && tsc -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > esm/package.json",
10
10
  "build-cjs": "rm -rf cjs && mkdir -p cjs && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > cjs/package.json",
11
- "prettier": "prettier --write \"src/**/*.ts\" \"types/**/*.d.ts\""
11
+ "format": "biome format --write",
12
+ "format:check": "biome format"
12
13
  },
13
14
  "types": "./types/index.d.ts",
14
15
  "keywords": [
@@ -76,22 +77,17 @@
76
77
  }
77
78
  },
78
79
  "devDependencies": {
80
+ "@biomejs/biome": "^2.5.7",
79
81
  "@opentelemetry/api": "^1.9.0",
80
82
  "@types/chai": "^4.3.5",
81
83
  "@types/mocha": "^10.0.10",
82
84
  "@types/node": "20.12.0",
83
85
  "chai": "^4.3.7",
84
86
  "mocha": "^10.2.0",
85
- "prettier": "^3.3.3",
86
87
  "ts-node": "^10.9.1",
87
88
  "typescript": "^5.5.4",
88
89
  "undici-types": "^7.16.0"
89
90
  },
90
- "prettier": {
91
- "semi": true,
92
- "singleQuote": true,
93
- "parser": "typescript"
94
- },
95
91
  "dependencies": {
96
92
  "zod": "^4.3.6"
97
93
  }
package/types/core.d.ts CHANGED
@@ -67,7 +67,11 @@ declare module 'chargebee' {
67
67
  | 'end_of_contract_term'
68
68
  | 'specific_date'
69
69
  | 'end_of_subscription_billing_term';
70
- type CreditOptionForCurrentTermChargesEnum = 'none' | 'prorate' | 'full';
70
+ type CreditOptionForCurrentTermChargesEnum =
71
+ | 'none'
72
+ | 'prorate'
73
+ | 'full'
74
+ | 'consumption_based';
71
75
  type CreditTypeEnum = 'loyalty_credits' | 'referral_rewards' | 'general';
72
76
  type CustomerTypeEnum =
73
77
  | 'residential'
@@ -128,7 +132,6 @@ declare module 'chargebee' {
128
132
  | 'plan_price'
129
133
  | 'addon_price'
130
134
  | 'charge_price'
131
- | 'charge'
132
135
  | 'invoice'
133
136
  | 'quote'
134
137
  | 'credit_note'
@@ -160,7 +163,8 @@ declare module 'chargebee' {
160
163
  | 'usage_file'
161
164
  | 'business_rule'
162
165
  | 'ruleset'
163
- | 'alert_status';
166
+ | 'alert_status'
167
+ | 'omnichannel_subscription_item_metric';
164
168
  type EventNameEnum = 'cancellation_page_loaded';
165
169
  type EventTypeEnum =
166
170
  | 'coupon_created'
@@ -377,10 +381,14 @@ declare module 'chargebee' {
377
381
  | 'alert_status_changed'
378
382
  | 'omnichannel_subscription_item_updated'
379
383
  | 'omnichannel_subscription_item_recovered'
384
+ | 'omnichannel_subscription_item_mrr_updated'
380
385
  | 'ledger_account_balance_updated'
381
386
  | 'grant_blocks_created'
382
387
  | 'grant_blocks_updated'
383
388
  | 'ledger_updated'
389
+ | 'vault_token_created'
390
+ | 'vault_token_updated'
391
+ | 'vault_token_deleted'
384
392
  | 'plan_created'
385
393
  | 'plan_updated'
386
394
  | 'plan_deleted'
@@ -453,10 +461,73 @@ declare module 'chargebee' {
453
461
  | 'payway'
454
462
  | 'gocardless'
455
463
  | 'not_applicable';
464
+ type GatewayNameEnum =
465
+ | 'chargebee'
466
+ | 'chargebee_payments'
467
+ | 'adyen'
468
+ | 'stripe'
469
+ | 'wepay'
470
+ | 'braintree'
471
+ | 'authorize_net'
472
+ | 'paypal_pro'
473
+ | 'pin'
474
+ | 'eway'
475
+ | 'eway_rapid'
476
+ | 'worldpay'
477
+ | 'balanced_payments'
478
+ | 'beanstream'
479
+ | 'bluepay'
480
+ | 'elavon'
481
+ | 'first_data_global'
482
+ | 'hdfc'
483
+ | 'migs'
484
+ | 'nmi'
485
+ | 'ogone'
486
+ | 'paymill'
487
+ | 'paypal_payflow_pro'
488
+ | 'sage_pay'
489
+ | 'tco'
490
+ | 'wirecard'
491
+ | 'amazon_payments'
492
+ | 'paypal_express_checkout'
493
+ | 'gocardless'
494
+ | 'orbital'
495
+ | 'moneris_us'
496
+ | 'moneris'
497
+ | 'bluesnap'
498
+ | 'cybersource'
499
+ | 'vantiv'
500
+ | 'checkout_com'
501
+ | 'paypal'
502
+ | 'ingenico_direct'
503
+ | 'exact'
504
+ | 'mollie'
505
+ | 'quickbooks'
506
+ | 'razorpay'
507
+ | 'global_payments'
508
+ | 'bank_of_america'
509
+ | 'ecentric'
510
+ | 'metrics_global'
511
+ | 'windcave'
512
+ | 'pay_com'
513
+ | 'ebanx'
514
+ | 'dlocal'
515
+ | 'nuvei'
516
+ | 'solidgate'
517
+ | 'paystack'
518
+ | 'jp_morgan'
519
+ | 'deutsche_bank'
520
+ | 'ezidebit'
521
+ | 'twikey'
522
+ | 'tempus'
523
+ | 'moyasar'
524
+ | 'payway'
525
+ | 'not_applicable';
456
526
  type HierarchyOperationTypeEnum =
457
527
  | 'complete_hierarchy'
458
528
  | 'subordinates'
459
529
  | 'path_to_root';
530
+ type InvoiceActionEnum = 'void' | 'write_off';
460
531
  type InvoiceDunningHandlingEnum = 'continue' | 'stop';
461
532
  type ItemTypeEnum = 'plan' | 'addon' | 'charge';
462
533
  type LayoutEnum = 'in_app' | 'full_page';
@@ -992,10 +1063,14 @@ declare module 'chargebee' {
992
1063
  | 'alert_status_changed'
993
1064
  | 'omnichannel_subscription_item_updated'
994
1065
  | 'omnichannel_subscription_item_recovered'
1066
+ | 'omnichannel_subscription_item_mrr_updated'
995
1067
  | 'ledger_account_balance_updated'
996
1068
  | 'grant_blocks_created'
997
1069
  | 'grant_blocks_updated'
998
1070
  | 'ledger_updated'
1071
+ | 'vault_token_created'
1072
+ | 'vault_token_updated'
1073
+ | 'vault_token_deleted'
999
1074
  | 'plan_created'
1000
1075
  | 'plan_updated'
1001
1076
  | 'plan_deleted'
package/types/index.d.ts CHANGED
@@ -39,6 +39,7 @@
39
39
  ///<reference path='./resources/Feature.d.ts' />
40
40
  ///<reference path='./resources/FilterCondition.d.ts' />
41
41
  ///<reference path='./resources/GatewayErrorDetail.d.ts' />
42
+ ///<reference path='./resources/GatewayPaymentMethodToken.d.ts' />
42
43
  ///<reference path='./resources/Gift.d.ts' />
43
44
  ///<reference path='./resources/GrantBlock.d.ts' />
44
45
  ///<reference path='./resources/Hierarchy.d.ts' />
@@ -67,6 +68,7 @@
67
68
  ///<reference path='./resources/OmnichannelOneTimeOrderItem.d.ts' />
68
69
  ///<reference path='./resources/OmnichannelSubscription.d.ts' />
69
70
  ///<reference path='./resources/OmnichannelSubscriptionItem.d.ts' />
71
+ ///<reference path='./resources/OmnichannelSubscriptionItemMetric.d.ts' />
70
72
  ///<reference path='./resources/OmnichannelSubscriptionItemOffer.d.ts' />
71
73
  ///<reference path='./resources/OmnichannelSubscriptionItemScheduledChange.d.ts' />
72
74
  ///<reference path='./resources/OmnichannelTransaction.d.ts' />
@@ -87,6 +89,7 @@
87
89
  ///<reference path='./resources/PromotionalGrant.d.ts' />
88
90
  ///<reference path='./resources/Purchase.d.ts' />
89
91
  ///<reference path='./resources/Quote.d.ts' />
92
+ ///<reference path='./resources/QuoteEntitlement.d.ts' />
90
93
  ///<reference path='./resources/QuoteLineGroup.d.ts' />
91
94
  ///<reference path='./resources/QuotedCharge.d.ts' />
92
95
  ///<reference path='./resources/QuotedDeltaRamp.d.ts' />
@@ -113,6 +116,7 @@
113
116
  ///<reference path='./resources/UsageEvent.d.ts' />
114
117
  ///<reference path='./resources/UsageFile.d.ts' />
115
118
  ///<reference path='./resources/UsageSummary.d.ts' />
119
+ ///<reference path='./resources/VaultedPaymentMethod.d.ts' />
116
120
  ///<reference path='./resources/VirtualBankAccount.d.ts' />
117
121
  ///<reference path='./resources/WebhookEndpoint.d.ts' />
118
122
  ///<reference path='./resources/Content.d.ts' />
@@ -185,14 +189,17 @@ declare module 'chargebee' {
185
189
  * @telemetryAdapter optional telemetry adapter for observability (e.g. OpenTelemetry)
186
190
  */
187
191
  telemetryAdapter?: TelemetryAdapter;
192
+
193
+ /**
194
+ * @sdkTelemetryEnabled when false, the SDK does not send the anonymous x-chargebee-sdk-telemetry header. Default true.
195
+ */
196
+ sdkTelemetryEnabled?: boolean;
188
197
  };
189
198
 
190
199
  export interface HttpClientInterface {
191
200
  makeApiRequest: (request: Request, timeout: number) => Promise<Response>;
192
201
  }
193
202
 
194
- export type RequestTelemetryHandle = unknown;
195
-
196
203
  export const TelemetryAttributeKeys: {
197
204
  readonly URL_FULL: 'url.full';
198
205
  readonly HTTP_REQUEST_METHOD: 'http.request.method';
@@ -210,6 +217,10 @@ declare module 'chargebee' {
210
217
  readonly CHARGEBEE_ERROR_PARAM: 'chargebee.error.param';
211
218
  };
212
219
 
220
+ export const SDK_TELEMETRY_HEADER_NAME: 'x-chargebee-sdk-telemetry';
221
+
222
+ export type RequestTelemetryHandle = unknown;
223
+
213
224
  export type RequestTelemetryContext = {
214
225
  spanName: string;
215
226
  resource: string;
@@ -324,6 +335,7 @@ declare module 'chargebee' {
324
335
  promotionalGrant: PromotionalGrant.PromotionalGrantResource;
325
336
  purchase: Purchase.PurchaseResource;
326
337
  quote: Quote.QuoteResource;
338
+ quoteEntitlement: QuoteEntitlement.QuoteEntitlementResource;
327
339
  ramp: Ramp.RampResource;
328
340
  recordedPurchase: RecordedPurchase.RecordedPurchaseResource;
329
341
  resourceMigration: ResourceMigration.ResourceMigrationResource;
@@ -339,6 +351,7 @@ declare module 'chargebee' {
339
351
  usageEvent: UsageEvent.UsageEventResource;
340
352
  usageFile: UsageFile.UsageFileResource;
341
353
  usageSummary: UsageSummary.UsageSummaryResource;
354
+ vaultedPaymentMethod: VaultedPaymentMethod.VaultedPaymentMethodResource;
342
355
  virtualBankAccount: VirtualBankAccount.VirtualBankAccountResource;
343
356
  webhookEndpoint: WebhookEndpoint.WebhookEndpointResource;
344
357