@whop/sdk 0.0.15 → 0.0.16

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 (67) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +7 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -4
  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/package.json +1 -1
  11. package/resources/courses.d.mts +33 -0
  12. package/resources/courses.d.mts.map +1 -1
  13. package/resources/courses.d.ts +33 -0
  14. package/resources/courses.d.ts.map +1 -1
  15. package/resources/index.d.mts +3 -2
  16. package/resources/index.d.mts.map +1 -1
  17. package/resources/index.d.ts +3 -2
  18. package/resources/index.d.ts.map +1 -1
  19. package/resources/index.js +3 -1
  20. package/resources/index.js.map +1 -1
  21. package/resources/index.mjs +1 -0
  22. package/resources/index.mjs.map +1 -1
  23. package/resources/payment-methods.d.mts +202 -54
  24. package/resources/payment-methods.d.mts.map +1 -1
  25. package/resources/payment-methods.d.ts +202 -54
  26. package/resources/payment-methods.d.ts.map +1 -1
  27. package/resources/payments.d.mts +55 -1
  28. package/resources/payments.d.mts.map +1 -1
  29. package/resources/payments.d.ts +55 -1
  30. package/resources/payments.d.ts.map +1 -1
  31. package/resources/payments.js +23 -0
  32. package/resources/payments.js.map +1 -1
  33. package/resources/payments.mjs +23 -0
  34. package/resources/payments.mjs.map +1 -1
  35. package/resources/payout-methods.d.mts +78 -0
  36. package/resources/payout-methods.d.mts.map +1 -0
  37. package/resources/payout-methods.d.ts +78 -0
  38. package/resources/payout-methods.d.ts.map +1 -0
  39. package/resources/payout-methods.js +23 -0
  40. package/resources/payout-methods.js.map +1 -0
  41. package/resources/payout-methods.mjs +19 -0
  42. package/resources/payout-methods.mjs.map +1 -0
  43. package/resources/shared.d.mts +30 -0
  44. package/resources/shared.d.mts.map +1 -1
  45. package/resources/shared.d.ts +30 -0
  46. package/resources/shared.d.ts.map +1 -1
  47. package/resources/withdrawals.d.mts +170 -1
  48. package/resources/withdrawals.d.mts.map +1 -1
  49. package/resources/withdrawals.d.ts +170 -1
  50. package/resources/withdrawals.d.ts.map +1 -1
  51. package/resources/withdrawals.js +38 -0
  52. package/resources/withdrawals.js.map +1 -1
  53. package/resources/withdrawals.mjs +38 -0
  54. package/resources/withdrawals.mjs.map +1 -1
  55. package/src/client.ts +25 -0
  56. package/src/resources/courses.ts +38 -0
  57. package/src/resources/index.ts +11 -0
  58. package/src/resources/payment-methods.ts +236 -54
  59. package/src/resources/payments.ts +105 -0
  60. package/src/resources/payout-methods.ts +105 -0
  61. package/src/resources/shared.ts +34 -0
  62. package/src/resources/withdrawals.ts +247 -0
  63. package/src/version.ts +1 -1
  64. package/version.d.mts +1 -1
  65. package/version.d.ts +1 -1
  66. package/version.js +1 -1
  67. package/version.mjs +1 -1
