@whop/sdk 0.0.22 → 0.0.23

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 (62) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/client.d.mts +5 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/lib/upload-file.d.mts +39 -0
  11. package/lib/upload-file.d.mts.map +1 -0
  12. package/lib/upload-file.d.ts +39 -0
  13. package/lib/upload-file.d.ts.map +1 -0
  14. package/lib/upload-file.js +68 -0
  15. package/lib/upload-file.js.map +1 -0
  16. package/lib/upload-file.mjs +65 -0
  17. package/lib/upload-file.mjs.map +1 -0
  18. package/package.json +1 -1
  19. package/resources/files.d.mts +104 -0
  20. package/resources/files.d.mts.map +1 -0
  21. package/resources/files.d.ts +104 -0
  22. package/resources/files.d.ts.map +1 -0
  23. package/resources/files.js +35 -0
  24. package/resources/files.js.map +1 -0
  25. package/resources/files.mjs +31 -0
  26. package/resources/files.mjs.map +1 -0
  27. package/resources/index.d.mts +2 -1
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +2 -1
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +3 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +1 -0
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/payments.d.mts +1 -1
  36. package/resources/payments.d.mts.map +1 -1
  37. package/resources/payments.d.ts +1 -1
  38. package/resources/payments.d.ts.map +1 -1
  39. package/resources/plans.d.mts +8 -0
  40. package/resources/plans.d.mts.map +1 -1
  41. package/resources/plans.d.ts +8 -0
  42. package/resources/plans.d.ts.map +1 -1
  43. package/resources/webhooks.d.mts +431 -1
  44. package/resources/webhooks.d.mts.map +1 -1
  45. package/resources/webhooks.d.ts +431 -1
  46. package/resources/webhooks.d.ts.map +1 -1
  47. package/resources/webhooks.js +90 -0
  48. package/resources/webhooks.js.map +1 -1
  49. package/resources/webhooks.mjs +90 -0
  50. package/resources/webhooks.mjs.map +1 -1
  51. package/src/client.ts +28 -0
  52. package/src/lib/upload-file.ts +115 -0
  53. package/src/resources/files.ts +140 -0
  54. package/src/resources/index.ts +10 -0
  55. package/src/resources/payments.ts +30 -30
  56. package/src/resources/plans.ts +10 -0
  57. package/src/resources/webhooks.ts +793 -0
  58. package/src/version.ts +1 -1
  59. package/version.d.mts +1 -1
  60. package/version.d.ts +1 -1
  61. package/version.js +1 -1
  62. package/version.mjs +1 -1
@@ -8,8 +8,112 @@ import * as SetupIntentsAPI from './setup-intents';
8
8
  import * as Shared from './shared';
9
9
  import * as WithdrawalsAPI from './withdrawals';
10
10
  import { Webhook } from 'standardwebhooks';
11
+ import { APIPromise } from '../core/api-promise';
12
+ import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
13
+ import { RequestOptions } from '../internal/request-options';
14
+ import { path } from '../internal/utils/path';
11
15
 
