@whop/sdk 0.0.7 → 0.0.8

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 (88) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/client.d.mts +16 -10
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +16 -10
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/apps.d.mts +17 -1
  12. package/resources/apps.d.mts.map +1 -1
  13. package/resources/apps.d.ts +17 -1
  14. package/resources/apps.d.ts.map +1 -1
  15. package/resources/checkout-configurations.d.mts +165 -8
  16. package/resources/checkout-configurations.d.mts.map +1 -1
  17. package/resources/checkout-configurations.d.ts +165 -8
  18. package/resources/checkout-configurations.d.ts.map +1 -1
  19. package/resources/checkout-configurations.js +1 -0
  20. package/resources/checkout-configurations.js.map +1 -1
  21. package/resources/checkout-configurations.mjs +1 -0
  22. package/resources/checkout-configurations.mjs.map +1 -1
  23. package/resources/course-lessons.d.mts +199 -1
  24. package/resources/course-lessons.d.mts.map +1 -1
  25. package/resources/course-lessons.d.ts +199 -1
  26. package/resources/course-lessons.d.ts.map +1 -1
  27. package/resources/course-lessons.js +40 -0
  28. package/resources/course-lessons.js.map +1 -1
  29. package/resources/course-lessons.mjs +40 -0
  30. package/resources/course-lessons.mjs.map +1 -1
  31. package/resources/courses.d.mts +8 -0
  32. package/resources/courses.d.mts.map +1 -1
  33. package/resources/courses.d.ts +8 -0
  34. package/resources/courses.d.ts.map +1 -1
  35. package/resources/forum-posts.d.mts +7 -3
  36. package/resources/forum-posts.d.mts.map +1 -1
  37. package/resources/forum-posts.d.ts +7 -3
  38. package/resources/forum-posts.d.ts.map +1 -1
  39. package/resources/index.d.mts +7 -5
  40. package/resources/index.d.mts.map +1 -1
  41. package/resources/index.d.ts +7 -5
  42. package/resources/index.d.ts.map +1 -1
  43. package/resources/index.js +5 -1
  44. package/resources/index.js.map +1 -1
  45. package/resources/index.mjs +2 -0
  46. package/resources/index.mjs.map +1 -1
  47. package/resources/refunds.d.mts +295 -0
  48. package/resources/refunds.d.mts.map +1 -0
  49. package/resources/refunds.d.ts +295 -0
  50. package/resources/refunds.d.ts.map +1 -0
  51. package/resources/refunds.js +34 -0
  52. package/resources/refunds.js.map +1 -0
  53. package/resources/refunds.mjs +30 -0
  54. package/resources/refunds.mjs.map +1 -0
  55. package/resources/shared.d.mts +43 -2
  56. package/resources/shared.d.mts.map +1 -1
  57. package/resources/shared.d.ts +43 -2
  58. package/resources/shared.d.ts.map +1 -1
  59. package/resources/webhooks.d.mts +382 -2
  60. package/resources/webhooks.d.mts.map +1 -1
  61. package/resources/webhooks.d.ts +382 -2
  62. package/resources/webhooks.d.ts.map +1 -1
  63. package/resources/webhooks.js.map +1 -1
  64. package/resources/webhooks.mjs.map +1 -1
  65. package/resources/withdrawals.d.mts +233 -0
  66. package/resources/withdrawals.d.mts.map +1 -0
  67. package/resources/withdrawals.d.ts +233 -0
  68. package/resources/withdrawals.d.ts.map +1 -0
  69. package/resources/withdrawals.js +31 -0
  70. package/resources/withdrawals.js.map +1 -0
  71. package/resources/withdrawals.mjs +27 -0
  72. package/resources/withdrawals.mjs.map +1 -0
  73. package/src/client.ts +68 -0
  74. package/src/resources/apps.ts +21 -0
  75. package/src/resources/checkout-configurations.ts +189 -8
  76. package/src/resources/course-lessons.ts +250 -0
  77. package/src/resources/courses.ts +10 -0
  78. package/src/resources/forum-posts.ts +8 -2
  79. package/src/resources/index.ts +31 -0
  80. package/src/resources/refunds.ts +383 -0
  81. package/src/resources/shared.ts +49 -2
  82. package/src/resources/webhooks.ts +463 -1
  83. package/src/resources/withdrawals.ts +361 -0
  84. package/src/version.ts +1 -1
  85. package/version.d.mts +1 -1
  86. package/version.d.ts +1 -1
  87. package/version.js +1 -1
  88. package/version.mjs +1 -1