@@ -53,108 +53,290 @@ export class PaymentMethods extends APIResource {
53
53
  export type PaymentMethodListResponsesCursorPage = CursorPage<PaymentMethodListResponse>;
54
54
 
55
55
  /**
56
- * A stored payment method used to process payments. This could be a credit/debit
57
- * card, bank account, PayPal wallet, etc.
56
+ * A payment method with no additional properties
58
57
  */
59
- export interface PaymentMethodRetrieveResponse {
60
- /**
61
- * The ID of the payment method
62
- */
63
- id: string;
58
+ export type PaymentMethodRetrieveResponse =
59
+ | PaymentMethodRetrieveResponse.BasePaymentMethod
60
+ | PaymentMethodRetrieveResponse.CardPaymentMethod
61
+ | PaymentMethodRetrieveResponse.UsBankAccountPaymentMethod;
64
62
 
63
+ export namespace PaymentMethodRetrieveResponse {
65
64
  /**
66
- * The card data associated with the payment method, if its a debit or credit card.
65
+ * A payment method with no additional properties
67
66
  */
68
- card: PaymentMethodRetrieveResponse.Card | null;
67
+ export interface BasePaymentMethod {
68
+ /**
69
+ * The ID of the payment method
70
+ */
71
+ id: string;
69
72
 
70
- /**
71
- * The date and time the payment method was created
72
- */
73
- created_at: string;
73
+ /**
74
+ * When the payment method was created
75
+ */
76
+ created_at: string;
77
+
78
+ /**
79
+ * The type of the payment method
80
+ */
81
+ payment_method_type: PaymentsAPI.PaymentMethodTypes;
82
+
83
+ /**
84
+ * The typename of this object
85
+ */
86
+ typename: 'BasePaymentMethod';
87
+ }
74
88
 
75
89
  /**
76
- * The payment method type of the payment method
90
+ * The card for the payment method
77
91
  */
78
- payment_method_type: PaymentsAPI.PaymentMethodTypes;
79
- }
92
+ export interface CardPaymentMethod {
93
+ /**
94
+ * The ID of the payment method
95
+ */
96
+ id: string;
97
+
98
+ /**
99
+ * The card details associated with this payment method
100
+ */
101
+ card: CardPaymentMethod.Card;
102
+
103
+ /**
104
+ * When the payment method was created
105
+ */
106
+ created_at: string;
107
+
108
+ /**
109
+ * The type of the payment method
110
+ */
111
+ payment_method_type: PaymentsAPI.PaymentMethodTypes;
112
+
113
+ /**
114
+ * The typename of this object
115
+ */
116
+ typename: 'CardPaymentMethod';
117
+ }
118
+
119
+ export namespace CardPaymentMethod {
120
+ /**
121
+ * The card details associated with this payment method
122
+ */
123
+ export interface Card {
124
+ /**
125
+ * Possible card brands that a payment token can have
126
+ */
127
+ brand: PaymentsAPI.CardBrands | null;
128
+
129
+ /**
130
+ * Card expiration month, like 03 for March.
131
+ */
132
+ exp_month: number | null;
133
+
134
+ /**
135
+ * Card expiration year, like 27 for 2027.
136
+ */
137
+ exp_year: number | null;
138
+
139
+ /**
140
+ * Last four digits of the card.
141
+ */
142
+ last4: string | null;
143
+ }
144
+ }
80
145
 
81
- export namespace PaymentMethodRetrieveResponse {
82
146
  /**
83
- * The card data associated with the payment method, if its a debit or credit card.
147
+ * The bank account for the payment method
84
148
  */
85
- export interface Card {
149
+ export interface UsBankAccountPaymentMethod {
150
+ /**
151
+ * The ID of the payment method
152
+ */
153
+ id: string;
154
+
86
155
  /**
87
- * Possible card brands that a payment token can have
156
+ * When the payment method was created
88
157
  */
89
- brand: PaymentsAPI.CardBrands | null;
158
+ created_at: string;
90
159
 
91
160
  /**
92
- * Card expiration month, like 03 for March.
161
+ * The type of the payment method
93
162
  */
94
- exp_month: number | null;
163
+ payment_method_type: PaymentsAPI.PaymentMethodTypes;
95
164
 
96
165
  /**
97
- * Card expiration year, like 27 for 2027.
166
+ * The typename of this object
98
167
  */
99
- exp_year: number | null;
168
+ typename: 'UsBankAccountPaymentMethod';
100
169
 
101
170
  /**
102
- * Last four digits of the card.
171
+ * The bank details associated with this payment method
103
172
  */
104
- last4: string | null;
173
+ us_bank_account: UsBankAccountPaymentMethod.UsBankAccount;
174
+ }
175
+
176
+ export namespace UsBankAccountPaymentMethod {
177
+ /**
178
+ * The bank details associated with this payment method
179
+ */
180
+ export interface UsBankAccount {
181
+ /**
182
+ * The type of account
183
+ */
184
+ account_type: string;
185
+
186
+ /**
187
+ * The name of the bank
188
+ */
189
+ bank_name: string;
190
+
191
+ /**
192
+ * The last 4 digits of the account number
193
+ */
194
+ last4: string;
195
+ }
105
196
  }
106
197
  }
107
198
 
108
199
  /**
109
- * A stored payment method used to process payments. This could be a credit/debit
110
- * card, bank account, PayPal wallet, etc.
200
+ * A payment method with no additional properties
111
201
  */
112
- export interface PaymentMethodListResponse {
113
- /**
114
- * The ID of the payment method
115
- */
116
- id: string;
202
+ export type PaymentMethodListResponse =
203
+ | PaymentMethodListResponse.BasePaymentMethod
204
+ | PaymentMethodListResponse.CardPaymentMethod
205
+ | PaymentMethodListResponse.UsBankAccountPaymentMethod;
117
206
 
207
+ export namespace PaymentMethodListResponse {
118
208
  /**
119
- * The card data associated with the payment method, if its a debit or credit card.
209
+ * A payment method with no additional properties
120
210
  */
121
- card: PaymentMethodListResponse.Card | null;
211
+ export interface BasePaymentMethod {
212
+ /**
213
+ * The ID of the payment method
214
+ */
215
+ id: string;
122
216
 
123
- /**
124
- * The date and time the payment method was created
125
- */
126
- created_at: string;
217
+ /**
218
+ * When the payment method was created
219
+ */
220
+ created_at: string;
221
+
222
+ /**
223
+ * The type of the payment method
224
+ */
225
+ payment_method_type: PaymentsAPI.PaymentMethodTypes;
226
+
227
+ /**
228
+ * The typename of this object
229
+ */
230
+ typename: 'BasePaymentMethod';
231
+ }
127
232
 
128
233
  /**
129
- * The payment method type of the payment method
234
+ * The card for the payment method
130
235
  */
131
- payment_method_type: PaymentsAPI.PaymentMethodTypes;
132
- }
236
+ export interface CardPaymentMethod {
237
+ /**
238
+ * The ID of the payment method
239
+ */
240
+ id: string;
241
+
242
+ /**
243
+ * The card details associated with this payment method
244
+ */
245
+ card: CardPaymentMethod.Card;
246
+
247
+ /**
248
+ * When the payment method was created
249
+ */
250
+ created_at: string;
251
+
252
+ /**
253
+ * The type of the payment method
254
+ */
255
+ payment_method_type: PaymentsAPI.PaymentMethodTypes;
256
+
257
+ /**
258
+ * The typename of this object
259
+ */
260
+ typename: 'CardPaymentMethod';
261
+ }
262
+
263
+ export namespace CardPaymentMethod {
264
+ /**
265
+ * The card details associated with this payment method
266
+ */
267
+ export interface Card {
268
+ /**
269
+ * Possible card brands that a payment token can have
270
+ */
271
+ brand: PaymentsAPI.CardBrands | null;
272
+
273
+ /**
274
+ * Card expiration month, like 03 for March.
275
+ */
276
+ exp_month: number | null;
277
+
278
+ /**
279
+ * Card expiration year, like 27 for 2027.
280
+ */
281
+ exp_year: number | null;
282
+
283
+ /**
284
+ * Last four digits of the card.
285
+ */
286
+ last4: string | null;
287
+ }
288
+ }
133
289
 
134
- export namespace PaymentMethodListResponse {
135
290
  /**
136
- * The card data associated with the payment method, if its a debit or credit card.
291
+ * The bank account for the payment method
137
292
  */
138
- export interface Card {
293
+ export interface UsBankAccountPaymentMethod {
294
+ /**
295
+ * The ID of the payment method
296
+ */
297
+ id: string;
298
+
139
299
  /**
140
- * Possible card brands that a payment token can have
300
+ * When the payment method was created
141
301
  */
142
- brand: PaymentsAPI.CardBrands | null;
302
+ created_at: string;
143
303
 
144
304
  /**
145
- * Card expiration month, like 03 for March.
305
+ * The type of the payment method
146
306
  */
147
- exp_month: number | null;
307
+ payment_method_type: PaymentsAPI.PaymentMethodTypes;
148
308
 
149
309
  /**
150
- * Card expiration year, like 27 for 2027.
310
+ * The typename of this object
151
311
  */
152
- exp_year: number | null;
312
+ typename: 'UsBankAccountPaymentMethod';
153
313
 
154
314
  /**
155
- * Last four digits of the card.
315
+ * The bank details associated with this payment method
156
316
  */
157
- last4: string | null;
317
+ us_bank_account: UsBankAccountPaymentMethod.UsBankAccount;
318
+ }
319
+
320
+ export namespace UsBankAccountPaymentMethod {
321
+ /**
322
+ * The bank details associated with this payment method
323
+ */
324
+ export interface UsBankAccount {
325
+ /**
326
+ * The type of account
327
+ */
328
+ account_type: string;
329
+
330
+ /**
331
+ * The name of the bank
332
+ */
333
+ bank_name: string;
334
+
335
+ /**
336
+ * The last 4 digits of the account number
337
+ */
338
+ last4: string;
339
+ }
158
340
  }
159
341
  }
160
342
 
@@ -97,6 +97,34 @@ export class Payments extends APIResource {
97
97
  return this._client.getAPIList('/payments', CursorPage<PaymentListResponse>, { query, ...options });
98
98
  }
99
99
 
100
+ /**
101
+ * Lists fees for a payment
102
+ *
103
+ * Required permissions:
104
+ *
105
+ * - `payment:basic:read`
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * // Automatically fetches more pages as needed.
110
+ * for await (const paymentListFeesResponse of client.payments.listFees(
111
+ * 'pay_xxxxxxxxxxxxxx',
112
+ * )) {
113
+ * // ...
114
+ * }
115
+ * ```
116
+ */
117
+ listFees(
118
+ id: string,
119
+ query: PaymentListFeesParams | null | undefined = {},
120
+ options?: RequestOptions,
121
+ ): PagePromise<PaymentListFeesResponsesCursorPage, PaymentListFeesResponse> {
122
+ return this._client.getAPIList(path`/payments/${id}/fees`, CursorPage<PaymentListFeesResponse>, {
123
+ query,
124
+ ...options,
125
+ });
126
+ }
127
+
100
128
  /**
101
129
  * Refunds a payment
102
130
  *
@@ -176,6 +204,8 @@ export class Payments extends APIResource {
176
204
 
177
205
  export type PaymentListResponsesCursorPage = CursorPage<PaymentListResponse>;
178
206
 
207
+ export type PaymentListFeesResponsesCursorPage = CursorPage<PaymentListFeesResponse>;
208
+
179
209
  /**
180
210
  * The reason why a specific payment was billed
181
211
  */
@@ -709,6 +739,61 @@ export namespace PaymentListResponse {
709
739
  }
710
740
  }
711
741
 
742
+ /**
743
+ * Represents a fee related to a payment
744
+ */
745
+ export interface PaymentListFeesResponse {
746
+ /**
747
+ * The value or amount to display for the fee.
748
+ */
749
+ amount: number;
750
+
751
+ /**
752
+ * The currency of the fee.
753
+ */
754
+ currency: Shared.Currency;
755
+
756
+ /**
757
+ * The label to display for the fee.
758
+ */
759
+ name: string;
760
+
761
+ /**
762
+ * The specific origin of the fee, if applicable.
763
+ */
764
+ type:
765
+ | 'stripe_domestic_processing_fee'
766
+ | 'stripe_international_processing_fee'
767
+ | 'stripe_fixed_processing_fee'
768
+ | 'stripe_billing_fee'
769
+ | 'stripe_radar_fee'
770
+ | 'sales_tax_remittance'
771
+ | 'sales_tax_remittance_reversal'
772
+ | 'stripe_sales_tax_fee'
773
+ | 'whop_processing_fee'
774
+ | 'marketplace_affiliate_fee'
775
+ | 'affiliate_fee'
776
+ | 'crypto_fee'
777
+ | 'stripe_standard_processing_fee'
778
+ | 'paypal_fee'
779
+ | 'stripe_payout_fee'
780
+ | 'dispute_fee'
781
+ | 'dispute_alert_fee'
782
+ | 'apple_processing_fee'
783
+ | 'buyer_fee'
784
+ | 'sezzle_processing_fee'
785
+ | 'splitit_processing_fee'
786
+ | 'platform_balance_processing_fee'
787
+ | 'payment_processing_percentage_fee'
788
+ | 'payment_processing_fixed_fee'
789
+ | 'cross_border_percentage_fee'
790
+ | 'fx_percentage_fee'
791
+ | 'orchestration_percentage_fee'
792
+ | 'three_ds_fixed_fee'
793
+ | 'billing_percentage_fee'
794
+ | 'revshare_percentage_fee';
795
+ }
796
+
712
797
  export type PaymentCreateParams =
713
798
  | PaymentCreateParams.CreatePaymentInputWithPlan
714
799
  | PaymentCreateParams.CreatePaymentInputWithPlanID;
@@ -999,6 +1084,23 @@ export interface PaymentListParams extends CursorPageParams {
999
1084
  substatuses?: Array<Shared.FriendlyReceiptStatus> | null;
1000
1085
  }
1001
1086
 
1087
+ export interface PaymentListFeesParams extends CursorPageParams {
1088
+ /**
1089
+ * Returns the elements in the list that come before the specified cursor.
1090
+ */
1091
+ before?: string | null;
1092
+
1093
+ /**
1094
+ * Returns the first _n_ elements from the list.
1095
+ */
1096
+ first?: number | null;
1097
+
1098
+ /**
1099
+ * Returns the last _n_ elements from the list.
1100
+ */
1101
+ last?: number | null;
1102
+ }
1103
+
1002
1104
  export interface PaymentRefundParams {
1003
1105
  /**
1004
1106
  * An amount if the refund is supposed to be partial.
@@ -1012,9 +1114,12 @@ export declare namespace Payments {
1012
1114
  type CardBrands as CardBrands,
1013
1115
  type PaymentMethodTypes as PaymentMethodTypes,
1014
1116
  type PaymentListResponse as PaymentListResponse,
1117
+ type PaymentListFeesResponse as PaymentListFeesResponse,
1015
1118
  type PaymentListResponsesCursorPage as PaymentListResponsesCursorPage,
1119
+ type PaymentListFeesResponsesCursorPage as PaymentListFeesResponsesCursorPage,
1016
1120
  type PaymentCreateParams as PaymentCreateParams,
1017
1121
  type PaymentListParams as PaymentListParams,
1122
+ type PaymentListFeesParams as PaymentListFeesParams,
1018
1123
  type PaymentRefundParams as PaymentRefundParams,
1019
1124
  };
1020
1125
  }
@@ -0,0 +1,105 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class PayoutMethods extends APIResource {
8
+ /**
9
+ * Lists payout destinations for a company
10
+ *
11
+ * Required permissions:
12
+ *
13
+ * - `payout:destination:read`
14
+ */
15
+ list(
16
+ query: PayoutMethodListParams,
17
+ options?: RequestOptions,
18
+ ): PagePromise<PayoutMethodListResponsesCursorPage, PayoutMethodListResponse> {
19
+ return this._client.getAPIList('/payout_methods', CursorPage<PayoutMethodListResponse>, {
20
+ query,
21
+ ...options,
22
+ });
23
+ }
24
+ }
25
+
26
+ export type PayoutMethodListResponsesCursorPage = CursorPage<PayoutMethodListResponse>;
27
+
28
+ /**
29
+ * An object representing an user's setup payout destination.
30
+ */
31
+ export interface PayoutMethodListResponse {
32
+ /**
33
+ * The ID of the payout token
34
+ */
35
+ id: string;
36
+
37
+ /**
38
+ * The currency code of the payout destination. This is the currency that payouts
39
+ * will be made in for this token.
40
+ */
41
+ currency: string;
42
+
43
+ /**
44
+ * The payout destination associated with the payout token
45
+ */
46
+ destination: PayoutMethodListResponse.Destination | null;
47
+
48
+ /**
49
+ * An optional nickname for the payout token to help the user identify it. This is
50
+ * not used by the provider and is only for the user's reference.
51
+ */
52
+ nickname: string | null;
53
+ }
54
+
55
+ export namespace PayoutMethodListResponse {
56
+ /**
57
+ * The payout destination associated with the payout token
58
+ */
59
+ export interface Destination {
60
+ /**
61
+ * The category of the payout destination
62
+ */
63
+ category: 'crypto' | 'rtp' | 'next_day_bank' | 'bank_wire' | 'digital_wallet' | 'unknown';
64
+
65
+ /**
66
+ * The country code of the payout destination
67
+ */
68
+ country_code: string;
69
+
70
+ /**
71
+ * The name of the payer associated with the payout destination
72
+ */
73
+ name: string;
74
+ }
75
+ }
76
+
77
+ export interface PayoutMethodListParams extends CursorPageParams {
78
+ /**
79
+ * The company ID to list payout methods for.
80
+ */
81
+ company_id: string;
82
+
83
+ /**
84
+ * Returns the elements in the list that come before the specified cursor.
85
+ */
86
+ before?: string | null;
87
+
88
+ /**
89
+ * Returns the first _n_ elements from the list.
90
+ */
91
+ first?: number | null;
92
+
93
+ /**
94
+ * Returns the last _n_ elements from the list.
95
+ */
96
+ last?: number | null;
97
+ }
98
+
99
+ export declare namespace PayoutMethods {
100
+ export {
101
+ type PayoutMethodListResponse as PayoutMethodListResponse,
102
+ type PayoutMethodListResponsesCursorPage as PayoutMethodListResponsesCursorPage,
103
+ type PayoutMethodListParams as PayoutMethodListParams,
104
+ };
105
+ }
@@ -796,12 +796,29 @@ export namespace CourseLessonInteraction {
796
796
  */
797
797
  id: string;
798
798
 
799
+ /**
800
+ * The chapter this lesson belongs to
801
+ */
802
+ chapter: Lesson.Chapter;
803
+
799
804
  /**
800
805
  * The title of the lesson
801
806
  */
802
807
  title: string;
803
808
  }
804
809
 
810
+ export namespace Lesson {
811
+ /**
812
+ * The chapter this lesson belongs to
813
+ */
814
+ export interface Chapter {
815
+ /**
816
+ * The ID of the chapter. Looks like chap_XXX
817
+ */
818
+ id: string;
819
+ }
820
+ }
821
+
805
822
  /**
806
823
  * The user who interacted with the lesson
807
824
  */
@@ -863,12 +880,29 @@ export namespace CourseLessonInteractionListItem {
863
880
  */
864
881
  id: string;
865
882
 
883
+ /**
884
+ * The chapter this lesson belongs to
885
+ */
886
+ chapter: Lesson.Chapter;
887
+
866
888
  /**
867
889
  * The title of the lesson
868
890
  */
869
891
  title: string;
870
892
  }
871
893
 
894
+ export namespace Lesson {
895
+ /**
896
+ * The chapter this lesson belongs to
897
+ */
898
+ export interface Chapter {
899
+ /**
900
+ * The ID of the chapter. Looks like chap_XXX
901
+ */
902
+ id: string;
903
+ }
904
+ }
905
+
872
906
  /**
873
907
  * The user who interacted with the lesson
874
908
  */