@whop/sdk 0.0.25 → 0.0.26

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 (133) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/client.d.mts +23 -20
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +23 -20
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +8 -4
  9. package/client.mjs.map +1 -1
  10. package/internal/parse.d.mts.map +1 -1
  11. package/internal/parse.d.ts.map +1 -1
  12. package/internal/parse.js +5 -0
  13. package/internal/parse.js.map +1 -1
  14. package/internal/parse.mjs +5 -0
  15. package/internal/parse.mjs.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/ai-chats.d.mts +7 -103
  18. package/resources/ai-chats.d.mts.map +1 -1
  19. package/resources/ai-chats.d.ts +7 -103
  20. package/resources/ai-chats.d.ts.map +1 -1
  21. package/resources/ai-chats.js.map +1 -1
  22. package/resources/ai-chats.mjs.map +1 -1
  23. package/resources/authorized-users.d.mts +39 -5
  24. package/resources/authorized-users.d.mts.map +1 -1
  25. package/resources/authorized-users.d.ts +39 -5
  26. package/resources/authorized-users.d.ts.map +1 -1
  27. package/resources/authorized-users.js +1 -1
  28. package/resources/authorized-users.js.map +1 -1
  29. package/resources/authorized-users.mjs +1 -1
  30. package/resources/authorized-users.mjs.map +1 -1
  31. package/resources/company-token-transactions.d.mts +13 -99
  32. package/resources/company-token-transactions.d.mts.map +1 -1
  33. package/resources/company-token-transactions.d.ts +13 -99
  34. package/resources/company-token-transactions.d.ts.map +1 -1
  35. package/resources/dm-channels.d.mts +161 -0
  36. package/resources/dm-channels.d.mts.map +1 -0
  37. package/resources/dm-channels.d.ts +161 -0
  38. package/resources/dm-channels.d.ts.map +1 -0
  39. package/resources/dm-channels.js +87 -0
  40. package/resources/dm-channels.js.map +1 -0
  41. package/resources/dm-channels.mjs +83 -0
  42. package/resources/dm-channels.mjs.map +1 -0
  43. package/resources/dm-members.d.mts +14 -66
  44. package/resources/dm-members.d.mts.map +1 -1
  45. package/resources/dm-members.d.ts +14 -66
  46. package/resources/dm-members.d.ts.map +1 -1
  47. package/resources/files.d.mts +7 -3
  48. package/resources/files.d.mts.map +1 -1
  49. package/resources/files.d.ts +7 -3
  50. package/resources/files.d.ts.map +1 -1
  51. package/resources/index.d.mts +11 -10
  52. package/resources/index.d.mts.map +1 -1
  53. package/resources/index.d.ts +11 -10
  54. package/resources/index.d.ts.map +1 -1
  55. package/resources/index.js +3 -1
  56. package/resources/index.js.map +1 -1
  57. package/resources/index.mjs +3 -2
  58. package/resources/index.mjs.map +1 -1
  59. package/resources/leads.d.mts +9 -177
  60. package/resources/leads.d.mts.map +1 -1
  61. package/resources/leads.d.ts +9 -177
  62. package/resources/leads.d.ts.map +1 -1
  63. package/resources/ledger-accounts.d.mts +3 -2
  64. package/resources/ledger-accounts.d.mts.map +1 -1
  65. package/resources/ledger-accounts.d.ts +3 -2
  66. package/resources/ledger-accounts.d.ts.map +1 -1
  67. package/resources/ledger-accounts.js.map +1 -1
  68. package/resources/ledger-accounts.mjs.map +1 -1
  69. package/resources/members.d.mts +5 -5
  70. package/resources/members.d.mts.map +1 -1
  71. package/resources/members.d.ts +5 -5
  72. package/resources/members.d.ts.map +1 -1
  73. package/resources/members.js +1 -1
  74. package/resources/members.js.map +1 -1
  75. package/resources/members.mjs +1 -1
  76. package/resources/members.mjs.map +1 -1
  77. package/resources/memberships.d.mts +8 -3
  78. package/resources/memberships.d.mts.map +1 -1
  79. package/resources/memberships.d.ts +8 -3
  80. package/resources/memberships.d.ts.map +1 -1
  81. package/resources/payments.d.mts +33 -0
  82. package/resources/payments.d.mts.map +1 -1
  83. package/resources/payments.d.ts +33 -0
  84. package/resources/payments.d.ts.map +1 -1
  85. package/resources/payout-methods.d.mts +8 -3
  86. package/resources/payout-methods.d.mts.map +1 -1
  87. package/resources/payout-methods.d.ts +8 -3
  88. package/resources/payout-methods.d.ts.map +1 -1
  89. package/resources/payout-methods.js.map +1 -1
  90. package/resources/payout-methods.mjs.map +1 -1
  91. package/resources/shared.d.mts +35 -1
  92. package/resources/shared.d.mts.map +1 -1
  93. package/resources/shared.d.ts +35 -1
  94. package/resources/shared.d.ts.map +1 -1
  95. package/resources/verifications.d.mts +11 -3
  96. package/resources/verifications.d.mts.map +1 -1
  97. package/resources/verifications.d.ts +11 -3
  98. package/resources/verifications.d.ts.map +1 -1
  99. package/resources/webhooks.d.mts +34 -293
  100. package/resources/webhooks.d.mts.map +1 -1
  101. package/resources/webhooks.d.ts +34 -293
  102. package/resources/webhooks.d.ts.map +1 -1
  103. package/resources/webhooks.js.map +1 -1
  104. package/resources/webhooks.mjs +2 -2
  105. package/resources/webhooks.mjs.map +1 -1
  106. package/resources/withdrawals.d.mts +17 -128
  107. package/resources/withdrawals.d.mts.map +1 -1
  108. package/resources/withdrawals.d.ts +17 -128
  109. package/resources/withdrawals.d.ts.map +1 -1
  110. package/src/client.ts +68 -34
  111. package/src/internal/parse.ts +6 -0
  112. package/src/resources/ai-chats.ts +7 -126
  113. package/src/resources/authorized-users.ts +45 -5
  114. package/src/resources/company-token-transactions.ts +14 -116
  115. package/src/resources/dm-channels.ts +212 -0
  116. package/src/resources/dm-members.ts +16 -78
  117. package/src/resources/files.ts +8 -2
  118. package/src/resources/index.ts +36 -17
  119. package/src/resources/leads.ts +9 -205
  120. package/src/resources/ledger-accounts.ts +3 -35
  121. package/src/resources/members.ts +6 -6
  122. package/src/resources/memberships.ts +16 -18
  123. package/src/resources/payments.ts +40 -0
  124. package/src/resources/payout-methods.ts +15 -2
  125. package/src/resources/shared.ts +42 -9
  126. package/src/resources/verifications.ts +49 -36
  127. package/src/resources/webhooks.ts +67 -728
  128. package/src/resources/withdrawals.ts +24 -205
  129. package/src/version.ts +1 -1
  130. package/version.d.mts +1 -1
  131. package/version.d.ts +1 -1
  132. package/version.js +1 -1
  133. package/version.mjs +1 -1