12
16
  export class Webhooks extends APIResource {
17
+ /**
18
+ * Creates a new webhook
19
+ *
20
+ * Required permissions:
21
+ *
22
+ * - `developer:manage_webhook`
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const webhook = await client.webhooks.create({
27
+ * url: 'https://example.com/path',
28
+ * });
29
+ * ```
30
+ */
31
+ create(body: WebhookCreateParams, options?: RequestOptions): APIPromise<WebhookCreateResponse> {
32
+ return this._client.post('/webhooks', { body, ...options });
33
+ }
34
+
35
+ /**
36
+ * Retrieves a webhook by ID
37
+ *
38
+ * Required permissions:
39
+ *
40
+ * - `developer:manage_webhook`
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const webhook = await client.webhooks.retrieve(
45
+ * 'hook_xxxxxxxxxxxxx',
46
+ * );
47
+ * ```
48
+ */
49
+ retrieve(id: string, options?: RequestOptions): APIPromise<WebhookRetrieveResponse> {
50
+ return this._client.get(path`/webhooks/${id}`, options);
51
+ }
52
+
53
+ /**
54
+ * Updates a webhook
55
+ *
56
+ * Required permissions:
57
+ *
58
+ * - `developer:manage_webhook`
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const webhook = await client.webhooks.update(
63
+ * 'hook_xxxxxxxxxxxxx',
64
+ * );
65
+ * ```
66
+ */
67
+ update(
68
+ id: string,
69
+ body: WebhookUpdateParams | null | undefined = {},
70
+ options?: RequestOptions,
71
+ ): APIPromise<WebhookUpdateResponse> {
72
+ return this._client.patch(path`/webhooks/${id}`, { body, ...options });
73
+ }
74
+
75
+ /**
76
+ * Lists webhooks for a company
77
+ *
78
+ * Required permissions:
79
+ *
80
+ * - `developer:manage_webhook`
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * // Automatically fetches more pages as needed.
85
+ * for await (const webhookListResponse of client.webhooks.list(
86
+ * { company_id: 'biz_xxxxxxxxxxxxxx' },
87
+ * )) {
88
+ * // ...
89
+ * }
90
+ * ```
91
+ */
92
+ list(
93
+ query: WebhookListParams,
94
+ options?: RequestOptions,
95
+ ): PagePromise<WebhookListResponsesCursorPage, WebhookListResponse> {
96
+ return this._client.getAPIList('/webhooks', CursorPage<WebhookListResponse>, { query, ...options });
97
+ }
98
+
99
+ /**
100
+ * Deletes a webhook
101
+ *
102
+ * Required permissions:
103
+ *
104
+ * - `developer:manage_webhook`
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * const webhook = await client.webhooks.delete(
109
+ * 'hook_xxxxxxxxxxxxx',
110
+ * );
111
+ * ```
112
+ */
113
+ delete(id: string, options?: RequestOptions): APIPromise<WebhookDeleteResponse> {
114
+ return this._client.delete(path`/webhooks/${id}`, options);
115
+ }
116
+
13
117
  unwrap(
14
118
  body: string,
15
119
  { headers, key }: { headers: Record<string, string>; key?: string },
@@ -24,6 +128,412 @@ export class Webhooks extends APIResource {
24
128
  }
25
129
  }
26
130
 
131
+ export type WebhookListResponsesCursorPage = CursorPage<WebhookListResponse>;
132
+
133
+ /**
134
+ * A webhook object, which can be configured to be sent updates about a company
135
+ */
136
+ export interface WebhookCreateResponse {
137
+ /**
138
+ * The ID of the webhook
139
+ */
140
+ id: string;
141
+
142
+ /**
143
+ * The API version for this webhook
144
+ */
145
+ api_version: 'v1' | 'v2' | 'v5';
146
+
147
+ /**
148
+ * Whether or not to send events for child resources. For example, if the webhook
149
+ * is created for a Company, enabling this will only send events from the Company's
150
+ * sub-merchants (child companies).
151
+ */
152
+ child_resource_events: boolean;
153
+
154
+ /**
155
+ * The timestamp of when the webhook was created
156
+ */
157
+ created_at: string;
158
+
159
+ /**
160
+ * Whether or not this webhook is turned on or not
161
+ */
162
+ enabled: boolean;
163
+
164
+ /**
165
+ * The number of events this webhooks is configured to receive
166
+ */
167
+ events: Array<
168
+ | 'invoice.created'
169
+ | 'invoice.paid'
170
+ | 'invoice.past_due'
171
+ | 'invoice.voided'
172
+ | 'membership.activated'
173
+ | 'membership.deactivated'
174
+ | 'entry.created'
175
+ | 'entry.approved'
176
+ | 'entry.denied'
177
+ | 'entry.deleted'
178
+ | 'setup_intent.requires_action'
179
+ | 'setup_intent.succeeded'
180
+ | 'setup_intent.canceled'
181
+ | 'withdrawal.created'
182
+ | 'withdrawal.updated'
183
+ | 'course_lesson_interaction.completed'
184
+ | 'payout_method.created'
185
+ | 'verification.succeeded'
186
+ | 'payment.created'
187
+ | 'payment.succeeded'
188
+ | 'payment.failed'
189
+ | 'payment.pending'
190
+ | 'dispute.created'
191
+ | 'dispute.updated'
192
+ | 'refund.created'
193
+ | 'refund.updated'
194
+ | 'membership.cancel_at_period_end_changed'
195
+ >;
196
+
197
+ /**
198
+ * The resource ID
199
+ */
200
+ resource_id: string;
201
+
202
+ /**
203
+ * The list of events that can be tested with this webhook
204
+ */
205
+ testable_events: Array<
206
+ | 'invoice.created'
207
+ | 'invoice.paid'
208
+ | 'invoice.past_due'
209
+ | 'invoice.voided'
210
+ | 'membership.activated'
211
+ | 'membership.deactivated'
212
+ | 'entry.created'
213
+ | 'entry.approved'
214
+ | 'entry.denied'
215
+ | 'entry.deleted'
216
+ | 'setup_intent.requires_action'
217
+ | 'setup_intent.succeeded'
218
+ | 'setup_intent.canceled'
219
+ | 'withdrawal.created'
220
+ | 'withdrawal.updated'
221
+ | 'course_lesson_interaction.completed'
222
+ | 'payout_method.created'
223
+ | 'verification.succeeded'
224
+ | 'payment.created'
225
+ | 'payment.succeeded'
226
+ | 'payment.failed'
227
+ | 'payment.pending'
228
+ | 'dispute.created'
229
+ | 'dispute.updated'
230
+ | 'refund.created'
231
+ | 'refund.updated'
232
+ | 'membership.cancel_at_period_end_changed'
233
+ >;
234
+
235
+ /**
236
+ * The URL the webhook events will be sent to
237
+ */
238
+ url: string;
239
+
240
+ /**
241
+ * A unique secret key that will be sent with each webhook event
242
+ */
243
+ webhook_secret: string;
244
+ }
245
+
246
+ /**
247
+ * A webhook object, which can be configured to be sent updates about a company
248
+ */
249
+ export interface WebhookRetrieveResponse {
250
+ /**
251
+ * The ID of the webhook
252
+ */
253
+ id: string;
254
+
255
+ /**
256
+ * The API version for this webhook
257
+ */
258
+ api_version: 'v1' | 'v2' | 'v5';
259
+
260
+ /**
261
+ * Whether or not to send events for child resources. For example, if the webhook
262
+ * is created for a Company, enabling this will only send events from the Company's
263
+ * sub-merchants (child companies).
264
+ */
265
+ child_resource_events: boolean;
266
+
267
+ /**
268
+ * The timestamp of when the webhook was created
269
+ */
270
+ created_at: string;
271
+
272
+ /**
273
+ * Whether or not this webhook is turned on or not
274
+ */
275
+ enabled: boolean;
276
+
277
+ /**
278
+ * The number of events this webhooks is configured to receive
279
+ */
280
+ events: Array<
281
+ | 'invoice.created'
282
+ | 'invoice.paid'
283
+ | 'invoice.past_due'
284
+ | 'invoice.voided'
285
+ | 'membership.activated'
286
+ | 'membership.deactivated'
287
+ | 'entry.created'
288
+ | 'entry.approved'
289
+ | 'entry.denied'
290
+ | 'entry.deleted'
291
+ | 'setup_intent.requires_action'
292
+ | 'setup_intent.succeeded'
293
+ | 'setup_intent.canceled'
294
+ | 'withdrawal.created'
295
+ | 'withdrawal.updated'
296
+ | 'course_lesson_interaction.completed'
297
+ | 'payout_method.created'
298
+ | 'verification.succeeded'
299
+ | 'payment.created'
300
+ | 'payment.succeeded'
301
+ | 'payment.failed'
302
+ | 'payment.pending'
303
+ | 'dispute.created'
304
+ | 'dispute.updated'
305
+ | 'refund.created'
306
+ | 'refund.updated'
307
+ | 'membership.cancel_at_period_end_changed'
308
+ >;
309
+
310
+ /**
311
+ * The resource ID
312
+ */
313
+ resource_id: string;
314
+
315
+ /**
316
+ * The list of events that can be tested with this webhook
317
+ */
318
+ testable_events: Array<
319
+ | 'invoice.created'
320
+ | 'invoice.paid'
321
+ | 'invoice.past_due'
322
+ | 'invoice.voided'
323
+ | 'membership.activated'
324
+ | 'membership.deactivated'
325
+ | 'entry.created'
326
+ | 'entry.approved'
327
+ | 'entry.denied'
328
+ | 'entry.deleted'
329
+ | 'setup_intent.requires_action'
330
+ | 'setup_intent.succeeded'
331
+ | 'setup_intent.canceled'
332
+ | 'withdrawal.created'
333
+ | 'withdrawal.updated'
334
+ | 'course_lesson_interaction.completed'
335
+ | 'payout_method.created'
336
+ | 'verification.succeeded'
337
+ | 'payment.created'
338
+ | 'payment.succeeded'
339
+ | 'payment.failed'
340
+ | 'payment.pending'
341
+ | 'dispute.created'
342
+ | 'dispute.updated'
343
+ | 'refund.created'
344
+ | 'refund.updated'
345
+ | 'membership.cancel_at_period_end_changed'
346
+ >;
347
+
348
+ /**
349
+ * The URL the webhook events will be sent to
350
+ */
351
+ url: string;
352
+ }
353
+
354
+ /**
355
+ * A webhook object, which can be configured to be sent updates about a company
356
+ */
357
+ export interface WebhookUpdateResponse {
358
+ /**
359
+ * The ID of the webhook
360
+ */
361
+ id: string;
362
+
363
+ /**
364
+ * The API version for this webhook
365
+ */
366
+ api_version: 'v1' | 'v2' | 'v5';
367
+
368
+ /**
369
+ * Whether or not to send events for child resources. For example, if the webhook
370
+ * is created for a Company, enabling this will only send events from the Company's
371
+ * sub-merchants (child companies).
372
+ */
373
+ child_resource_events: boolean;
374
+
375
+ /**
376
+ * The timestamp of when the webhook was created
377
+ */
378
+ created_at: string;
379
+
380
+ /**
381
+ * Whether or not this webhook is turned on or not
382
+ */
383
+ enabled: boolean;
384
+
385
+ /**
386
+ * The number of events this webhooks is configured to receive
387
+ */
388
+ events: Array<
389
+ | 'invoice.created'
390
+ | 'invoice.paid'
391
+ | 'invoice.past_due'
392
+ | 'invoice.voided'
393
+ | 'membership.activated'
394
+ | 'membership.deactivated'
395
+ | 'entry.created'
396
+ | 'entry.approved'
397
+ | 'entry.denied'
398
+ | 'entry.deleted'
399
+ | 'setup_intent.requires_action'
400
+ | 'setup_intent.succeeded'
401
+ | 'setup_intent.canceled'
402
+ | 'withdrawal.created'
403
+ | 'withdrawal.updated'
404
+ | 'course_lesson_interaction.completed'
405
+ | 'payout_method.created'
406
+ | 'verification.succeeded'
407
+ | 'payment.created'
408
+ | 'payment.succeeded'
409
+ | 'payment.failed'
410
+ | 'payment.pending'
411
+ | 'dispute.created'
412
+ | 'dispute.updated'
413
+ | 'refund.created'
414
+ | 'refund.updated'
415
+ | 'membership.cancel_at_period_end_changed'
416
+ >;
417
+
418
+ /**
419
+ * The resource ID
420
+ */
421
+ resource_id: string;
422
+
423
+ /**
424
+ * The list of events that can be tested with this webhook
425
+ */
426
+ testable_events: Array<
427
+ | 'invoice.created'
428
+ | 'invoice.paid'
429
+ | 'invoice.past_due'
430
+ | 'invoice.voided'
431
+ | 'membership.activated'
432
+ | 'membership.deactivated'
433
+ | 'entry.created'
434
+ | 'entry.approved'
435
+ | 'entry.denied'
436
+ | 'entry.deleted'
437
+ | 'setup_intent.requires_action'
438
+ | 'setup_intent.succeeded'
439
+ | 'setup_intent.canceled'
440
+ | 'withdrawal.created'
441
+ | 'withdrawal.updated'
442
+ | 'course_lesson_interaction.completed'
443
+ | 'payout_method.created'
444
+ | 'verification.succeeded'
445
+ | 'payment.created'
446
+ | 'payment.succeeded'
447
+ | 'payment.failed'
448
+ | 'payment.pending'
449
+ | 'dispute.created'
450
+ | 'dispute.updated'
451
+ | 'refund.created'
452
+ | 'refund.updated'
453
+ | 'membership.cancel_at_period_end_changed'
454
+ >;
455
+
456
+ /**
457
+ * The URL the webhook events will be sent to
458
+ */
459
+ url: string;
460
+ }
461
+
462
+ /**
463
+ * A webhook object, which can be configured to be sent updates about a company
464
+ */
465
+ export interface WebhookListResponse {
466
+ /**
467
+ * The ID of the webhook
468
+ */
469
+ id: string;
470
+
471
+ /**
472
+ * The API version for this webhook
473
+ */
474
+ api_version: 'v1' | 'v2' | 'v5';
475
+
476
+ /**
477
+ * Whether or not to send events for child resources. For example, if the webhook
478
+ * is created for a Company, enabling this will only send events from the Company's
479
+ * sub-merchants (child companies).
480
+ */
481
+ child_resource_events: boolean;
482
+
483
+ /**
484
+ * The timestamp of when the webhook was created
485
+ */
486
+ created_at: string;
487
+
488
+ /**
489
+ * Whether or not this webhook is turned on or not
490
+ */
491
+ enabled: boolean;
492
+
493
+ /**
494
+ * The number of events this webhooks is configured to receive
495
+ */
496
+ events: Array<
497
+ | 'invoice.created'
498
+ | 'invoice.paid'
499
+ | 'invoice.past_due'
500
+ | 'invoice.voided'
501
+ | 'membership.activated'
502
+ | 'membership.deactivated'
503
+ | 'entry.created'
504
+ | 'entry.approved'
505
+ | 'entry.denied'
506
+ | 'entry.deleted'
507
+ | 'setup_intent.requires_action'
508
+ | 'setup_intent.succeeded'
509
+ | 'setup_intent.canceled'
510
+ | 'withdrawal.created'
511
+ | 'withdrawal.updated'
512
+ | 'course_lesson_interaction.completed'
513
+ | 'payout_method.created'
514
+ | 'verification.succeeded'
515
+ | 'payment.created'
516
+ | 'payment.succeeded'
517
+ | 'payment.failed'
518
+ | 'payment.pending'
519
+ | 'dispute.created'
520
+ | 'dispute.updated'
521
+ | 'refund.created'
522
+ | 'refund.updated'
523
+ | 'membership.cancel_at_period_end_changed'
524
+ >;
525
+
526
+ /**
527
+ * The URL the webhook events will be sent to
528
+ */
529
+ url: string;
530
+ }
531
+
532
+ /**
533
+ * Represents `true` or `false` values.
534
+ */
535
+ export type WebhookDeleteResponse = boolean;
536
+
27
537
  export interface InvoiceCreatedWebhookEvent {
28
538
  /**
29
539
  * A unique ID for every single webhook request
@@ -49,6 +559,11 @@ export interface InvoiceCreatedWebhookEvent {
49
559
  * The webhook event type
50
560
  */
51
561
  type: 'invoice.created';
562
+
563
+ /**
564
+ * The company ID that this webhook event is associated with
565
+ */
566
+ company_id?: string | null;
52
567
  }
53
568
 
54
569
  export interface InvoicePaidWebhookEvent {
@@ -76,6 +591,11 @@ export interface InvoicePaidWebhookEvent {
76
591
  * The webhook event type
77
592
  */
78
593
  type: 'invoice.paid';
594
+
595
+ /**
596
+ * The company ID that this webhook event is associated with
597
+ */
598
+ company_id?: string | null;
79
599
  }
80
600
 
81
601
  export interface InvoicePastDueWebhookEvent {
@@ -103,6 +623,11 @@ export interface InvoicePastDueWebhookEvent {
103
623
  * The webhook event type
104
624
  */
105
625
  type: 'invoice.past_due';
626
+
627
+ /**
628
+ * The company ID that this webhook event is associated with
629
+ */
630
+ company_id?: string | null;
106
631
  }
107
632
 
108
633
  export interface InvoiceVoidedWebhookEvent {
@@ -130,6 +655,11 @@ export interface InvoiceVoidedWebhookEvent {
130
655
  * The webhook event type
131
656
  */
132
657
  type: 'invoice.voided';
658
+
659
+ /**
660
+ * The company ID that this webhook event is associated with
661
+ */
662
+ company_id?: string | null;
133
663
  }
134
664
 
135
665
  export interface MembershipActivatedWebhookEvent {
@@ -158,6 +688,11 @@ export interface MembershipActivatedWebhookEvent {
158
688
  * The webhook event type
159
689
  */
160
690
  type: 'membership.activated';
691
+
692
+ /**
693
+ * The company ID that this webhook event is associated with
694
+ */
695
+ company_id?: string | null;
161
696
  }
162
697
 
163
698
  export interface MembershipDeactivatedWebhookEvent {
@@ -186,6 +721,11 @@ export interface MembershipDeactivatedWebhookEvent {
186
721
  * The webhook event type
187
722
  */
188
723
  type: 'membership.deactivated';
724
+
725
+ /**
726
+ * The company ID that this webhook event is associated with
727
+ */
728
+ company_id?: string | null;
189
729
  }
190
730
 
191
731
  export interface EntryCreatedWebhookEvent {
@@ -213,6 +753,11 @@ export interface EntryCreatedWebhookEvent {
213
753
  * The webhook event type
214
754
  */
215
755
  type: 'entry.created';
756
+
757
+ /**
758
+ * The company ID that this webhook event is associated with
759
+ */
760
+ company_id?: string | null;
216
761
  }
217
762
 
218
763
  export interface EntryApprovedWebhookEvent {
@@ -240,6 +785,11 @@ export interface EntryApprovedWebhookEvent {
240
785
  * The webhook event type
241
786
  */
242
787
  type: 'entry.approved';
788
+
789
+ /**
790
+ * The company ID that this webhook event is associated with
791
+ */
792
+ company_id?: string | null;
243
793
  }
244
794
 
245
795
  export interface EntryDeniedWebhookEvent {
@@ -267,6 +817,11 @@ export interface EntryDeniedWebhookEvent {
267
817
  * The webhook event type
268
818
  */
269
819
  type: 'entry.denied';
820
+
821
+ /**
822
+ * The company ID that this webhook event is associated with
823
+ */
824
+ company_id?: string | null;
270
825
  }
271
826
 
272
827
  export interface EntryDeletedWebhookEvent {
@@ -294,6 +849,11 @@ export interface EntryDeletedWebhookEvent {
294
849
  * The webhook event type
295
850
  */
296
851
  type: 'entry.deleted';
852
+
853
+ /**
854
+ * The company ID that this webhook event is associated with
855
+ */
856
+ company_id?: string | null;
297
857
  }
298
858
 
299
859
  export interface SetupIntentRequiresActionWebhookEvent {
@@ -322,6 +882,11 @@ export interface SetupIntentRequiresActionWebhookEvent {
322
882
  * The webhook event type
323
883
  */
324
884
  type: 'setup_intent.requires_action';
885
+
886
+ /**
887
+ * The company ID that this webhook event is associated with
888
+ */
889
+ company_id?: string | null;
325
890
  }
326
891
 
327
892
  export interface SetupIntentSucceededWebhookEvent {
@@ -350,6 +915,11 @@ export interface SetupIntentSucceededWebhookEvent {
350
915
  * The webhook event type
351
916
  */
352
917
  type: 'setup_intent.succeeded';
918
+
919
+ /**
920
+ * The company ID that this webhook event is associated with
921
+ */
922
+ company_id?: string | null;
353
923
  }
354
924
 
355
925
  export interface SetupIntentCanceledWebhookEvent {
@@ -378,6 +948,11 @@ export interface SetupIntentCanceledWebhookEvent {
378
948
  * The webhook event type
379
949
  */
380
950
  type: 'setup_intent.canceled';
951
+
952
+ /**
953
+ * The company ID that this webhook event is associated with
954
+ */
955
+ company_id?: string | null;
381
956
  }
382
957
 
383
958
  export interface WithdrawalCreatedWebhookEvent {
@@ -405,6 +980,11 @@ export interface WithdrawalCreatedWebhookEvent {
405
980
  * The webhook event type
406
981
  */
407
982
  type: 'withdrawal.created';
983
+
984
+ /**
985
+ * The company ID that this webhook event is associated with
986
+ */
987
+ company_id?: string | null;
408
988
  }
409
989
 
410
990
  export namespace WithdrawalCreatedWebhookEvent {
@@ -618,6 +1198,11 @@ export interface WithdrawalUpdatedWebhookEvent {
618
1198
  * The webhook event type
619
1199
  */
620
1200
  type: 'withdrawal.updated';
1201
+
1202
+ /**
1203
+ * The company ID that this webhook event is associated with
1204
+ */
1205
+ company_id?: string | null;
621
1206
  }
622
1207
 
623
1208
  export namespace WithdrawalUpdatedWebhookEvent {
@@ -831,6 +1416,11 @@ export interface CourseLessonInteractionCompletedWebhookEvent {
831
1416
  * The webhook event type
832
1417
  */
833
1418
  type: 'course_lesson_interaction.completed';
1419
+
1420
+ /**
1421
+ * The company ID that this webhook event is associated with
1422
+ */
1423
+ company_id?: string | null;
834
1424
  }
835
1425
 
836
1426
  export interface PayoutMethodCreatedWebhookEvent {
@@ -858,6 +1448,11 @@ export interface PayoutMethodCreatedWebhookEvent {
858
1448
  * The webhook event type
859
1449
  */
860
1450
  type: 'payout_method.created';
1451
+
1452
+ /**
1453
+ * The company ID that this webhook event is associated with
1454
+ */
1455
+ company_id?: string | null;
861
1456
  }
862
1457
 
863
1458
  export namespace PayoutMethodCreatedWebhookEvent {
@@ -956,6 +1551,11 @@ export interface VerificationSucceededWebhookEvent {
956
1551
  * The webhook event type
957
1552
  */
958
1553
  type: 'verification.succeeded';
1554
+
1555
+ /**
1556
+ * The company ID that this webhook event is associated with
1557
+ */
1558
+ company_id?: string | null;
959
1559
  }
960
1560
 
961
1561
  export namespace VerificationSucceededWebhookEvent {
@@ -1043,6 +1643,11 @@ export interface PaymentCreatedWebhookEvent {
1043
1643
  * The webhook event type
1044
1644
  */
1045
1645
  type: 'payment.created';
1646
+
1647
+ /**
1648
+ * The company ID that this webhook event is associated with
1649
+ */
1650
+ company_id?: string | null;
1046
1651
  }
1047
1652
 
1048
1653
  export interface PaymentSucceededWebhookEvent {
@@ -1070,6 +1675,11 @@ export interface PaymentSucceededWebhookEvent {
1070
1675
  * The webhook event type
1071
1676
  */
1072
1677
  type: 'payment.succeeded';
1678
+
1679
+ /**
1680
+ * The company ID that this webhook event is associated with
1681
+ */
1682
+ company_id?: string | null;
1073
1683
  }
1074
1684
 
1075
1685
  export interface PaymentFailedWebhookEvent {
@@ -1097,6 +1707,11 @@ export interface PaymentFailedWebhookEvent {
1097
1707
  * The webhook event type
1098
1708
  */
1099
1709
  type: 'payment.failed';
1710
+
1711
+ /**
1712
+ * The company ID that this webhook event is associated with
1713
+ */
1714
+ company_id?: string | null;
1100
1715
  }
1101
1716
 
1102
1717
  export interface PaymentPendingWebhookEvent {
@@ -1124,6 +1739,11 @@ export interface PaymentPendingWebhookEvent {
1124
1739
  * The webhook event type
1125
1740
  */
1126
1741
  type: 'payment.pending';
1742
+
1743
+ /**
1744
+ * The company ID that this webhook event is associated with
1745
+ */
1746
+ company_id?: string | null;
1127
1747
  }
1128
1748
 
1129
1749
  export interface DisputeCreatedWebhookEvent {
@@ -1151,6 +1771,11 @@ export interface DisputeCreatedWebhookEvent {
1151
1771
  * The webhook event type
1152
1772
  */
1153
1773
  type: 'dispute.created';
1774
+
1775
+ /**
1776
+ * The company ID that this webhook event is associated with
1777
+ */
1778
+ company_id?: string | null;
1154
1779
  }
1155
1780
 
1156
1781
  export interface DisputeUpdatedWebhookEvent {
@@ -1178,6 +1803,11 @@ export interface DisputeUpdatedWebhookEvent {
1178
1803
  * The webhook event type
1179
1804
  */
1180
1805
  type: 'dispute.updated';
1806
+
1807
+ /**
1808
+ * The company ID that this webhook event is associated with
1809
+ */
1810
+ company_id?: string | null;
1181
1811
  }
1182
1812
 
1183
1813
  export interface RefundCreatedWebhookEvent {
@@ -1205,6 +1835,11 @@ export interface RefundCreatedWebhookEvent {
1205
1835
  * The webhook event type
1206
1836
  */
1207
1837
  type: 'refund.created';
1838
+
1839
+ /**
1840
+ * The company ID that this webhook event is associated with
1841
+ */
1842
+ company_id?: string | null;
1208
1843
  }
1209
1844
 
1210
1845
  export namespace RefundCreatedWebhookEvent {
@@ -1433,6 +2068,11 @@ export interface RefundUpdatedWebhookEvent {
1433
2068
  * The webhook event type
1434
2069
  */
1435
2070
  type: 'refund.updated';
2071
+
2072
+ /**
2073
+ * The company ID that this webhook event is associated with
2074
+ */
2075
+ company_id?: string | null;
1436
2076
  }
1437
2077
 
1438
2078
  export namespace RefundUpdatedWebhookEvent {
@@ -1662,6 +2302,11 @@ export interface MembershipCancelAtPeriodEndChangedWebhookEvent {
1662
2302
  * The webhook event type
1663
2303
  */
1664
2304
  type: 'membership.cancel_at_period_end_changed';
2305
+
2306
+ /**
2307
+ * The company ID that this webhook event is associated with
2308
+ */
2309
+ company_id?: string | null;
1665
2310
  }
1666
2311
 
1667
2312
  export type UnwrapWebhookEvent =
@@ -1693,8 +2338,152 @@ export type UnwrapWebhookEvent =
1693
2338
  | RefundUpdatedWebhookEvent
1694
2339
  | MembershipCancelAtPeriodEndChangedWebhookEvent;
1695
2340
 
2341
+ export interface WebhookCreateParams {
2342
+ /**
2343
+ * The URL to send the webhook to.
2344
+ */
2345
+ url: string;
2346
+
2347
+ /**
2348
+ * The different API versions
2349
+ */
2350
+ api_version?: 'v1' | 'v2' | 'v5' | null;
2351
+
2352
+ /**
2353
+ * Whether or not to send events for child resources. For example, if the webhook
2354
+ * is created for a Company, enabling this will only send events from the Company's
2355
+ * sub-merchants (child companies).
2356
+ */
2357
+ child_resource_events?: boolean | null;
2358
+
2359
+ /**
2360
+ * Whether or not the webhook is enabled.
2361
+ */
2362
+ enabled?: boolean | null;
2363
+
2364
+ /**
2365
+ * The events to send the webhook for.
2366
+ */
2367
+ events?: Array<
2368
+ | 'invoice.created'
2369
+ | 'invoice.paid'
2370
+ | 'invoice.past_due'
2371
+ | 'invoice.voided'
2372
+ | 'membership.activated'
2373
+ | 'membership.deactivated'
2374
+ | 'entry.created'
2375
+ | 'entry.approved'
2376
+ | 'entry.denied'
2377
+ | 'entry.deleted'
2378
+ | 'setup_intent.requires_action'
2379
+ | 'setup_intent.succeeded'
2380
+ | 'setup_intent.canceled'
2381
+ | 'withdrawal.created'
2382
+ | 'withdrawal.updated'
2383
+ | 'course_lesson_interaction.completed'
2384
+ | 'payout_method.created'
2385
+ | 'verification.succeeded'
2386
+ | 'payment.created'
2387
+ | 'payment.succeeded'
2388
+ | 'payment.failed'
2389
+ | 'payment.pending'
2390
+ | 'dispute.created'
2391
+ | 'dispute.updated'
2392
+ | 'refund.created'
2393
+ | 'refund.updated'
2394
+ | 'membership.cancel_at_period_end_changed'
2395
+ > | null;
2396
+
2397
+ /**
2398
+ * The resource to create the webhook for. By default this will use current company
2399
+ */
2400
+ resource_id?: string | null;
2401
+ }
2402
+
2403
+ export interface WebhookUpdateParams {
2404
+ /**
2405
+ * The different API versions
2406
+ */
2407
+ api_version?: 'v1' | 'v2' | 'v5' | null;
2408
+
2409
+ /**
2410
+ * Whether or not to send events for child resources.
2411
+ */
2412
+ child_resource_events?: boolean | null;
2413
+
2414
+ /**
2415
+ * Whether or not the webhook is enabled.
2416
+ */
2417
+ enabled?: boolean | null;
2418
+
2419
+ /**
2420
+ * The events to send the webhook for.
2421
+ */
2422
+ events?: Array<
2423
+ | 'invoice.created'
2424
+ | 'invoice.paid'
2425
+ | 'invoice.past_due'
2426
+ | 'invoice.voided'
2427
+ | 'membership.activated'
2428
+ | 'membership.deactivated'
2429
+ | 'entry.created'
2430
+ | 'entry.approved'
2431
+ | 'entry.denied'
2432
+ | 'entry.deleted'
2433
+ | 'setup_intent.requires_action'
2434
+ | 'setup_intent.succeeded'
2435
+ | 'setup_intent.canceled'
2436
+ | 'withdrawal.created'
2437
+ | 'withdrawal.updated'
2438
+ | 'course_lesson_interaction.completed'
2439
+ | 'payout_method.created'
2440
+ | 'verification.succeeded'
2441
+ | 'payment.created'
2442
+ | 'payment.succeeded'
2443
+ | 'payment.failed'
2444
+ | 'payment.pending'
2445
+ | 'dispute.created'
2446
+ | 'dispute.updated'
2447
+ | 'refund.created'
2448
+ | 'refund.updated'
2449
+ | 'membership.cancel_at_period_end_changed'
2450
+ > | null;
2451
+
2452
+ /**
2453
+ * The URL to send the webhook to.
2454
+ */
2455
+ url?: string | null;
2456
+ }
2457
+
2458
+ export interface WebhookListParams extends CursorPageParams {
2459
+ /**
2460
+ * The ID of the company to list webhooks for
2461
+ */
2462
+ company_id: string;
2463
+
2464
+ /**
2465
+ * Returns the elements in the list that come before the specified cursor.
2466
+ */
2467
+ before?: string | null;
2468
+
2469
+ /**
2470
+ * Returns the first _n_ elements from the list.
2471
+ */
2472
+ first?: number | null;
2473
+
2474
+ /**
2475
+ * Returns the last _n_ elements from the list.
2476
+ */
2477
+ last?: number | null;
2478
+ }
2479
+
1696
2480
  export declare namespace Webhooks {
1697
2481
  export {
2482
+ type WebhookCreateResponse as WebhookCreateResponse,
2483
+ type WebhookRetrieveResponse as WebhookRetrieveResponse,
2484
+ type WebhookUpdateResponse as WebhookUpdateResponse,
2485
+ type WebhookListResponse as WebhookListResponse,
2486
+ type WebhookDeleteResponse as WebhookDeleteResponse,
1698
2487
  type InvoiceCreatedWebhookEvent as InvoiceCreatedWebhookEvent,
1699
2488
  type InvoicePaidWebhookEvent as InvoicePaidWebhookEvent,
1700
2489
  type InvoicePastDueWebhookEvent as InvoicePastDueWebhookEvent,
@@ -1723,5 +2512,9 @@ export declare namespace Webhooks {
1723
2512
  type RefundUpdatedWebhookEvent as RefundUpdatedWebhookEvent,
1724
2513
  type MembershipCancelAtPeriodEndChangedWebhookEvent as MembershipCancelAtPeriodEndChangedWebhookEvent,
1725
2514
  type UnwrapWebhookEvent as UnwrapWebhookEvent,
2515
+ type WebhookListResponsesCursorPage as WebhookListResponsesCursorPage,
2516
+ type WebhookCreateParams as WebhookCreateParams,
2517
+ type WebhookUpdateParams as WebhookUpdateParams,
2518
+ type WebhookListParams as WebhookListParams,
1726
2519
  };
1727
2520
  }