chargebee 3.16.0 → 3.17.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### v3.17.0-beta.1 (2025-12-10)
2
+
3
+ ### Enhancements
4
+ * add webhook event handler to process chargebee-events.
5
+ * deprecated `WebhookContentType` class, added `WebhookEventType` class.
6
+
1
7
  ### v3.16.0 (2025-12-01)
2
8
  * * *
3
9
 
package/README.md CHANGED
@@ -148,6 +148,174 @@ const chargebeeSiteEU = new Chargebee({
148
148
  });
149
149
  ```
150
150
 
151
+ ### Handle webhooks
152
+
153
+ Use the webhook handlers to parse and route webhook payloads from Chargebee with full TypeScript support.
154
+
155
+ #### Quick Start: Using the default `webhook` instance
156
+
157
+ The simplest way to handle webhooks is using the pre-configured `webhook` instance:
158
+
159
+ ```typescript
160
+ import express from 'express';
161
+ import { webhook, type WebhookEvent } from 'chargebee';
162
+
163
+ const app = express();
164
+ app.use(express.json());
165
+
166
+ webhook.on('subscription_created', async (event: WebhookEvent) => {
167
+ console.log(`Subscription created: ${event.id}`);
168
+ const subscription = event.content.subscription;
169
+ console.log(`Customer: ${subscription.customer_id}`);
170
+ });
171
+
172
+ webhook.on('error', (err: Error) => {
173
+ console.error('Webhook error:', err.message);
174
+ });
175
+
176
+ app.post('/chargebee/webhooks', (req, res) => {
177
+ webhook.handle(req.body, req.headers);
178
+ res.status(200).send('OK');
179
+ });
180
+
181
+ app.listen(8080);
182
+ ```
183
+
184
+ **Auto-configured Basic Auth:** The default `webhook` instance automatically configures Basic Auth validation if the following environment variables are set:
185
+
186
+ - `CHARGEBEE_WEBHOOK_USERNAME` - The expected username
187
+ - `CHARGEBEE_WEBHOOK_PASSWORD` - The expected password
188
+
189
+ When both are present, incoming webhook requests will be validated against these credentials. If not set, no authentication is applied.
190
+
191
+ #### Creating custom `WebhookHandler` instances
192
+
193
+ For more control or multiple webhook endpoints, create your own instances:
194
+
195
+ ```typescript
196
+ import express from 'express';
197
+ import { WebhookHandler, basicAuthValidator } from 'chargebee';
198
+
199
+ const app = express();
200
+ app.use(express.json());
201
+
202
+ const handler = new WebhookHandler();
203
+
204
+ // Register event listeners using .on() - events are fully typed
205
+ handler.on('subscription_created', async (event) => {
206
+ console.log(`Subscription created: ${event.id}`);
207
+ const subscription = event.content.subscription;
208
+ console.log(`Customer: ${subscription.customer_id}`);
209
+ console.log(`Plan: ${subscription.plan_id}`);
210
+ });
211
+
212
+ handler.on('payment_succeeded', async (event) => {
213
+ console.log(`Payment succeeded: ${event.id}`);
214
+ const transaction = event.content.transaction;
215
+ const customer = event.content.customer;
216
+ console.log(`Amount: ${transaction.amount}, Customer: ${customer.email}`);
217
+ });
218
+
219
+ // Optional: Add request validator (e.g., Basic Auth)
220
+ handler.requestValidator = basicAuthValidator((username, password) => {
221
+ return username === 'admin' && password === 'secret';
222
+ });
223
+
224
+ app.post('/chargebee/webhooks', (req, res) => {
225
+ handler.handle(req.body, req.headers);
226
+ res.status(200).send('OK');
227
+ });
228
+
229
+ app.listen(8080);
230
+ ```
231
+
232
+ #### Low-level: Parse and handle events manually
233
+
234
+ For more control, you can parse webhook events manually:
235
+
236
+ ```typescript
237
+ import express from 'express';
238
+ import Chargebee, { type WebhookEvent } from 'chargebee';
239
+
240
+ const app = express();
241
+ app.use(express.json());
242
+
243
+ app.post('/chargebee/webhooks', async (req, res) => {
244
+ try {
245
+ const event = req.body as WebhookEvent;
246
+
247
+ switch (event.event_type) {
248
+ case 'subscription_created':
249
+ // Access event content with proper typing
250
+ const subscription = event.content.subscription;
251
+ console.log('Subscription created:', subscription.id);
252
+ break;
253
+
254
+ case 'payment_succeeded':
255
+ const transaction = event.content.transaction;
256
+ console.log('Payment succeeded:', transaction.amount);
257
+ break;
258
+
259
+ default:
260
+ console.log('Unhandled event type:', event.event_type);
261
+ }
262
+
263
+ res.status(200).send('OK');
264
+ } catch (err) {
265
+ console.error('Error processing webhook:', err);
266
+ res.status(500).send('Error processing webhook');
267
+ }
268
+ });
269
+
270
+ app.listen(8080);
271
+ ```
272
+
273
+ #### Handling Unhandled Events
274
+
275
+ By default, if an incoming webhook event type is not recognized or you haven't registered a corresponding callback handler, the SDK provides flexible options to handle these scenarios:
276
+
277
+ **Using the `unhandled_event` listener:**
278
+
279
+ ```typescript
280
+ import { WebhookHandler } from 'chargebee';
281
+
282
+ const handler = new WebhookHandler();
283
+
284
+ handler.on('subscription_created', async (event) => {
285
+ // Handle subscription created
286
+ });
287
+
288
+ // Gracefully handle events without registered listeners
289
+ handler.on('unhandled_event', async (event) => {
290
+ console.log(`Received unhandled event: ${event.event_type}`);
291
+ // Log for monitoring or store for later processing
292
+ });
293
+ ```
294
+
295
+ **Using the `error` listener for error handling:**
296
+
297
+ If an error occurs during webhook processing (e.g., invalid JSON, validator failure), the SDK will emit an `error` event:
298
+
299
+ ```typescript
300
+ const handler = new WebhookHandler();
301
+
302
+ handler.on('subscription_created', async (event) => {
303
+ // Handle subscription created
304
+ });
305
+
306
+ // Catch any errors during webhook processing
307
+ handler.on('error', (err) => {
308
+ console.error('Webhook processing error:', err);
309
+ // Log to monitoring service, alert team, etc.
310
+ });
311
+ ```
312
+
313
+ **Best Practices:**
314
+
315
+ - Use `unhandled_event` listener to acknowledge unknown events (return 200 OK) and log them
316
+ - Use `error` listener to catch and handle exceptions thrown during event processing
317
+ - Both listeners help ensure your webhook endpoint remains stable even when new event types are introduced by Chargebee
318
+
151
319
  ### Processing Webhooks - API Version Check
152
320
 
153
321
  An attribute `api_version` is added to the [Event](https://apidocs.chargebee.com/docs/api/events) resource, which indicates the API version based on which the event content is structured. In your webhook servers, ensure this `api_version` is the same as the [API version](https://apidocs.chargebee.com/docs/api#versions) used by your webhook server's client library.
@@ -2,8 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const createChargebee_js_1 = require("./createChargebee.js");
4
4
  const FetchClient_js_1 = require("./net/FetchClient.js");
5
+ const handler_js_1 = require("./resources/webhook/handler.js");
6
+ const handler_js_2 = require("./resources/webhook/handler.js");
7
+ const auth_js_1 = require("./resources/webhook/auth.js");
5
8
  const httpClient = new FetchClient_js_1.FetchHttpClient();
6
9
  const Chargebee = (0, createChargebee_js_1.CreateChargebee)(httpClient);
7
10
  module.exports = Chargebee;
8
11
  module.exports.Chargebee = Chargebee;
9
12
  module.exports.default = Chargebee;
13
+ // Export webhook modules
14
+ module.exports.WebhookHandler = handler_js_1.WebhookHandler;
15
+ module.exports.webhook = handler_js_2.default;
16
+ module.exports.basicAuthValidator = auth_js_1.basicAuthValidator;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.basicAuthValidator = void 0;
4
+ const basicAuthValidator = (validateCredentials) => {
5
+ return (headers) => {
6
+ const authHeader = headers['authorization'] || headers['Authorization'];
7
+ if (!authHeader) {
8
+ throw new Error('Invalid authorization header');
9
+ }
10
+ const authStr = Array.isArray(authHeader) ? authHeader[0] : authHeader;
11
+ if (!authStr) {
12
+ throw new Error('Invalid authorization header');
13
+ }
14
+ const parts = authStr.split(' ');
15
+ if (parts.length !== 2 || parts[0] !== 'Basic') {
16
+ throw new Error('Invalid authorization header');
17
+ }
18
+ const credentials = Buffer.from(parts[1], 'base64').toString().split(':');
19
+ if (credentials.length !== 2) {
20
+ throw new Error('Invalid credentials');
21
+ }
22
+ if (!validateCredentials(credentials[0], credentials[1])) {
23
+ throw new Error('Invalid credentials');
24
+ }
25
+ };
26
+ };
27
+ exports.basicAuthValidator = basicAuthValidator;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ ///<reference path='../../../types/index.d.ts'/>
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebhookHandler = void 0;
4
+ const node_events_1 = require("node:events");
5
+ const auth_js_1 = require("./auth.js");
6
+ class WebhookHandler extends node_events_1.EventEmitter {
7
+ constructor() {
8
+ super({ captureRejections: true });
9
+ }
10
+ handle(body, headers) {
11
+ try {
12
+ if (this.requestValidator && headers) {
13
+ this.requestValidator(headers);
14
+ }
15
+ const event = typeof body === 'string' ? JSON.parse(body) : body;
16
+ const eventType = event.event_type;
17
+ if (this.listenerCount(eventType) > 0) {
18
+ this.emit(eventType, event);
19
+ }
20
+ else {
21
+ this.emit('unhandled_event', event);
22
+ }
23
+ }
24
+ catch (err) {
25
+ this.emit('error', err instanceof Error ? err : new Error(String(err)));
26
+ }
27
+ }
28
+ }
29
+ exports.WebhookHandler = WebhookHandler;
30
+ const webhook = new WebhookHandler();
31
+ // Auto-configure basic auth if env vars are present
32
+ const username = process.env.CHARGEBEE_WEBHOOK_USERNAME;
33
+ const password = process.env.CHARGEBEE_WEBHOOK_PASSWORD;
34
+ if (username && password) {
35
+ webhook.requestValidator = (0, auth_js_1.basicAuthValidator)((u, p) => u === username && p === password);
36
+ }
37
+ exports.default = webhook;
@@ -3,3 +3,7 @@ import { FetchHttpClient } from './net/FetchClient.js';
3
3
  const httpClient = new FetchHttpClient();
4
4
  const Chargebee = CreateChargebee(httpClient);
5
5
  export default Chargebee;
6
+ // Export webhook modules
7
+ export { WebhookHandler } from './resources/webhook/handler.js';
8
+ export { default as webhook } from './resources/webhook/handler.js';
9
+ export { basicAuthValidator } from './resources/webhook/auth.js';
@@ -0,0 +1,23 @@
1
+ export const basicAuthValidator = (validateCredentials) => {
2
+ return (headers) => {
3
+ const authHeader = headers['authorization'] || headers['Authorization'];
4
+ if (!authHeader) {
5
+ throw new Error('Invalid authorization header');
6
+ }
7
+ const authStr = Array.isArray(authHeader) ? authHeader[0] : authHeader;
8
+ if (!authStr) {
9
+ throw new Error('Invalid authorization header');
10
+ }
11
+ const parts = authStr.split(' ');
12
+ if (parts.length !== 2 || parts[0] !== 'Basic') {
13
+ throw new Error('Invalid authorization header');
14
+ }
15
+ const credentials = Buffer.from(parts[1], 'base64').toString().split(':');
16
+ if (credentials.length !== 2) {
17
+ throw new Error('Invalid credentials');
18
+ }
19
+ if (!validateCredentials(credentials[0], credentials[1])) {
20
+ throw new Error('Invalid credentials');
21
+ }
22
+ };
23
+ };
@@ -0,0 +1,2 @@
1
+ ///<reference path='../../../types/index.d.ts'/>
2
+ export {};
@@ -0,0 +1,33 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import { basicAuthValidator } from './auth.js';
3
+ export class WebhookHandler extends EventEmitter {
4
+ constructor() {
5
+ super({ captureRejections: true });
6
+ }
7
+ handle(body, headers) {
8
+ try {
9
+ if (this.requestValidator && headers) {
10
+ this.requestValidator(headers);
11
+ }
12
+ const event = typeof body === 'string' ? JSON.parse(body) : body;
13
+ const eventType = event.event_type;
14
+ if (this.listenerCount(eventType) > 0) {
15
+ this.emit(eventType, event);
16
+ }
17
+ else {
18
+ this.emit('unhandled_event', event);
19
+ }
20
+ }
21
+ catch (err) {
22
+ this.emit('error', err instanceof Error ? err : new Error(String(err)));
23
+ }
24
+ }
25
+ }
26
+ const webhook = new WebhookHandler();
27
+ // Auto-configure basic auth if env vars are present
28
+ const username = process.env.CHARGEBEE_WEBHOOK_USERNAME;
29
+ const password = process.env.CHARGEBEE_WEBHOOK_PASSWORD;
30
+ if (username && password) {
31
+ webhook.requestValidator = basicAuthValidator((u, p) => u === username && p === password);
32
+ }
33
+ export default webhook;
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.16.0",
3
+ "version": "3.17.0-beta.1",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
6
  "prepack": "npm install && npm run build",
7
+ "test": "mocha -r ts-node/register 'test/**/*.test.ts'",
7
8
  "build": "npm run build-esm && npm run build-cjs",
8
9
  "build-esm": "rm -rf esm && mkdir -p esm && tsc -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > esm/package.json",
9
10
  "build-cjs": "rm -rf cjs && mkdir -p cjs && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > cjs/package.json",
@@ -32,8 +33,6 @@
32
33
  "url": "http://github.com/chargebee/chargebee-node/blob/master/LICENSE"
33
34
  }
34
35
  ],
35
- "dependencies": {
36
- },
37
36
  "exports": {
38
37
  "types": "./types/index.d.ts",
39
38
  "browser": {
@@ -62,13 +61,19 @@
62
61
  }
63
62
  },
64
63
  "devDependencies": {
65
- "@types/node": "20.0.0",
64
+ "@types/chai": "^4.3.5",
65
+ "@types/mocha": "^10.0.10",
66
+ "@types/node": "20.12.0",
67
+ "chai": "^4.3.7",
68
+ "mocha": "^10.2.0",
66
69
  "prettier": "^3.3.3",
67
- "typescript": "^5.5.4"
70
+ "ts-node": "^10.9.1",
71
+ "typescript": "^5.5.4",
72
+ "undici-types": "^7.16.0"
68
73
  },
69
74
  "prettier": {
70
75
  "semi": true,
71
76
  "singleQuote": true,
72
77
  "parser": "typescript"
73
78
  }
74
- }
79
+ }
package/types/index.d.ts CHANGED
@@ -250,4 +250,69 @@ declare module 'chargebee' {
250
250
  virtualBankAccount: VirtualBankAccount.VirtualBankAccountResource;
251
251
  webhookEndpoint: WebhookEndpoint.WebhookEndpointResource;
252
252
  }
253
+
254
+ // Webhook Handler
255
+ export type WebhookEventName = EventTypeEnum | 'unhandled_event';
256
+ export type WebhookEventTypeValue = `${WebhookEventType}`;
257
+ /** @deprecated Use WebhookEventTypeValue instead */
258
+ export type WebhookContentTypeValue = WebhookEventTypeValue;
259
+
260
+ export type WebhookEventListener<
261
+ T extends WebhookEventType = WebhookEventType,
262
+ > = (event: WebhookEvent<T>) => Promise<void> | void;
263
+ export type WebhookErrorListener = (error: Error) => Promise<void> | void;
264
+
265
+ // Helper type to map string literal to enum member
266
+ type StringToWebhookEventType<S extends WebhookEventTypeValue> = {
267
+ [K in WebhookEventType]: `${K}` extends S ? K : never;
268
+ }[WebhookEventType];
269
+
270
+ export class WebhookHandler {
271
+ on<T extends WebhookEventType>(
272
+ eventName: T,
273
+ listener: WebhookEventListener<T>,
274
+ ): this;
275
+ on<S extends WebhookEventTypeValue>(
276
+ eventName: S,
277
+ listener: WebhookEventListener<StringToWebhookEventType<S>>,
278
+ ): this;
279
+ on(eventName: 'unhandled_event', listener: WebhookEventListener): this;
280
+ on(eventName: 'error', listener: WebhookErrorListener): this;
281
+ once<T extends WebhookEventType>(
282
+ eventName: T,
283
+ listener: WebhookEventListener<T>,
284
+ ): this;
285
+ once<S extends WebhookEventTypeValue>(
286
+ eventName: S,
287
+ listener: WebhookEventListener<StringToWebhookEventType<S>>,
288
+ ): this;
289
+ once(eventName: 'unhandled_event', listener: WebhookEventListener): this;
290
+ once(eventName: 'error', listener: WebhookErrorListener): this;
291
+ off<T extends WebhookEventType>(
292
+ eventName: T,
293
+ listener: WebhookEventListener<T>,
294
+ ): this;
295
+ off<S extends WebhookEventTypeValue>(
296
+ eventName: S,
297
+ listener: WebhookEventListener<StringToWebhookEventType<S>>,
298
+ ): this;
299
+ off(eventName: 'unhandled_event', listener: WebhookEventListener): this;
300
+ off(eventName: 'error', listener: WebhookErrorListener): this;
301
+ handle(
302
+ body: string | object,
303
+ headers?: Record<string, string | string[] | undefined>,
304
+ ): void;
305
+ onError?: (error: any) => void;
306
+ requestValidator?: (
307
+ headers: Record<string, string | string[] | undefined>,
308
+ ) => void;
309
+ }
310
+
311
+ // Webhook Auth
312
+ export function basicAuthValidator(
313
+ validateCredentials: (username: string, password: string) => boolean,
314
+ ): (headers: Record<string, string | string[] | undefined>) => void;
315
+
316
+ // Default webhook handler instance
317
+ export const webhook: WebhookHandler;
253
318
  }
@@ -3,7 +3,7 @@
3
3
  ///<reference path='./filter.d.ts'/>
4
4
 
5
5
  declare module 'chargebee' {
6
- export enum WebhookContentType {
6
+ export enum WebhookEventType {
7
7
  SubscriptionPauseScheduled = 'subscription_pause_scheduled',
8
8
  CustomerBusinessEntityChanged = 'customer_business_entity_changed',
9
9
  SubscriptionAdvanceInvoiceScheduleAdded = 'subscription_advance_invoice_schedule_added',
@@ -220,230 +220,232 @@ declare module 'chargebee' {
220
220
  PlanCreated = 'plan_created',
221
221
  PlanUpdated = 'plan_updated',
222
222
  }
223
+ /**
224
+ * @deprecated Use WebhookEventType instead.
225
+ */
226
+ export import WebhookContentType = WebhookEventType;
223
227
 
224
228
  export type WebhookContentMap = {
225
- [WebhookContentType.SubscriptionPauseScheduled]: SubscriptionPauseScheduledContent;
226
- [WebhookContentType.CustomerBusinessEntityChanged]: CustomerBusinessEntityChangedContent;
227
- [WebhookContentType.SubscriptionAdvanceInvoiceScheduleAdded]: SubscriptionAdvanceInvoiceScheduleAddedContent;
228
- [WebhookContentType.GiftExpired]: GiftExpiredContent;
229
- [WebhookContentType.TaxWithheldDeleted]: TaxWithheldDeletedContent;
230
- [WebhookContentType.UnbilledChargesDeleted]: UnbilledChargesDeletedContent;
231
- [WebhookContentType.CouponUpdated]: CouponUpdatedContent;
232
- [WebhookContentType.OmnichannelSubscriptionItemReactivated]: OmnichannelSubscriptionItemReactivatedContent;
233
- [WebhookContentType.OmnichannelSubscriptionItemRenewed]: OmnichannelSubscriptionItemRenewedContent;
234
- [WebhookContentType.UnbilledChargesCreated]: UnbilledChargesCreatedContent;
235
- [WebhookContentType.SubscriptionResumed]: SubscriptionResumedContent;
236
- [WebhookContentType.OmnichannelOneTimeOrderItemCancelled]: OmnichannelOneTimeOrderItemCancelledContent;
237
- [WebhookContentType.SubscriptionCancelled]: SubscriptionCancelledContent;
238
- [WebhookContentType.ItemEntitlementsRemoved]: ItemEntitlementsRemovedContent;
239
- [WebhookContentType.BusinessEntityCreated]: BusinessEntityCreatedContent;
240
- [WebhookContentType.CouponSetUpdated]: CouponSetUpdatedContent;
241
- [WebhookContentType.DifferentialPriceUpdated]: DifferentialPriceUpdatedContent;
242
- [WebhookContentType.OmnichannelSubscriptionItemPaused]: OmnichannelSubscriptionItemPausedContent;
243
- [WebhookContentType.EntitlementOverridesRemoved]: EntitlementOverridesRemovedContent;
244
- [WebhookContentType.SubscriptionActivatedWithBackdating]: SubscriptionActivatedWithBackdatingContent;
245
- [WebhookContentType.SubscriptionTrialEndReminder]: SubscriptionTrialEndReminderContent;
246
- [WebhookContentType.SubscriptionShippingAddressUpdated]: SubscriptionShippingAddressUpdatedContent;
247
- [WebhookContentType.VoucherCreateFailed]: VoucherCreateFailedContent;
248
- [WebhookContentType.GiftClaimed]: GiftClaimedContent;
249
- [WebhookContentType.CustomerDeleted]: CustomerDeletedContent;
250
- [WebhookContentType.RefundInitiated]: RefundInitiatedContent;
251
- [WebhookContentType.InvoiceGeneratedWithBackdating]: InvoiceGeneratedWithBackdatingContent;
252
- [WebhookContentType.OmnichannelTransactionCreated]: OmnichannelTransactionCreatedContent;
253
- [WebhookContentType.AddUsagesReminder]: AddUsagesReminderContent;
254
- [WebhookContentType.VoucherCreated]: VoucherCreatedContent;
255
- [WebhookContentType.RuleUpdated]: RuleUpdatedContent;
256
- [WebhookContentType.PaymentSchedulesCreated]: PaymentSchedulesCreatedContent;
257
- [WebhookContentType.FeatureActivated]: FeatureActivatedContent;
258
- [WebhookContentType.PaymentSourceLocallyDeleted]: PaymentSourceLocallyDeletedContent;
259
- [WebhookContentType.InvoiceGenerated]: InvoiceGeneratedContent;
260
- [WebhookContentType.VoucherExpired]: VoucherExpiredContent;
261
- [WebhookContentType.AuthorizationSucceeded]: AuthorizationSucceededContent;
262
- [WebhookContentType.GiftScheduled]: GiftScheduledContent;
263
- [WebhookContentType.SubscriptionChangesScheduled]: SubscriptionChangesScheduledContent;
264
- [WebhookContentType.SubscriptionChangedWithBackdating]: SubscriptionChangedWithBackdatingContent;
265
- [WebhookContentType.OmnichannelSubscriptionItemChanged]: OmnichannelSubscriptionItemChangedContent;
266
- [WebhookContentType.GiftUnclaimed]: GiftUnclaimedContent;
267
- [WebhookContentType.VirtualBankAccountAdded]: VirtualBankAccountAddedContent;
268
- [WebhookContentType.PaymentIntentCreated]: PaymentIntentCreatedContent;
269
- [WebhookContentType.CreditNoteCreatedWithBackdating]: CreditNoteCreatedWithBackdatingContent;
270
- [WebhookContentType.ContractTermTerminated]: ContractTermTerminatedContent;
271
- [WebhookContentType.ItemFamilyUpdated]: ItemFamilyUpdatedContent;
272
- [WebhookContentType.OrderCreated]: OrderCreatedContent;
273
- [WebhookContentType.PriceVariantDeleted]: PriceVariantDeletedContent;
274
- [WebhookContentType.SubscriptionMovementFailed]: SubscriptionMovementFailedContent;
275
- [WebhookContentType.CustomerMovedIn]: CustomerMovedInContent;
276
- [WebhookContentType.SubscriptionAdvanceInvoiceScheduleUpdated]: SubscriptionAdvanceInvoiceScheduleUpdatedContent;
277
- [WebhookContentType.ItemDeleted]: ItemDeletedContent;
278
- [WebhookContentType.SubscriptionRampDrafted]: SubscriptionRampDraftedContent;
279
- [WebhookContentType.DunningUpdated]: DunningUpdatedContent;
280
- [WebhookContentType.ItemEntitlementsUpdated]: ItemEntitlementsUpdatedContent;
281
- [WebhookContentType.TokenConsumed]: TokenConsumedContent;
282
- [WebhookContentType.HierarchyDeleted]: HierarchyDeletedContent;
283
- [WebhookContentType.SubscriptionCancellationScheduled]: SubscriptionCancellationScheduledContent;
284
- [WebhookContentType.SubscriptionRenewed]: SubscriptionRenewedContent;
285
- [WebhookContentType.FeatureUpdated]: FeatureUpdatedContent;
286
- [WebhookContentType.FeatureDeleted]: FeatureDeletedContent;
287
- [WebhookContentType.ItemFamilyCreated]: ItemFamilyCreatedContent;
288
- [WebhookContentType.OmnichannelSubscriptionItemScheduledChangeRemoved]: OmnichannelSubscriptionItemScheduledChangeRemovedContent;
289
- [WebhookContentType.OmnichannelSubscriptionItemResumed]: OmnichannelSubscriptionItemResumedContent;
290
- [WebhookContentType.PurchaseCreated]: PurchaseCreatedContent;
291
- [WebhookContentType.EntitlementOverridesUpdated]: EntitlementOverridesUpdatedContent;
292
- [WebhookContentType.ItemFamilyDeleted]: ItemFamilyDeletedContent;
293
- [WebhookContentType.SubscriptionResumptionScheduled]: SubscriptionResumptionScheduledContent;
294
- [WebhookContentType.FeatureReactivated]: FeatureReactivatedContent;
295
- [WebhookContentType.CouponCodesDeleted]: CouponCodesDeletedContent;
296
- [WebhookContentType.CardExpired]: CardExpiredContent;
297
- [WebhookContentType.CreditNoteUpdated]: CreditNoteUpdatedContent;
298
- [WebhookContentType.OmnichannelSubscriptionItemDowngraded]: OmnichannelSubscriptionItemDowngradedContent;
299
- [WebhookContentType.PriceVariantUpdated]: PriceVariantUpdatedContent;
300
- [WebhookContentType.PromotionalCreditsDeducted]: PromotionalCreditsDeductedContent;
301
- [WebhookContentType.SubscriptionRampApplied]: SubscriptionRampAppliedContent;
302
- [WebhookContentType.SubscriptionPaused]: SubscriptionPausedContent;
303
- [WebhookContentType.OrderReadyToProcess]: OrderReadyToProcessContent;
304
- [WebhookContentType.FeatureCreated]: FeatureCreatedContent;
305
- [WebhookContentType.TransactionDeleted]: TransactionDeletedContent;
306
- [WebhookContentType.CreditNoteCreated]: CreditNoteCreatedContent;
307
- [WebhookContentType.OmnichannelSubscriptionItemResubscribed]: OmnichannelSubscriptionItemResubscribedContent;
308
- [WebhookContentType.RecordPurchaseFailed]: RecordPurchaseFailedContent;
309
- [WebhookContentType.ItemCreated]: ItemCreatedContent;
310
- [WebhookContentType.TransactionUpdated]: TransactionUpdatedContent;
311
- [WebhookContentType.MrrUpdated]: MrrUpdatedContent;
312
- [WebhookContentType.UnbilledChargesInvoiced]: UnbilledChargesInvoicedContent;
313
- [WebhookContentType.ItemPriceUpdated]: ItemPriceUpdatedContent;
314
- [WebhookContentType.CouponCodesUpdated]: CouponCodesUpdatedContent;
315
- [WebhookContentType.VirtualBankAccountUpdated]: VirtualBankAccountUpdatedContent;
316
- [WebhookContentType.ContractTermCreated]: ContractTermCreatedContent;
317
- [WebhookContentType.SubscriptionChanged]: SubscriptionChangedContent;
318
- [WebhookContentType.PaymentFailed]: PaymentFailedContent;
319
- [WebhookContentType.CreditNoteDeleted]: CreditNoteDeletedContent;
320
- [WebhookContentType.TaxWithheldRefunded]: TaxWithheldRefundedContent;
321
- [WebhookContentType.ContractTermCompleted]: ContractTermCompletedContent;
322
- [WebhookContentType.PaymentSchedulesUpdated]: PaymentSchedulesUpdatedContent;
323
- [WebhookContentType.OmnichannelSubscriptionItemExpired]: OmnichannelSubscriptionItemExpiredContent;
324
- [WebhookContentType.CardUpdated]: CardUpdatedContent;
325
- [WebhookContentType.CustomerCreated]: CustomerCreatedContent;
326
- [WebhookContentType.SubscriptionRenewalReminder]: SubscriptionRenewalReminderContent;
327
- [WebhookContentType.OrderDelivered]: OrderDeliveredContent;
328
- [WebhookContentType.OmnichannelSubscriptionItemCancellationScheduled]: OmnichannelSubscriptionItemCancellationScheduledContent;
329
- [WebhookContentType.OmnichannelSubscriptionItemGracePeriodExpired]: OmnichannelSubscriptionItemGracePeriodExpiredContent;
330
- [WebhookContentType.CouponCodesAdded]: CouponCodesAddedContent;
331
- [WebhookContentType.GiftCancelled]: GiftCancelledContent;
332
- [WebhookContentType.OrderCancelled]: OrderCancelledContent;
333
- [WebhookContentType.CouponDeleted]: CouponDeletedContent;
334
- [WebhookContentType.SubscriptionScheduledChangesRemoved]: SubscriptionScheduledChangesRemovedContent;
335
- [WebhookContentType.PendingInvoiceCreated]: PendingInvoiceCreatedContent;
336
- [WebhookContentType.EntitlementOverridesAutoRemoved]: EntitlementOverridesAutoRemovedContent;
337
- [WebhookContentType.OmnichannelSubscriptionItemUpgraded]: OmnichannelSubscriptionItemUpgradedContent;
338
- [WebhookContentType.SubscriptionBusinessEntityChanged]: SubscriptionBusinessEntityChangedContent;
339
- [WebhookContentType.OmnichannelOneTimeOrderCreated]: OmnichannelOneTimeOrderCreatedContent;
340
- [WebhookContentType.PaymentSourceDeleted]: PaymentSourceDeletedContent;
341
- [WebhookContentType.OmnichannelSubscriptionItemCancelled]: OmnichannelSubscriptionItemCancelledContent;
342
- [WebhookContentType.QuoteDeleted]: QuoteDeletedContent;
343
- [WebhookContentType.InvoiceUpdated]: InvoiceUpdatedContent;
344
- [WebhookContentType.SubscriptionAdvanceInvoiceScheduleRemoved]: SubscriptionAdvanceInvoiceScheduleRemovedContent;
345
- [WebhookContentType.CardDeleted]: CardDeletedContent;
346
- [WebhookContentType.OrderReadyToShip]: OrderReadyToShipContent;
347
- [WebhookContentType.SubscriptionMovedOut]: SubscriptionMovedOutContent;
348
- [WebhookContentType.PaymentScheduleSchemeCreated]: PaymentScheduleSchemeCreatedContent;
349
- [WebhookContentType.BusinessEntityUpdated]: BusinessEntityUpdatedContent;
350
- [WebhookContentType.SubscriptionScheduledResumptionRemoved]: SubscriptionScheduledResumptionRemovedContent;
351
- [WebhookContentType.PaymentInitiated]: PaymentInitiatedContent;
352
- [WebhookContentType.FeatureArchived]: FeatureArchivedContent;
353
- [WebhookContentType.SubscriptionReactivatedWithBackdating]: SubscriptionReactivatedWithBackdatingContent;
354
- [WebhookContentType.OmnichannelSubscriptionImported]: OmnichannelSubscriptionImportedContent;
355
- [WebhookContentType.TokenExpired]: TokenExpiredContent;
356
- [WebhookContentType.CardAdded]: CardAddedContent;
357
- [WebhookContentType.CouponCreated]: CouponCreatedContent;
358
- [WebhookContentType.RuleDeleted]: RuleDeletedContent;
359
- [WebhookContentType.ItemPriceEntitlementsUpdated]: ItemPriceEntitlementsUpdatedContent;
360
- [WebhookContentType.ItemPriceDeleted]: ItemPriceDeletedContent;
361
- [WebhookContentType.VirtualBankAccountDeleted]: VirtualBankAccountDeletedContent;
362
- [WebhookContentType.PaymentScheduleSchemeDeleted]: PaymentScheduleSchemeDeletedContent;
363
- [WebhookContentType.SubscriptionCreated]: SubscriptionCreatedContent;
364
- [WebhookContentType.SubscriptionEntitlementsCreated]: SubscriptionEntitlementsCreatedContent;
365
- [WebhookContentType.OrderReturned]: OrderReturnedContent;
366
- [WebhookContentType.SubscriptionDeleted]: SubscriptionDeletedContent;
367
- [WebhookContentType.PaymentSourceAdded]: PaymentSourceAddedContent;
368
- [WebhookContentType.SubscriptionMovedIn]: SubscriptionMovedInContent;
369
- [WebhookContentType.ItemPriceCreated]: ItemPriceCreatedContent;
370
- [WebhookContentType.SubscriptionScheduledCancellationRemoved]: SubscriptionScheduledCancellationRemovedContent;
371
- [WebhookContentType.PaymentRefunded]: PaymentRefundedContent;
372
- [WebhookContentType.UsageFileIngested]: UsageFileIngestedContent;
373
- [WebhookContentType.OmnichannelSubscriptionMovedIn]: OmnichannelSubscriptionMovedInContent;
374
- [WebhookContentType.DifferentialPriceCreated]: DifferentialPriceCreatedContent;
375
- [WebhookContentType.TransactionCreated]: TransactionCreatedContent;
376
- [WebhookContentType.PaymentSucceeded]: PaymentSucceededContent;
377
- [WebhookContentType.SubscriptionCanceledWithBackdating]: SubscriptionCanceledWithBackdatingContent;
378
- [WebhookContentType.UnbilledChargesVoided]: UnbilledChargesVoidedContent;
379
- [WebhookContentType.QuoteCreated]: QuoteCreatedContent;
380
- [WebhookContentType.CouponSetDeleted]: CouponSetDeletedContent;
381
- [WebhookContentType.AttachedItemCreated]: AttachedItemCreatedContent;
382
- [WebhookContentType.SalesOrderCreated]: SalesOrderCreatedContent;
383
- [WebhookContentType.CustomerChanged]: CustomerChangedContent;
384
- [WebhookContentType.SubscriptionStarted]: SubscriptionStartedContent;
385
- [WebhookContentType.SubscriptionActivated]: SubscriptionActivatedContent;
386
- [WebhookContentType.PaymentSourceExpiring]: PaymentSourceExpiringContent;
387
- [WebhookContentType.SubscriptionReactivated]: SubscriptionReactivatedContent;
388
- [WebhookContentType.OrderUpdated]: OrderUpdatedContent;
389
- [WebhookContentType.SubscriptionScheduledPauseRemoved]: SubscriptionScheduledPauseRemovedContent;
390
- [WebhookContentType.SubscriptionCancellationReminder]: SubscriptionCancellationReminderContent;
391
- [WebhookContentType.SubscriptionCreatedWithBackdating]: SubscriptionCreatedWithBackdatingContent;
392
- [WebhookContentType.SubscriptionRampCreated]: SubscriptionRampCreatedContent;
393
- [WebhookContentType.OrderDeleted]: OrderDeletedContent;
394
- [WebhookContentType.OmnichannelSubscriptionItemPauseScheduled]: OmnichannelSubscriptionItemPauseScheduledContent;
395
- [WebhookContentType.GiftUpdated]: GiftUpdatedContent;
396
- [WebhookContentType.SubscriptionTrialExtended]: SubscriptionTrialExtendedContent;
397
- [WebhookContentType.OmnichannelSubscriptionItemGracePeriodStarted]: OmnichannelSubscriptionItemGracePeriodStartedContent;
398
- [WebhookContentType.CardExpiryReminder]: CardExpiryReminderContent;
399
- [WebhookContentType.TokenCreated]: TokenCreatedContent;
400
- [WebhookContentType.PromotionalCreditsAdded]: PromotionalCreditsAddedContent;
401
- [WebhookContentType.SubscriptionRampUpdated]: SubscriptionRampUpdatedContent;
402
- [WebhookContentType.CustomerEntitlementsUpdated]: CustomerEntitlementsUpdatedContent;
403
- [WebhookContentType.PaymentSourceExpired]: PaymentSourceExpiredContent;
404
- [WebhookContentType.CustomerMovedOut]: CustomerMovedOutContent;
405
- [WebhookContentType.SubscriptionEntitlementsUpdated]: SubscriptionEntitlementsUpdatedContent;
406
- [WebhookContentType.OmnichannelSubscriptionItemDunningExpired]: OmnichannelSubscriptionItemDunningExpiredContent;
407
- [WebhookContentType.HierarchyCreated]: HierarchyCreatedContent;
408
- [WebhookContentType.AttachedItemDeleted]: AttachedItemDeletedContent;
409
- [WebhookContentType.OmnichannelSubscriptionItemScheduledCancellationRemoved]: OmnichannelSubscriptionItemScheduledCancellationRemovedContent;
410
- [WebhookContentType.ItemUpdated]: ItemUpdatedContent;
411
- [WebhookContentType.CouponSetCreated]: CouponSetCreatedContent;
412
- [WebhookContentType.PaymentIntentUpdated]: PaymentIntentUpdatedContent;
413
- [WebhookContentType.OrderResent]: OrderResentContent;
414
- [WebhookContentType.OmnichannelSubscriptionCreated]: OmnichannelSubscriptionCreatedContent;
415
- [WebhookContentType.TaxWithheldRecorded]: TaxWithheldRecordedContent;
416
- [WebhookContentType.PriceVariantCreated]: PriceVariantCreatedContent;
417
- [WebhookContentType.DifferentialPriceDeleted]: DifferentialPriceDeletedContent;
418
- [WebhookContentType.SubscriptionItemsRenewed]: SubscriptionItemsRenewedContent;
419
- [WebhookContentType.RuleCreated]: RuleCreatedContent;
420
- [WebhookContentType.ContractTermCancelled]: ContractTermCancelledContent;
421
- [WebhookContentType.ContractTermRenewed]: ContractTermRenewedContent;
422
- [WebhookContentType.InvoiceDeleted]: InvoiceDeletedContent;
423
- [WebhookContentType.ItemPriceEntitlementsRemoved]: ItemPriceEntitlementsRemovedContent;
424
- [WebhookContentType.SalesOrderUpdated]: SalesOrderUpdatedContent;
425
- [WebhookContentType.OmnichannelSubscriptionItemDunningStarted]: OmnichannelSubscriptionItemDunningStartedContent;
426
- [WebhookContentType.OmnichannelSubscriptionItemChangeScheduled]: OmnichannelSubscriptionItemChangeScheduledContent;
427
- [WebhookContentType.PendingInvoiceUpdated]: PendingInvoiceUpdatedContent;
428
- [WebhookContentType.QuoteUpdated]: QuoteUpdatedContent;
429
- [WebhookContentType.AttachedItemUpdated]: AttachedItemUpdatedContent;
430
- [WebhookContentType.PaymentSourceUpdated]: PaymentSourceUpdatedContent;
431
- [WebhookContentType.BusinessEntityDeleted]: BusinessEntityDeletedContent;
432
- [WebhookContentType.AuthorizationVoided]: AuthorizationVoidedContent;
433
- [WebhookContentType.SubscriptionRampDeleted]: SubscriptionRampDeletedContent;
434
- [WebhookContentType.PlanDeleted]: PlanDeletedContent;
435
- [WebhookContentType.AddonDeleted]: AddonDeletedContent;
436
- [WebhookContentType.AddonUpdated]: AddonUpdatedContent;
437
- [WebhookContentType.AddonCreated]: AddonCreatedContent;
438
- [WebhookContentType.PlanCreated]: PlanCreatedContent;
439
- [WebhookContentType.PlanUpdated]: PlanUpdatedContent;
440
- };
441
-
442
- export type ContentFor<T extends WebhookContentType> = WebhookContentMap[T];
443
-
444
- export interface WebhookEvent<
445
- T extends WebhookContentType = WebhookContentType,
446
- > {
229
+ [WebhookEventType.SubscriptionPauseScheduled]: SubscriptionPauseScheduledContent;
230
+ [WebhookEventType.CustomerBusinessEntityChanged]: CustomerBusinessEntityChangedContent;
231
+ [WebhookEventType.SubscriptionAdvanceInvoiceScheduleAdded]: SubscriptionAdvanceInvoiceScheduleAddedContent;
232
+ [WebhookEventType.GiftExpired]: GiftExpiredContent;
233
+ [WebhookEventType.TaxWithheldDeleted]: TaxWithheldDeletedContent;
234
+ [WebhookEventType.UnbilledChargesDeleted]: UnbilledChargesDeletedContent;
235
+ [WebhookEventType.CouponUpdated]: CouponUpdatedContent;
236
+ [WebhookEventType.OmnichannelSubscriptionItemReactivated]: OmnichannelSubscriptionItemReactivatedContent;
237
+ [WebhookEventType.OmnichannelSubscriptionItemRenewed]: OmnichannelSubscriptionItemRenewedContent;
238
+ [WebhookEventType.UnbilledChargesCreated]: UnbilledChargesCreatedContent;
239
+ [WebhookEventType.SubscriptionResumed]: SubscriptionResumedContent;
240
+ [WebhookEventType.OmnichannelOneTimeOrderItemCancelled]: OmnichannelOneTimeOrderItemCancelledContent;
241
+ [WebhookEventType.SubscriptionCancelled]: SubscriptionCancelledContent;
242
+ [WebhookEventType.ItemEntitlementsRemoved]: ItemEntitlementsRemovedContent;
243
+ [WebhookEventType.BusinessEntityCreated]: BusinessEntityCreatedContent;
244
+ [WebhookEventType.CouponSetUpdated]: CouponSetUpdatedContent;
245
+ [WebhookEventType.DifferentialPriceUpdated]: DifferentialPriceUpdatedContent;
246
+ [WebhookEventType.OmnichannelSubscriptionItemPaused]: OmnichannelSubscriptionItemPausedContent;
247
+ [WebhookEventType.EntitlementOverridesRemoved]: EntitlementOverridesRemovedContent;
248
+ [WebhookEventType.SubscriptionActivatedWithBackdating]: SubscriptionActivatedWithBackdatingContent;
249
+ [WebhookEventType.SubscriptionTrialEndReminder]: SubscriptionTrialEndReminderContent;
250
+ [WebhookEventType.SubscriptionShippingAddressUpdated]: SubscriptionShippingAddressUpdatedContent;
251
+ [WebhookEventType.VoucherCreateFailed]: VoucherCreateFailedContent;
252
+ [WebhookEventType.GiftClaimed]: GiftClaimedContent;
253
+ [WebhookEventType.CustomerDeleted]: CustomerDeletedContent;
254
+ [WebhookEventType.RefundInitiated]: RefundInitiatedContent;
255
+ [WebhookEventType.InvoiceGeneratedWithBackdating]: InvoiceGeneratedWithBackdatingContent;
256
+ [WebhookEventType.OmnichannelTransactionCreated]: OmnichannelTransactionCreatedContent;
257
+ [WebhookEventType.AddUsagesReminder]: AddUsagesReminderContent;
258
+ [WebhookEventType.VoucherCreated]: VoucherCreatedContent;
259
+ [WebhookEventType.RuleUpdated]: RuleUpdatedContent;
260
+ [WebhookEventType.PaymentSchedulesCreated]: PaymentSchedulesCreatedContent;
261
+ [WebhookEventType.FeatureActivated]: FeatureActivatedContent;
262
+ [WebhookEventType.PaymentSourceLocallyDeleted]: PaymentSourceLocallyDeletedContent;
263
+ [WebhookEventType.InvoiceGenerated]: InvoiceGeneratedContent;
264
+ [WebhookEventType.VoucherExpired]: VoucherExpiredContent;
265
+ [WebhookEventType.AuthorizationSucceeded]: AuthorizationSucceededContent;
266
+ [WebhookEventType.GiftScheduled]: GiftScheduledContent;
267
+ [WebhookEventType.SubscriptionChangesScheduled]: SubscriptionChangesScheduledContent;
268
+ [WebhookEventType.SubscriptionChangedWithBackdating]: SubscriptionChangedWithBackdatingContent;
269
+ [WebhookEventType.OmnichannelSubscriptionItemChanged]: OmnichannelSubscriptionItemChangedContent;
270
+ [WebhookEventType.GiftUnclaimed]: GiftUnclaimedContent;
271
+ [WebhookEventType.VirtualBankAccountAdded]: VirtualBankAccountAddedContent;
272
+ [WebhookEventType.PaymentIntentCreated]: PaymentIntentCreatedContent;
273
+ [WebhookEventType.CreditNoteCreatedWithBackdating]: CreditNoteCreatedWithBackdatingContent;
274
+ [WebhookEventType.ContractTermTerminated]: ContractTermTerminatedContent;
275
+ [WebhookEventType.ItemFamilyUpdated]: ItemFamilyUpdatedContent;
276
+ [WebhookEventType.OrderCreated]: OrderCreatedContent;
277
+ [WebhookEventType.PriceVariantDeleted]: PriceVariantDeletedContent;
278
+ [WebhookEventType.SubscriptionMovementFailed]: SubscriptionMovementFailedContent;
279
+ [WebhookEventType.CustomerMovedIn]: CustomerMovedInContent;
280
+ [WebhookEventType.SubscriptionAdvanceInvoiceScheduleUpdated]: SubscriptionAdvanceInvoiceScheduleUpdatedContent;
281
+ [WebhookEventType.ItemDeleted]: ItemDeletedContent;
282
+ [WebhookEventType.SubscriptionRampDrafted]: SubscriptionRampDraftedContent;
283
+ [WebhookEventType.DunningUpdated]: DunningUpdatedContent;
284
+ [WebhookEventType.ItemEntitlementsUpdated]: ItemEntitlementsUpdatedContent;
285
+ [WebhookEventType.TokenConsumed]: TokenConsumedContent;
286
+ [WebhookEventType.HierarchyDeleted]: HierarchyDeletedContent;
287
+ [WebhookEventType.SubscriptionCancellationScheduled]: SubscriptionCancellationScheduledContent;
288
+ [WebhookEventType.SubscriptionRenewed]: SubscriptionRenewedContent;
289
+ [WebhookEventType.FeatureUpdated]: FeatureUpdatedContent;
290
+ [WebhookEventType.FeatureDeleted]: FeatureDeletedContent;
291
+ [WebhookEventType.ItemFamilyCreated]: ItemFamilyCreatedContent;
292
+ [WebhookEventType.OmnichannelSubscriptionItemScheduledChangeRemoved]: OmnichannelSubscriptionItemScheduledChangeRemovedContent;
293
+ [WebhookEventType.OmnichannelSubscriptionItemResumed]: OmnichannelSubscriptionItemResumedContent;
294
+ [WebhookEventType.PurchaseCreated]: PurchaseCreatedContent;
295
+ [WebhookEventType.EntitlementOverridesUpdated]: EntitlementOverridesUpdatedContent;
296
+ [WebhookEventType.ItemFamilyDeleted]: ItemFamilyDeletedContent;
297
+ [WebhookEventType.SubscriptionResumptionScheduled]: SubscriptionResumptionScheduledContent;
298
+ [WebhookEventType.FeatureReactivated]: FeatureReactivatedContent;
299
+ [WebhookEventType.CouponCodesDeleted]: CouponCodesDeletedContent;
300
+ [WebhookEventType.CardExpired]: CardExpiredContent;
301
+ [WebhookEventType.CreditNoteUpdated]: CreditNoteUpdatedContent;
302
+ [WebhookEventType.OmnichannelSubscriptionItemDowngraded]: OmnichannelSubscriptionItemDowngradedContent;
303
+ [WebhookEventType.PriceVariantUpdated]: PriceVariantUpdatedContent;
304
+ [WebhookEventType.PromotionalCreditsDeducted]: PromotionalCreditsDeductedContent;
305
+ [WebhookEventType.SubscriptionRampApplied]: SubscriptionRampAppliedContent;
306
+ [WebhookEventType.SubscriptionPaused]: SubscriptionPausedContent;
307
+ [WebhookEventType.OrderReadyToProcess]: OrderReadyToProcessContent;
308
+ [WebhookEventType.FeatureCreated]: FeatureCreatedContent;
309
+ [WebhookEventType.TransactionDeleted]: TransactionDeletedContent;
310
+ [WebhookEventType.CreditNoteCreated]: CreditNoteCreatedContent;
311
+ [WebhookEventType.OmnichannelSubscriptionItemResubscribed]: OmnichannelSubscriptionItemResubscribedContent;
312
+ [WebhookEventType.RecordPurchaseFailed]: RecordPurchaseFailedContent;
313
+ [WebhookEventType.ItemCreated]: ItemCreatedContent;
314
+ [WebhookEventType.TransactionUpdated]: TransactionUpdatedContent;
315
+ [WebhookEventType.MrrUpdated]: MrrUpdatedContent;
316
+ [WebhookEventType.UnbilledChargesInvoiced]: UnbilledChargesInvoicedContent;
317
+ [WebhookEventType.ItemPriceUpdated]: ItemPriceUpdatedContent;
318
+ [WebhookEventType.CouponCodesUpdated]: CouponCodesUpdatedContent;
319
+ [WebhookEventType.VirtualBankAccountUpdated]: VirtualBankAccountUpdatedContent;
320
+ [WebhookEventType.ContractTermCreated]: ContractTermCreatedContent;
321
+ [WebhookEventType.SubscriptionChanged]: SubscriptionChangedContent;
322
+ [WebhookEventType.PaymentFailed]: PaymentFailedContent;
323
+ [WebhookEventType.CreditNoteDeleted]: CreditNoteDeletedContent;
324
+ [WebhookEventType.TaxWithheldRefunded]: TaxWithheldRefundedContent;
325
+ [WebhookEventType.ContractTermCompleted]: ContractTermCompletedContent;
326
+ [WebhookEventType.PaymentSchedulesUpdated]: PaymentSchedulesUpdatedContent;
327
+ [WebhookEventType.OmnichannelSubscriptionItemExpired]: OmnichannelSubscriptionItemExpiredContent;
328
+ [WebhookEventType.CardUpdated]: CardUpdatedContent;
329
+ [WebhookEventType.CustomerCreated]: CustomerCreatedContent;
330
+ [WebhookEventType.SubscriptionRenewalReminder]: SubscriptionRenewalReminderContent;
331
+ [WebhookEventType.OrderDelivered]: OrderDeliveredContent;
332
+ [WebhookEventType.OmnichannelSubscriptionItemCancellationScheduled]: OmnichannelSubscriptionItemCancellationScheduledContent;
333
+ [WebhookEventType.OmnichannelSubscriptionItemGracePeriodExpired]: OmnichannelSubscriptionItemGracePeriodExpiredContent;
334
+ [WebhookEventType.CouponCodesAdded]: CouponCodesAddedContent;
335
+ [WebhookEventType.GiftCancelled]: GiftCancelledContent;
336
+ [WebhookEventType.OrderCancelled]: OrderCancelledContent;
337
+ [WebhookEventType.CouponDeleted]: CouponDeletedContent;
338
+ [WebhookEventType.SubscriptionScheduledChangesRemoved]: SubscriptionScheduledChangesRemovedContent;
339
+ [WebhookEventType.PendingInvoiceCreated]: PendingInvoiceCreatedContent;
340
+ [WebhookEventType.EntitlementOverridesAutoRemoved]: EntitlementOverridesAutoRemovedContent;
341
+ [WebhookEventType.OmnichannelSubscriptionItemUpgraded]: OmnichannelSubscriptionItemUpgradedContent;
342
+ [WebhookEventType.SubscriptionBusinessEntityChanged]: SubscriptionBusinessEntityChangedContent;
343
+ [WebhookEventType.OmnichannelOneTimeOrderCreated]: OmnichannelOneTimeOrderCreatedContent;
344
+ [WebhookEventType.PaymentSourceDeleted]: PaymentSourceDeletedContent;
345
+ [WebhookEventType.OmnichannelSubscriptionItemCancelled]: OmnichannelSubscriptionItemCancelledContent;
346
+ [WebhookEventType.QuoteDeleted]: QuoteDeletedContent;
347
+ [WebhookEventType.InvoiceUpdated]: InvoiceUpdatedContent;
348
+ [WebhookEventType.SubscriptionAdvanceInvoiceScheduleRemoved]: SubscriptionAdvanceInvoiceScheduleRemovedContent;
349
+ [WebhookEventType.CardDeleted]: CardDeletedContent;
350
+ [WebhookEventType.OrderReadyToShip]: OrderReadyToShipContent;
351
+ [WebhookEventType.SubscriptionMovedOut]: SubscriptionMovedOutContent;
352
+ [WebhookEventType.PaymentScheduleSchemeCreated]: PaymentScheduleSchemeCreatedContent;
353
+ [WebhookEventType.BusinessEntityUpdated]: BusinessEntityUpdatedContent;
354
+ [WebhookEventType.SubscriptionScheduledResumptionRemoved]: SubscriptionScheduledResumptionRemovedContent;
355
+ [WebhookEventType.PaymentInitiated]: PaymentInitiatedContent;
356
+ [WebhookEventType.FeatureArchived]: FeatureArchivedContent;
357
+ [WebhookEventType.SubscriptionReactivatedWithBackdating]: SubscriptionReactivatedWithBackdatingContent;
358
+ [WebhookEventType.OmnichannelSubscriptionImported]: OmnichannelSubscriptionImportedContent;
359
+ [WebhookEventType.TokenExpired]: TokenExpiredContent;
360
+ [WebhookEventType.CardAdded]: CardAddedContent;
361
+ [WebhookEventType.CouponCreated]: CouponCreatedContent;
362
+ [WebhookEventType.RuleDeleted]: RuleDeletedContent;
363
+ [WebhookEventType.ItemPriceEntitlementsUpdated]: ItemPriceEntitlementsUpdatedContent;
364
+ [WebhookEventType.ItemPriceDeleted]: ItemPriceDeletedContent;
365
+ [WebhookEventType.VirtualBankAccountDeleted]: VirtualBankAccountDeletedContent;
366
+ [WebhookEventType.PaymentScheduleSchemeDeleted]: PaymentScheduleSchemeDeletedContent;
367
+ [WebhookEventType.SubscriptionCreated]: SubscriptionCreatedContent;
368
+ [WebhookEventType.SubscriptionEntitlementsCreated]: SubscriptionEntitlementsCreatedContent;
369
+ [WebhookEventType.OrderReturned]: OrderReturnedContent;
370
+ [WebhookEventType.SubscriptionDeleted]: SubscriptionDeletedContent;
371
+ [WebhookEventType.PaymentSourceAdded]: PaymentSourceAddedContent;
372
+ [WebhookEventType.SubscriptionMovedIn]: SubscriptionMovedInContent;
373
+ [WebhookEventType.ItemPriceCreated]: ItemPriceCreatedContent;
374
+ [WebhookEventType.SubscriptionScheduledCancellationRemoved]: SubscriptionScheduledCancellationRemovedContent;
375
+ [WebhookEventType.PaymentRefunded]: PaymentRefundedContent;
376
+ [WebhookEventType.UsageFileIngested]: UsageFileIngestedContent;
377
+ [WebhookEventType.OmnichannelSubscriptionMovedIn]: OmnichannelSubscriptionMovedInContent;
378
+ [WebhookEventType.DifferentialPriceCreated]: DifferentialPriceCreatedContent;
379
+ [WebhookEventType.TransactionCreated]: TransactionCreatedContent;
380
+ [WebhookEventType.PaymentSucceeded]: PaymentSucceededContent;
381
+ [WebhookEventType.SubscriptionCanceledWithBackdating]: SubscriptionCanceledWithBackdatingContent;
382
+ [WebhookEventType.UnbilledChargesVoided]: UnbilledChargesVoidedContent;
383
+ [WebhookEventType.QuoteCreated]: QuoteCreatedContent;
384
+ [WebhookEventType.CouponSetDeleted]: CouponSetDeletedContent;
385
+ [WebhookEventType.AttachedItemCreated]: AttachedItemCreatedContent;
386
+ [WebhookEventType.SalesOrderCreated]: SalesOrderCreatedContent;
387
+ [WebhookEventType.CustomerChanged]: CustomerChangedContent;
388
+ [WebhookEventType.SubscriptionStarted]: SubscriptionStartedContent;
389
+ [WebhookEventType.SubscriptionActivated]: SubscriptionActivatedContent;
390
+ [WebhookEventType.PaymentSourceExpiring]: PaymentSourceExpiringContent;
391
+ [WebhookEventType.SubscriptionReactivated]: SubscriptionReactivatedContent;
392
+ [WebhookEventType.OrderUpdated]: OrderUpdatedContent;
393
+ [WebhookEventType.SubscriptionScheduledPauseRemoved]: SubscriptionScheduledPauseRemovedContent;
394
+ [WebhookEventType.SubscriptionCancellationReminder]: SubscriptionCancellationReminderContent;
395
+ [WebhookEventType.SubscriptionCreatedWithBackdating]: SubscriptionCreatedWithBackdatingContent;
396
+ [WebhookEventType.SubscriptionRampCreated]: SubscriptionRampCreatedContent;
397
+ [WebhookEventType.OrderDeleted]: OrderDeletedContent;
398
+ [WebhookEventType.OmnichannelSubscriptionItemPauseScheduled]: OmnichannelSubscriptionItemPauseScheduledContent;
399
+ [WebhookEventType.GiftUpdated]: GiftUpdatedContent;
400
+ [WebhookEventType.SubscriptionTrialExtended]: SubscriptionTrialExtendedContent;
401
+ [WebhookEventType.OmnichannelSubscriptionItemGracePeriodStarted]: OmnichannelSubscriptionItemGracePeriodStartedContent;
402
+ [WebhookEventType.CardExpiryReminder]: CardExpiryReminderContent;
403
+ [WebhookEventType.TokenCreated]: TokenCreatedContent;
404
+ [WebhookEventType.PromotionalCreditsAdded]: PromotionalCreditsAddedContent;
405
+ [WebhookEventType.SubscriptionRampUpdated]: SubscriptionRampUpdatedContent;
406
+ [WebhookEventType.CustomerEntitlementsUpdated]: CustomerEntitlementsUpdatedContent;
407
+ [WebhookEventType.PaymentSourceExpired]: PaymentSourceExpiredContent;
408
+ [WebhookEventType.CustomerMovedOut]: CustomerMovedOutContent;
409
+ [WebhookEventType.SubscriptionEntitlementsUpdated]: SubscriptionEntitlementsUpdatedContent;
410
+ [WebhookEventType.OmnichannelSubscriptionItemDunningExpired]: OmnichannelSubscriptionItemDunningExpiredContent;
411
+ [WebhookEventType.HierarchyCreated]: HierarchyCreatedContent;
412
+ [WebhookEventType.AttachedItemDeleted]: AttachedItemDeletedContent;
413
+ [WebhookEventType.OmnichannelSubscriptionItemScheduledCancellationRemoved]: OmnichannelSubscriptionItemScheduledCancellationRemovedContent;
414
+ [WebhookEventType.ItemUpdated]: ItemUpdatedContent;
415
+ [WebhookEventType.CouponSetCreated]: CouponSetCreatedContent;
416
+ [WebhookEventType.PaymentIntentUpdated]: PaymentIntentUpdatedContent;
417
+ [WebhookEventType.OrderResent]: OrderResentContent;
418
+ [WebhookEventType.OmnichannelSubscriptionCreated]: OmnichannelSubscriptionCreatedContent;
419
+ [WebhookEventType.TaxWithheldRecorded]: TaxWithheldRecordedContent;
420
+ [WebhookEventType.PriceVariantCreated]: PriceVariantCreatedContent;
421
+ [WebhookEventType.DifferentialPriceDeleted]: DifferentialPriceDeletedContent;
422
+ [WebhookEventType.SubscriptionItemsRenewed]: SubscriptionItemsRenewedContent;
423
+ [WebhookEventType.RuleCreated]: RuleCreatedContent;
424
+ [WebhookEventType.ContractTermCancelled]: ContractTermCancelledContent;
425
+ [WebhookEventType.ContractTermRenewed]: ContractTermRenewedContent;
426
+ [WebhookEventType.InvoiceDeleted]: InvoiceDeletedContent;
427
+ [WebhookEventType.ItemPriceEntitlementsRemoved]: ItemPriceEntitlementsRemovedContent;
428
+ [WebhookEventType.SalesOrderUpdated]: SalesOrderUpdatedContent;
429
+ [WebhookEventType.OmnichannelSubscriptionItemDunningStarted]: OmnichannelSubscriptionItemDunningStartedContent;
430
+ [WebhookEventType.OmnichannelSubscriptionItemChangeScheduled]: OmnichannelSubscriptionItemChangeScheduledContent;
431
+ [WebhookEventType.PendingInvoiceUpdated]: PendingInvoiceUpdatedContent;
432
+ [WebhookEventType.QuoteUpdated]: QuoteUpdatedContent;
433
+ [WebhookEventType.AttachedItemUpdated]: AttachedItemUpdatedContent;
434
+ [WebhookEventType.PaymentSourceUpdated]: PaymentSourceUpdatedContent;
435
+ [WebhookEventType.BusinessEntityDeleted]: BusinessEntityDeletedContent;
436
+ [WebhookEventType.AuthorizationVoided]: AuthorizationVoidedContent;
437
+ [WebhookEventType.SubscriptionRampDeleted]: SubscriptionRampDeletedContent;
438
+ [WebhookEventType.PlanDeleted]: PlanDeletedContent;
439
+ [WebhookEventType.AddonDeleted]: AddonDeletedContent;
440
+ [WebhookEventType.AddonUpdated]: AddonUpdatedContent;
441
+ [WebhookEventType.AddonCreated]: AddonCreatedContent;
442
+ [WebhookEventType.PlanCreated]: PlanCreatedContent;
443
+ [WebhookEventType.PlanUpdated]: PlanUpdatedContent;
444
+ };
445
+
446
+ export type ContentFor<T extends WebhookEventType> = WebhookContentMap[T];
447
+
448
+ export interface WebhookEvent<T extends WebhookEventType = WebhookEventType> {
447
449
  content: ContentFor<T>;
448
450
  id: string;
449
451
  occurred_at: number;