@@ -3,11 +3,13 @@
3
3
  import { APIResource } from '../core/resource';
4
4
  import * as DisputesAPI from './disputes';
5
5
  import * as PaymentsAPI from './payments';
6
+ import * as PayoutMethodsAPI from './payout-methods';
6
7
  import * as RefundsAPI from './refunds';
7
8
  import * as SetupIntentsAPI from './setup-intents';
8
9
  import * as Shared from './shared';
10
+ import * as VerificationsAPI from './verifications';
9
11
  import * as WithdrawalsAPI from './withdrawals';
10
- import { Webhook } from 'standardwebhooks';
12
+ import { Webhook as Webhook_ } from 'standardwebhooks';
11
13
  import { APIPromise } from '../core/api-promise';
12
14
  import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
13
15
  import { RequestOptions } from '../internal/request-options';
@@ -46,7 +48,7 @@ export class Webhooks extends APIResource {
46
48
  * );
47
49
  * ```
48
50
  */
49
- retrieve(id: string, options?: RequestOptions): APIPromise<WebhookRetrieveResponse> {
51
+ retrieve(id: string, options?: RequestOptions): APIPromise<Webhook> {
50
52
  return this._client.get(path`/webhooks/${id}`, options);
51
53
  }
52
54
 
@@ -68,7 +70,7 @@ export class Webhooks extends APIResource {
68
70
  id: string,
69
71
  body: WebhookUpdateParams | null | undefined = {},
70
72
  options?: RequestOptions,
71
- ): APIPromise<WebhookUpdateResponse> {
73
+ ): APIPromise<Webhook> {
72
74
  return this._client.patch(path`/webhooks/${id}`, { body, ...options });
73
75
  }
74
76
 
@@ -121,7 +123,7 @@ export class Webhooks extends APIResource {
121
123
  if (headers !== undefined) {
122
124
  const keyStr: string | null = key === undefined ? this._client.webhookKey : key;
123
125
  if (keyStr === null) throw new Error('Webhook key must not be null in order to unwrap');
124
- const wh = new Webhook(keyStr);
126
+ const wh = new Webhook_(keyStr);
125
127
  wh.verify(body, headers);
126
128
  }
127
129
  return JSON.parse(body) as UnwrapWebhookEvent;
@@ -131,122 +133,14 @@ export class Webhooks extends APIResource {
131
133
  export type WebhookListResponsesCursorPage = CursorPage<WebhookListResponse>;
132
134
 
133
135
  /**
134
- * A webhook object, which can be configured to be sent updates about a company
136
+ * The different API versions
135
137
  */
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
- }
138
+ export type APIVersion = 'v1' | 'v2' | 'v5';
245
139
 
246
140
  /**
247
141
  * A webhook object, which can be configured to be sent updates about a company
248
142
  */
249
- export interface WebhookRetrieveResponse {
143
+ export interface Webhook {
250
144
  /**
251
145
  * The ID of the webhook
252
146
  */
@@ -255,7 +149,7 @@ export interface WebhookRetrieveResponse {
255
149
  /**
256
150
  * The API version for this webhook
257
151
  */
258
- api_version: 'v1' | 'v2' | 'v5';
152
+ api_version: APIVersion;
259
153
 
260
154
  /**
261
155
  * Whether or not to send events for child resources. For example, if the webhook
@@ -277,35 +171,7 @@ export interface WebhookRetrieveResponse {
277
171
  /**
278
172
  * The number of events this webhooks is configured to receive
279
173
  */
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
- >;
174
+ events: Array<WebhookEvent>;
309
175
 
310
176
  /**
311
177
  * The resource ID
@@ -315,35 +181,7 @@ export interface WebhookRetrieveResponse {
315
181
  /**
316
182
  * The list of events that can be tested with this webhook
317
183
  */
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
- >;
184
+ testable_events: Array<WebhookEvent>;
347
185
 
348
186
  /**
349
187
  * The URL the webhook events will be sent to
@@ -351,10 +189,42 @@ export interface WebhookRetrieveResponse {
351
189
  url: string;
352
190
  }
353
191
 
192
+ /**
193
+ * The different event types available
194
+ */
195
+ export type WebhookEvent =
196
+ | 'invoice.created'
197
+ | 'invoice.paid'
198
+ | 'invoice.past_due'
199
+ | 'invoice.voided'
200
+ | 'membership.activated'
201
+ | 'membership.deactivated'
202
+ | 'entry.created'
203
+ | 'entry.approved'
204
+ | 'entry.denied'
205
+ | 'entry.deleted'
206
+ | 'setup_intent.requires_action'
207
+ | 'setup_intent.succeeded'
208
+ | 'setup_intent.canceled'
209
+ | 'withdrawal.created'
210
+ | 'withdrawal.updated'
211
+ | 'course_lesson_interaction.completed'
212
+ | 'payout_method.created'
213
+ | 'verification.succeeded'
214
+ | 'payment.created'
215
+ | 'payment.succeeded'
216
+ | 'payment.failed'
217
+ | 'payment.pending'
218
+ | 'dispute.created'
219
+ | 'dispute.updated'
220
+ | 'refund.created'
221
+ | 'refund.updated'
222
+ | 'membership.cancel_at_period_end_changed';
223
+
354
224
  /**
355
225
  * A webhook object, which can be configured to be sent updates about a company
356
226
  */
357
- export interface WebhookUpdateResponse {
227
+ export interface WebhookCreateResponse {
358
228
  /**
359
229
  * The ID of the webhook
360
230
  */
@@ -363,7 +233,7 @@ export interface WebhookUpdateResponse {
363
233
  /**
364
234
  * The API version for this webhook
365
235
  */
366
- api_version: 'v1' | 'v2' | 'v5';
236
+ api_version: APIVersion;
367
237
 
368
238
  /**
369
239
  * Whether or not to send events for child resources. For example, if the webhook
@@ -385,35 +255,7 @@ export interface WebhookUpdateResponse {
385
255
  /**
386
256
  * The number of events this webhooks is configured to receive
387
257
  */
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
- >;
258
+ events: Array<WebhookEvent>;
417
259
 
418
260
  /**
419
261
  * The resource ID
@@ -423,40 +265,17 @@ export interface WebhookUpdateResponse {
423
265
  /**
424
266
  * The list of events that can be tested with this webhook
425
267
  */
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
- >;
268
+ testable_events: Array<WebhookEvent>;
455
269
 
456
270
  /**
457
271
  * The URL the webhook events will be sent to
458
272
  */
459
273
  url: string;
274
+
275
+ /**
276
+ * A unique secret key that will be sent with each webhook event
277
+ */
278
+ webhook_secret: string;
460
279
  }
461
280
 
462
281
  /**
@@ -471,7 +290,7 @@ export interface WebhookListResponse {
471
290
  /**
472
291
  * The API version for this webhook
473
292
  */
474
- api_version: 'v1' | 'v2' | 'v5';
293
+ api_version: APIVersion;
475
294
 
476
295
  /**
477
296
  * Whether or not to send events for child resources. For example, if the webhook
@@ -493,35 +312,7 @@ export interface WebhookListResponse {
493
312
  /**
494
313
  * The number of events this webhooks is configured to receive
495
314
  */
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
- >;
315
+ events: Array<WebhookEvent>;
525
316
 
526
317
  /**
527
318
  * The URL the webhook events will be sent to
@@ -969,7 +760,7 @@ export interface WithdrawalCreatedWebhookEvent {
969
760
  /**
970
761
  * A withdrawal request.
971
762
  */
972
- data: WithdrawalCreatedWebhookEvent.Data;
763
+ data: WithdrawalsAPI.Withdrawal;
973
764
 
974
765
  /**
975
766
  * The timestamp in ISO 8601 format that the webhook was sent at on the server
@@ -987,188 +778,6 @@ export interface WithdrawalCreatedWebhookEvent {
987
778
  company_id?: string | null;
988
779
  }
989
780
 
990
- export namespace WithdrawalCreatedWebhookEvent {
991
- /**
992
- * A withdrawal request.
993
- */
994
- export interface Data {
995
- /**
996
- * Internal ID of the withdrawal request.
997
- */
998
- id: string;
999
-
1000
- /**
1001
- * How much money was attempted to be withdrawn, in a float type.
1002
- */
1003
- amount: number;
1004
-
1005
- /**
1006
- * When the withdrawal request was created.
1007
- */
1008
- created_at: string;
1009
-
1010
- /**
1011
- * The currency of the withdrawal request.
1012
- */
1013
- currency: Shared.Currency;
1014
-
1015
- /**
1016
- * The different error codes a payout can be in.
1017
- */
1018
- error_code:
1019
- | 'account_closed'
1020
- | 'account_does_not_exist'
1021
- | 'account_information_invalid'
1022
- | 'account_number_invalid_region'
1023
- | 'account_frozen'
1024
- | 'account_lookup_failed'
1025
- | 'account_not_found'
1026
- | 'amount_out_of_bounds'
1027
- | 'attributes_not_validated'
1028
- | 'b2b_payments_prohibited'
1029
- | 'bank_statement_required'
1030
- | 'compliance_review'
1031
- | 'currency_not_supported'
1032
- | 'deposit_canceled'
1033
- | 'deposit_failed'
1034
- | 'deposit_rejected'
1035
- | 'destination_unavailable'
1036
- | 'exceeded_account_limit'
1037
- | 'expired_quote'
1038
- | 'generic_payout_error'
1039
- | 'technical_problem'
1040
- | 'identification_number_invalid'
1041
- | 'invalid_account_number'
1042
- | 'invalid_bank_code'
1043
- | 'invalid_beneficiary'
1044
- | 'invalid_mailing_address'
1045
- | 'invalid_branch_number'
1046
- | 'invalid_branch_code'
1047
- | 'invalid_phone_number'
1048
- | 'invalid_routing_number'
1049
- | 'invalid_swift_code'
1050
- | 'invalid_company_details'
1051
- | 'manual_cancelation'
1052
- | 'misc_error'
1053
- | 'missing_city_and_country'
1054
- | 'missing_phone_number'
1055
- | 'missing_remittance_info'
1056
- | 'payee_name_invalid'
1057
- | 'receiving_account_locked'
1058
- | 'rejected_by_compliance'
1059
- | 'rtp_not_supported'
1060
- | 'non_transaction_account'
1061
- | 'source_token_insufficient_funds'
1062
- | 'ssn_invalid'
1063
- | 'wallet_screenshot_required'
1064
- | 'unsupported_region'
1065
- | null;
1066
-
1067
- /**
1068
- * The error message for the withdrawal, if any.
1069
- */
1070
- error_message: string | null;
1071
-
1072
- /**
1073
- * The estimated availability date for the withdrawal, if any.
1074
- */
1075
- estimated_availability: string | null;
1076
-
1077
- /**
1078
- * The fee amount that was charged for the withdrawal. This is in the same currency
1079
- * as the withdrawal amount.
1080
- */
1081
- fee_amount: number;
1082
-
1083
- /**
1084
- * The different fee types for a withdrawal.
1085
- */
1086
- fee_type: WithdrawalsAPI.WithdrawalFeeTypes | null;
1087
-
1088
- /**
1089
- * The ledger account associated with the withdrawal.
1090
- */
1091
- ledger_account: Data.LedgerAccount;
1092
-
1093
- /**
1094
- * The markup fee that was charged for the withdrawal. This is in the same currency
1095
- * as the withdrawal amount. This only applies to platform accounts using Whop
1096
- * Rails.
1097
- */
1098
- markup_fee: number;
1099
-
1100
- /**
1101
- * The payout token used for the withdrawal, if applicable.
1102
- */
1103
- payout_token: Data.PayoutToken | null;
1104
-
1105
- /**
1106
- * The speed of the withdrawal.
1107
- */
1108
- speed: WithdrawalsAPI.WithdrawalSpeeds;
1109
-
1110
- /**
1111
- * Status of the withdrawal.
1112
- */
1113
- status: WithdrawalsAPI.WithdrawalStatus;
1114
-
1115
- /**
1116
- * The trace code for the payout, if applicable. Provided on ACH transactions when
1117
- * available.
1118
- */
1119
- trace_code: string | null;
1120
- }
1121
-
1122
- export namespace Data {
1123
- /**
1124
- * The ledger account associated with the withdrawal.
1125
- */
1126
- export interface LedgerAccount {
1127
- /**
1128
- * The ID of the LedgerAccount.
1129
- */
1130
- id: string;
1131
-
1132
- /**
1133
- * The ID of the company associated with this ledger account.
1134
- */
1135
- company_id: string | null;
1136
- }
1137
-
1138
- /**
1139
- * The payout token used for the withdrawal, if applicable.
1140
- */
1141
- export interface PayoutToken {
1142
- /**
1143
- * The ID of the payout token
1144
- */
1145
- id: string;
1146
-
1147
- /**
1148
- * The date and time the payout token was created
1149
- */
1150
- created_at: string;
1151
-
1152
- /**
1153
- * The currency code of the payout destination. This is the currency that payouts
1154
- * will be made in for this token.
1155
- */
1156
- destination_currency_code: string;
1157
-
1158
- /**
1159
- * An optional nickname for the payout token to help the user identify it. This is
1160
- * not used by the provider and is only for the user's reference.
1161
- */
1162
- nickname: string | null;
1163
-
1164
- /**
1165
- * The name of the payer associated with the payout token.
1166
- */
1167
- payer_name: string | null;
1168
- }
1169
- }
1170
- }
1171
-
1172
781
  export interface WithdrawalUpdatedWebhookEvent {
1173
782
  /**
1174
783
  * A unique ID for every single webhook request
@@ -1183,7 +792,7 @@ export interface WithdrawalUpdatedWebhookEvent {
1183
792
  /**
1184
793
  * A withdrawal request.
1185
794
  */
1186
- data: WithdrawalUpdatedWebhookEvent.Data;
795
+ data: WithdrawalsAPI.Withdrawal;
1187
796
 
1188
797
  /**
1189
798
  * The timestamp in ISO 8601 format that the webhook was sent at on the server
@@ -1201,188 +810,6 @@ export interface WithdrawalUpdatedWebhookEvent {
1201
810
  company_id?: string | null;
1202
811
  }
1203
812
 
1204
- export namespace WithdrawalUpdatedWebhookEvent {
1205
- /**
1206
- * A withdrawal request.
1207
- */
1208
- export interface Data {
1209
- /**
1210
- * Internal ID of the withdrawal request.
1211
- */
1212
- id: string;
1213
-
1214
- /**
1215
- * How much money was attempted to be withdrawn, in a float type.
1216
- */
1217
- amount: number;
1218
-
1219
- /**
1220
- * When the withdrawal request was created.
1221
- */
1222
- created_at: string;
1223
-
1224
- /**
1225
- * The currency of the withdrawal request.
1226
- */
1227
- currency: Shared.Currency;
1228
-
1229
- /**
1230
- * The different error codes a payout can be in.
1231
- */
1232
- error_code:
1233
- | 'account_closed'
1234
- | 'account_does_not_exist'
1235
- | 'account_information_invalid'
1236
- | 'account_number_invalid_region'
1237
- | 'account_frozen'
1238
- | 'account_lookup_failed'
1239
- | 'account_not_found'
1240
- | 'amount_out_of_bounds'
1241
- | 'attributes_not_validated'
1242
- | 'b2b_payments_prohibited'
1243
- | 'bank_statement_required'
1244
- | 'compliance_review'
1245
- | 'currency_not_supported'
1246
- | 'deposit_canceled'
1247
- | 'deposit_failed'
1248
- | 'deposit_rejected'
1249
- | 'destination_unavailable'
1250
- | 'exceeded_account_limit'
1251
- | 'expired_quote'
1252
- | 'generic_payout_error'
1253
- | 'technical_problem'
1254
- | 'identification_number_invalid'
1255
- | 'invalid_account_number'
1256
- | 'invalid_bank_code'
1257
- | 'invalid_beneficiary'
1258
- | 'invalid_mailing_address'
1259
- | 'invalid_branch_number'
1260
- | 'invalid_branch_code'
1261
- | 'invalid_phone_number'
1262
- | 'invalid_routing_number'
1263
- | 'invalid_swift_code'
1264
- | 'invalid_company_details'
1265
- | 'manual_cancelation'
1266
- | 'misc_error'
1267
- | 'missing_city_and_country'
1268
- | 'missing_phone_number'
1269
- | 'missing_remittance_info'
1270
- | 'payee_name_invalid'
1271
- | 'receiving_account_locked'
1272
- | 'rejected_by_compliance'
1273
- | 'rtp_not_supported'
1274
- | 'non_transaction_account'
1275
- | 'source_token_insufficient_funds'
1276
- | 'ssn_invalid'
1277
- | 'wallet_screenshot_required'
1278
- | 'unsupported_region'
1279
- | null;
1280
-
1281
- /**
1282
- * The error message for the withdrawal, if any.
1283
- */
1284
- error_message: string | null;
1285
-
1286
- /**
1287
- * The estimated availability date for the withdrawal, if any.
1288
- */
1289
- estimated_availability: string | null;
1290
-
1291
- /**
1292
- * The fee amount that was charged for the withdrawal. This is in the same currency
1293
- * as the withdrawal amount.
1294
- */
1295
- fee_amount: number;
1296
-
1297
- /**
1298
- * The different fee types for a withdrawal.
1299
- */
1300
- fee_type: WithdrawalsAPI.WithdrawalFeeTypes | null;
1301
-
1302
- /**
1303
- * The ledger account associated with the withdrawal.
1304
- */
1305
- ledger_account: Data.LedgerAccount;
1306
-
1307
- /**
1308
- * The markup fee that was charged for the withdrawal. This is in the same currency
1309
- * as the withdrawal amount. This only applies to platform accounts using Whop
1310
- * Rails.
1311
- */
1312
- markup_fee: number;
1313
-
1314
- /**
1315
- * The payout token used for the withdrawal, if applicable.
1316
- */
1317
- payout_token: Data.PayoutToken | null;
1318
-
1319
- /**
1320
- * The speed of the withdrawal.
1321
- */
1322
- speed: WithdrawalsAPI.WithdrawalSpeeds;
1323
-
1324
- /**
1325
- * Status of the withdrawal.
1326
- */
1327
- status: WithdrawalsAPI.WithdrawalStatus;
1328
-
1329
- /**
1330
- * The trace code for the payout, if applicable. Provided on ACH transactions when
1331
- * available.
1332
- */
1333
- trace_code: string | null;
1334
- }
1335
-
1336
- export namespace Data {
1337
- /**
1338
- * The ledger account associated with the withdrawal.
1339
- */
1340
- export interface LedgerAccount {
1341
- /**
1342
- * The ID of the LedgerAccount.
1343
- */
1344
- id: string;
1345
-
1346
- /**
1347
- * The ID of the company associated with this ledger account.
1348
- */
1349
- company_id: string | null;
1350
- }
1351
-
1352
- /**
1353
- * The payout token used for the withdrawal, if applicable.
1354
- */
1355
- export interface PayoutToken {
1356
- /**
1357
- * The ID of the payout token
1358
- */
1359
- id: string;
1360
-
1361
- /**
1362
- * The date and time the payout token was created
1363
- */
1364
- created_at: string;
1365
-
1366
- /**
1367
- * The currency code of the payout destination. This is the currency that payouts
1368
- * will be made in for this token.
1369
- */
1370
- destination_currency_code: string;
1371
-
1372
- /**
1373
- * An optional nickname for the payout token to help the user identify it. This is
1374
- * not used by the provider and is only for the user's reference.
1375
- */
1376
- nickname: string | null;
1377
-
1378
- /**
1379
- * The name of the payer associated with the payout token.
1380
- */
1381
- payer_name: string | null;
1382
- }
1383
- }
1384
- }
1385
-
1386
813
  export interface CourseLessonInteractionCompletedWebhookEvent {
1387
814
  /**
1388
815
  * A unique ID for every single webhook request
@@ -1519,7 +946,7 @@ export namespace PayoutMethodCreatedWebhookEvent {
1519
946
  /**
1520
947
  * The category of the payout destination
1521
948
  */
1522
- category: 'crypto' | 'rtp' | 'next_day_bank' | 'bank_wire' | 'digital_wallet' | 'unknown';
949
+ category: PayoutMethodsAPI.PayoutDestinationCategory;
1523
950
 
1524
951
  /**
1525
952
  * The country code of the payout destination
@@ -1579,27 +1006,7 @@ export namespace VerificationSucceededWebhookEvent {
1579
1006
  /**
1580
1007
  * An error code for a verification attempt.
1581
1008
  */
1582
- last_error_code:
1583
- | 'abandoned'
1584
- | 'consent_declined'
1585
- | 'country_not_supported'
1586
- | 'device_not_supported'
1587
- | 'document_expired'
1588
- | 'document_type_not_supported'
1589
- | 'document_unverified_other'
1590
- | 'email_unverified_other'
1591
- | 'email_verification_declined'
1592
- | 'id_number_insufficient_document_data'
1593
- | 'id_number_mismatch'
1594
- | 'id_number_unverified_other'
1595
- | 'phone_unverified_other'
1596
- | 'phone_verification_declined'
1597
- | 'selfie_document_missing_photo'
1598
- | 'selfie_face_mismatch'
1599
- | 'selfie_manipulated'
1600
- | 'selfie_unverified_other'
1601
- | 'under_supported_age'
1602
- | null;
1009
+ last_error_code: VerificationsAPI.VerificationErrorCode | null;
1603
1010
 
1604
1011
  /**
1605
1012
  * The last error reason that occurred during the verification.
@@ -1609,20 +1016,7 @@ export namespace VerificationSucceededWebhookEvent {
1609
1016
  /**
1610
1017
  * The status of the verification.
1611
1018
  */
1612
- status:
1613
- | 'requires_input'
1614
- | 'processing'
1615
- | 'verified'
1616
- | 'canceled'
1617
- | 'created'
1618
- | 'started'
1619
- | 'submitted'
1620
- | 'approved'
1621
- | 'declined'
1622
- | 'resubmission_requested'
1623
- | 'expired'
1624
- | 'abandoned'
1625
- | 'review';
1019
+ status: VerificationsAPI.VerificationStatus;
1626
1020
  }
1627
1021
  }
1628
1022
 
@@ -2355,7 +1749,7 @@ export interface WebhookCreateParams {
2355
1749
  /**
2356
1750
  * The different API versions
2357
1751
  */
2358
- api_version?: 'v1' | 'v2' | 'v5' | null;
1752
+ api_version?: APIVersion | null;
2359
1753
 
2360
1754
  /**
2361
1755
  * Whether or not to send events for child resources. For example, if the webhook
@@ -2372,35 +1766,7 @@ export interface WebhookCreateParams {
2372
1766
  /**
2373
1767
  * The events to send the webhook for.
2374
1768
  */
2375
- events?: Array<
2376
- | 'invoice.created'
2377
- | 'invoice.paid'
2378
- | 'invoice.past_due'
2379
- | 'invoice.voided'
2380
- | 'membership.activated'
2381
- | 'membership.deactivated'
2382
- | 'entry.created'
2383
- | 'entry.approved'
2384
- | 'entry.denied'
2385
- | 'entry.deleted'
2386
- | 'setup_intent.requires_action'
2387
- | 'setup_intent.succeeded'
2388
- | 'setup_intent.canceled'
2389
- | 'withdrawal.created'
2390
- | 'withdrawal.updated'
2391
- | 'course_lesson_interaction.completed'
2392
- | 'payout_method.created'
2393
- | 'verification.succeeded'
2394
- | 'payment.created'
2395
- | 'payment.succeeded'
2396
- | 'payment.failed'
2397
- | 'payment.pending'
2398
- | 'dispute.created'
2399
- | 'dispute.updated'
2400
- | 'refund.created'
2401
- | 'refund.updated'
2402
- | 'membership.cancel_at_period_end_changed'
2403
- > | null;
1769
+ events?: Array<WebhookEvent> | null;
2404
1770
 
2405
1771
  /**
2406
1772
  * The resource to create the webhook for. By default this will use current company
@@ -2412,7 +1778,7 @@ export interface WebhookUpdateParams {
2412
1778
  /**
2413
1779
  * The different API versions
2414
1780
  */
2415
- api_version?: 'v1' | 'v2' | 'v5' | null;
1781
+ api_version?: APIVersion | null;
2416
1782
 
2417
1783
  /**
2418
1784
  * Whether or not to send events for child resources.
@@ -2427,35 +1793,7 @@ export interface WebhookUpdateParams {
2427
1793
  /**
2428
1794
  * The events to send the webhook for.
2429
1795
  */
2430
- events?: Array<
2431
- | 'invoice.created'
2432
- | 'invoice.paid'
2433
- | 'invoice.past_due'
2434
- | 'invoice.voided'
2435
- | 'membership.activated'
2436
- | 'membership.deactivated'
2437
- | 'entry.created'
2438
- | 'entry.approved'
2439
- | 'entry.denied'
2440
- | 'entry.deleted'
2441
- | 'setup_intent.requires_action'
2442
- | 'setup_intent.succeeded'
2443
- | 'setup_intent.canceled'
2444
- | 'withdrawal.created'
2445
- | 'withdrawal.updated'
2446
- | 'course_lesson_interaction.completed'
2447
- | 'payout_method.created'
2448
- | 'verification.succeeded'
2449
- | 'payment.created'
2450
- | 'payment.succeeded'
2451
- | 'payment.failed'
2452
- | 'payment.pending'
2453
- | 'dispute.created'
2454
- | 'dispute.updated'
2455
- | 'refund.created'
2456
- | 'refund.updated'
2457
- | 'membership.cancel_at_period_end_changed'
2458
- > | null;
1796
+ events?: Array<WebhookEvent> | null;
2459
1797
 
2460
1798
  /**
2461
1799
  * The URL to send the webhook to.
@@ -2487,9 +1825,10 @@ export interface WebhookListParams extends CursorPageParams {
2487
1825
 
2488
1826
  export declare namespace Webhooks {
2489
1827
  export {
1828
+ type APIVersion as APIVersion,
1829
+ type Webhook as Webhook,
1830
+ type WebhookEvent as WebhookEvent,
2490
1831
  type WebhookCreateResponse as WebhookCreateResponse,
2491
- type WebhookRetrieveResponse as WebhookRetrieveResponse,
2492
- type WebhookUpdateResponse as WebhookUpdateResponse,
2493
1832
  type WebhookListResponse as WebhookListResponse,
2494
1833
  type WebhookDeleteResponse as WebhookDeleteResponse,
2495
1834
  type InvoiceCreatedWebhookEvent as InvoiceCreatedWebhookEvent,