@@ -11,6 +11,7 @@ export {
11
11
  } from './app-builds';
12
12
  export {
13
13
  Apps,
14
+ type AppType,
14
15
  type AppListResponse,
15
16
  type AppCreateParams,
16
17
  type AppUpdateParams,
@@ -33,6 +34,7 @@ export {
33
34
  } from './chat-channels';
34
35
  export {
35
36
  CheckoutConfigurations,
37
+ type CheckoutModes,
36
38
  type CheckoutConfigurationListResponse,
37
39
  type CheckoutConfigurationCreateParams,
38
40
  type CheckoutConfigurationListParams,
@@ -68,9 +70,13 @@ export {
68
70
  type LessonVisibilities,
69
71
  type CourseLessonListResponse,
70
72
  type CourseLessonDeleteResponse,
73
+ type CourseLessonMarkAsCompletedResponse,
74
+ type CourseLessonStartResponse,
75
+ type CourseLessonSubmitAssessmentResponse,
71
76
  type CourseLessonCreateParams,
72
77
  type CourseLessonUpdateParams,
73
78
  type CourseLessonListParams,
79
+ type CourseLessonSubmitAssessmentParams,
74
80
  type CourseLessonListResponsesCursorPage,
75
81
  } from './course-lessons';
76
82
  export {
@@ -122,6 +128,7 @@ export {
122
128
  } from './experiences';
123
129
  export {
124
130
  ForumPosts,
131
+ type ForumPostVisibilityType,
125
132
  type ForumPostListResponse,
126
133
  type ForumPostCreateParams,
127
134
  type ForumPostUpdateParams,
@@ -215,6 +222,17 @@ export {
215
222
  type ReactionListParams,
216
223
  type ReactionListResponsesCursorPage,
217
224
  } from './reactions';
225
+ export {
226
+ Refunds,
227
+ type PaymentProvider,
228
+ type RefundReferenceStatus,
229
+ type RefundReferenceType,
230
+ type RefundStatus,
231
+ type RefundRetrieveResponse,
232
+ type RefundListResponse,
233
+ type RefundListParams,
234
+ type RefundListResponsesCursorPage,
235
+ } from './refunds';
218
236
  export {
219
237
  Reviews,
220
238
  type ReviewStatus,
@@ -268,5 +286,18 @@ export {
268
286
  type PaymentPendingWebhookEvent,
269
287
  type DisputeCreatedWebhookEvent,
270
288
  type DisputeUpdatedWebhookEvent,
289
+ type RefundCreatedWebhookEvent,
290
+ type RefundUpdatedWebhookEvent,
271
291
  type UnwrapWebhookEvent,
272
292
  } from './webhooks';
293
+ export {
294
+ Withdrawals,
295
+ type WithdrawalFeeTypes,
296
+ type WithdrawalSpeeds,
297
+ type WithdrawalStatus,
298
+ type WithdrawalTypes,
299
+ type WithdrawalRetrieveResponse,
300
+ type WithdrawalListResponse,
301
+ type WithdrawalListParams,
302
+ type WithdrawalListResponsesCursorPage,
303
+ } from './withdrawals';
@@ -0,0 +1,383 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as PaymentsAPI from './payments';
5
+ import * as Shared from './shared';
6
+ import { APIPromise } from '../core/api-promise';
7
+ import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
8
+ import { RequestOptions } from '../internal/request-options';
9
+ import { path } from '../internal/utils/path';
10
+
11
+ export class Refunds extends APIResource {
12
+ /**
13
+ * Retrieves a Refund by ID
14
+ *
15
+ * Required permissions:
16
+ *
17
+ * - `payment:basic:read`
18
+ * - `member:email:read`
19
+ * - `member:basic:read`
20
+ * - `member:phone:read`
21
+ */
22
+ retrieve(id: string, options?: RequestOptions): APIPromise<RefundRetrieveResponse> {
23
+ return this._client.get(path`/refunds/${id}`, options);
24
+ }
25
+
26
+ /**
27
+ * Lists Refunds for a payment.
28
+ *
29
+ * Required permissions:
30
+ *
31
+ * - `payment:basic:read`
32
+ */
33
+ list(
34
+ query: RefundListParams,
35
+ options?: RequestOptions,
36
+ ): PagePromise<RefundListResponsesCursorPage, RefundListResponse> {
37
+ return this._client.getAPIList('/refunds', CursorPage<RefundListResponse>, { query, ...options });
38
+ }
39
+ }
40
+
41
+ export type RefundListResponsesCursorPage = CursorPage<RefundListResponse>;
42
+
43
+ /**
44
+ * The different payment providers.
45
+ */
46
+ export type PaymentProvider =
47
+ | 'stripe'
48
+ | 'coinbase'
49
+ | 'paypal'
50
+ | 'apple'
51
+ | 'sezzle'
52
+ | 'splitit'
53
+ | 'platform_balance'
54
+ | 'multi_psp';
55
+
56
+ /**
57
+ * The status of the refund reference.
58
+ */
59
+ export type RefundReferenceStatus = 'available' | 'pending' | 'unavailable';
60
+
61
+ /**
62
+ * The type of refund reference that was made available by the payment provider.
63
+ */
64
+ export type RefundReferenceType =
65
+ | 'acquirer_reference_number'
66
+ | 'retrieval_reference_number'
67
+ | 'system_trace_audit_number';
68
+
69
+ /**
70
+ * The different statuses for a Refund object
71
+ */
72
+ export type RefundStatus = 'pending' | 'requires_action' | 'succeeded' | 'failed' | 'canceled';
73
+
74
+ /**
75
+ * An object representing a refund made on a payment.
76
+ */
77
+ export interface RefundRetrieveResponse {
78
+ /**
79
+ * The ID of the refund.
80
+ */
81
+ id: string;
82
+
83
+ /**
84
+ * The amount of the refund.
85
+ */
86
+ amount: number;
87
+
88
+ /**
89
+ * The time the refund was created.
90
+ */
91
+ created_at: string;
92
+
93
+ /**
94
+ * The currency of the refund.
95
+ */
96
+ currency: Shared.Currency;
97
+
98
+ /**
99
+ * The payment associated with the refund.
100
+ */
101
+ payment: RefundRetrieveResponse.Payment | null;
102
+
103
+ /**
104
+ * The provider of the refund.
105
+ */
106
+ provider: PaymentProvider;
107
+
108
+ /**
109
+ * The time the refund was created by the provider.
110
+ */
111
+ provider_created_at: string | null;
112
+
113
+ /**
114
+ * The status of the refund reference.
115
+ */
116
+ reference_status: RefundReferenceStatus | null;
117
+
118
+ /**
119
+ * The type of refund reference that was made available by the payment provider.
120
+ */
121
+ reference_type: RefundReferenceType | null;
122
+
123
+ /**
124
+ * The value of the reference.
125
+ */
126
+ reference_value: string | null;
127
+
128
+ /**
129
+ * The status of the refund.
130
+ */
131
+ status: RefundStatus;
132
+ }
133
+
134
+ export namespace RefundRetrieveResponse {
135
+ /**
136
+ * The payment associated with the refund.
137
+ */
138
+ export interface Payment {
139
+ /**
140
+ * The payment ID
141
+ */
142
+ id: string;
143
+
144
+ /**
145
+ * The reason why a specific payment was billed
146
+ */
147
+ billing_reason: PaymentsAPI.BillingReasons | null;
148
+
149
+ /**
150
+ * Possible card brands that a payment token can have
151
+ */
152
+ card_brand: PaymentsAPI.CardBrands | null;
153
+
154
+ /**
155
+ * The last 4 digits of the card used to make the payment.
156
+ */
157
+ card_last4: string | null;
158
+
159
+ /**
160
+ * The datetime the payment was created
161
+ */
162
+ created_at: string;
163
+
164
+ /**
165
+ * The available currencies on the platform
166
+ */
167
+ currency: Shared.Currency | null;
168
+
169
+ /**
170
+ * When an alert came in that this transaction will be disputed
171
+ */
172
+ dispute_alerted_at: string | null;
173
+
174
+ /**
175
+ * The member attached to this payment.
176
+ */
177
+ member: Payment.Member | null;
178
+
179
+ /**
180
+ * The membership attached to this payment.
181
+ */
182
+ membership: Payment.Membership | null;
183
+
184
+ /**
185
+ * The datetime the payment was paid
186
+ */
187
+ paid_at: string | null;
188
+
189
+ /**
190
+ * The different types of payment methods that can be used.
191
+ */
192
+ payment_method_type: PaymentsAPI.PaymentMethodTypes | null;
193
+
194
+ /**
195
+ * The subtotal to show to the creator (excluding buyer fees).
196
+ */
197
+ subtotal: number | null;
198
+
199
+ /**
200
+ * The total to show to the creator (excluding buyer fees).
201
+ */
202
+ total: number | null;
203
+
204
+ /**
205
+ * The total in USD to show to the creator (excluding buyer fees).
206
+ */
207
+ usd_total: number | null;
208
+
209
+ /**
210
+ * The user that made this payment.
211
+ */
212
+ user: Payment.User | null;
213
+ }
214
+
215
+ export namespace Payment {
216
+ /**
217
+ * The member attached to this payment.
218
+ */
219
+ export interface Member {
220
+ /**
221
+ * The ID of the member
222
+ */
223
+ id: string;
224
+
225
+ /**
226
+ * The phone number for the member, if available.
227
+ */
228
+ phone: string | null;
229
+ }
230
+
231
+ /**
232
+ * The membership attached to this payment.
233
+ */
234
+ export interface Membership {
235
+ /**
236
+ * The internal ID of the membership.
237
+ */
238
+ id: string;
239
+
240
+ /**
241
+ * The state of the membership.
242
+ */
243
+ status: Shared.MembershipStatus;
244
+ }
245
+
246
+ /**
247
+ * The user that made this payment.
248
+ */
249
+ export interface User {
250
+ /**
251
+ * The internal ID of the user.
252
+ */
253
+ id: string;
254
+
255
+ /**
256
+ * The email of the user
257
+ */
258
+ email: string | null;
259
+
260
+ /**
261
+ * The name of the user from their Whop account.
262
+ */
263
+ name: string | null;
264
+
265
+ /**
266
+ * The username of the user from their Whop account.
267
+ */
268
+ username: string;
269
+ }
270
+ }
271
+ }
272
+
273
+ /**
274
+ * An object representing a refund made on a payment.
275
+ */
276
+ export interface RefundListResponse {
277
+ /**
278
+ * The ID of the refund.
279
+ */
280
+ id: string;
281
+
282
+ /**
283
+ * The amount of the refund.
284
+ */
285
+ amount: number;
286
+
287
+ /**
288
+ * The time the refund was created.
289
+ */
290
+ created_at: string;
291
+
292
+ /**
293
+ * The currency of the refund.
294
+ */
295
+ currency: Shared.Currency;
296
+
297
+ /**
298
+ * The payment associated with the refund.
299
+ */
300
+ payment: RefundListResponse.Payment | null;
301
+
302
+ /**
303
+ * The provider of the refund.
304
+ */
305
+ provider: PaymentProvider;
306
+
307
+ /**
308
+ * The time the refund was created by the provider.
309
+ */
310
+ provider_created_at: string | null;
311
+
312
+ /**
313
+ * The status of the refund reference.
314
+ */
315
+ reference_status: RefundReferenceStatus | null;
316
+
317
+ /**
318
+ * The type of refund reference that was made available by the payment provider.
319
+ */
320
+ reference_type: RefundReferenceType | null;
321
+
322
+ /**
323
+ * The value of the reference.
324
+ */
325
+ reference_value: string | null;
326
+
327
+ /**
328
+ * The status of the refund.
329
+ */
330
+ status: RefundStatus;
331
+ }
332
+
333
+ export namespace RefundListResponse {
334
+ /**
335
+ * The payment associated with the refund.
336
+ */
337
+ export interface Payment {
338
+ /**
339
+ * The payment ID
340
+ */
341
+ id: string;
342
+ }
343
+ }
344
+
345
+ export interface RefundListParams extends CursorPageParams {
346
+ /**
347
+ * The ID of the payment to list refunds for
348
+ */
349
+ payment_id: string;
350
+
351
+ /**
352
+ * Returns the elements in the list that come before the specified cursor.
353
+ */
354
+ before?: string | null;
355
+
356
+ /**
357
+ * The direction of the sort.
358
+ */
359
+ direction?: Shared.Direction | null;
360
+
361
+ /**
362
+ * Returns the first _n_ elements from the list.
363
+ */
364
+ first?: number | null;
365
+
366
+ /**
367
+ * Returns the last _n_ elements from the list.
368
+ */
369
+ last?: number | null;
370
+ }
371
+
372
+ export declare namespace Refunds {
373
+ export {
374
+ type PaymentProvider as PaymentProvider,
375
+ type RefundReferenceStatus as RefundReferenceStatus,
376
+ type RefundReferenceType as RefundReferenceType,
377
+ type RefundStatus as RefundStatus,
378
+ type RefundRetrieveResponse as RefundRetrieveResponse,
379
+ type RefundListResponse as RefundListResponse,
380
+ type RefundListResponsesCursorPage as RefundListResponsesCursorPage,
381
+ type RefundListParams as RefundListParams,
382
+ };
383
+ }
@@ -1,6 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import * as Shared from './shared';
4
+ import * as AppsAPI from './apps';
5
+ import * as CheckoutConfigurationsAPI from './checkout-configurations';
4
6
  import * as PaymentsAPI from './payments';
5
7
  import { CursorPage } from '../core/pagination';
6
8
 
@@ -29,6 +31,11 @@ export interface App {
29
31
  */
30
32
  api_key: App.APIKey | null;
31
33
 
34
+ /**
35
+ * The type of end-user an app is built for
36
+ */
37
+ app_type: AppsAPI.AppType;
38
+
32
39
  /**
33
40
  * The base url of the app
34
41
  */
@@ -438,12 +445,24 @@ export interface CheckoutConfiguration {
438
445
  /**
439
446
  * The metadata to use for the checkout configuration
440
447
  */
441
- metadata: { [key: string]: unknown };
448
+ metadata: { [key: string]: unknown } | null;
449
+
450
+ /**
451
+ * The mode of the checkout session.
452
+ */
453
+ mode: CheckoutConfigurationsAPI.CheckoutModes;
454
+
455
+ /**
456
+ * The explicit payment method configuration for the session, if any. This
457
+ * currently only works in 'setup' mode. Use the plan's
458
+ * payment_method_configuration for payment method.
459
+ */
460
+ payment_method_configuration: CheckoutConfiguration.PaymentMethodConfiguration | null;
442
461
 
443
462
  /**
444
463
  * The plan to use for the checkout configuration
445
464
  */
446
- plan: CheckoutConfiguration.Plan;
465
+ plan: CheckoutConfiguration.Plan | null;
447
466
 
448
467
  /**
449
468
  * A URL you can send to customers to complete a checkout. It looks like
@@ -458,6 +477,34 @@ export interface CheckoutConfiguration {
458
477
  }
459
478
 
460
479
  export namespace CheckoutConfiguration {
480
+ /**
481
+ * The explicit payment method configuration for the session, if any. This
482
+ * currently only works in 'setup' mode. Use the plan's
483
+ * payment_method_configuration for payment method.
484
+ */
485
+ export interface PaymentMethodConfiguration {
486
+ /**
487
+ * An array of payment method identifiers that are explicitly disabled. Only
488
+ * applies if the include_platform_defaults is true.
489
+ */
490
+ disabled: Array<PaymentsAPI.PaymentMethodTypes>;
491
+
492
+ /**
493
+ * An array of payment method identifiers that are explicitly enabled. This means
494
+ * these payment methods will be shown on checkout. Example use case is to only
495
+ * enable a specific payment method like cashapp, or extending the platform
496
+ * defaults with additional methods.
497
+ */
498
+ enabled: Array<PaymentsAPI.PaymentMethodTypes>;
499
+
500
+ /**
501
+ * Whether Whop's platform default payment method enablement settings are included
502
+ * in this configuration. The full list of default payment methods can be found in
503
+ * the documentation at docs.whop.com/payments.
504
+ */
505
+ include_platform_defaults: boolean;
506
+ }
507
+
461
508
  /**
462
509
  * The plan to use for the checkout configuration
463
510
  */