@whop/sdk 0.0.20 → 0.0.22

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 (95) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/LICENSE +1 -1
  3. package/README.md +12 -1
  4. package/client.d.mts +13 -4
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +13 -4
  7. package/client.d.ts.map +1 -1
  8. package/client.js +9 -0
  9. package/client.js.map +1 -1
  10. package/client.mjs +9 -0
  11. package/client.mjs.map +1 -1
  12. package/package.json +1 -1
  13. package/resources/index.d.mts +5 -2
  14. package/resources/index.d.mts.map +1 -1
  15. package/resources/index.d.ts +5 -2
  16. package/resources/index.d.ts.map +1 -1
  17. package/resources/index.js +7 -1
  18. package/resources/index.js.map +1 -1
  19. package/resources/index.mjs +3 -0
  20. package/resources/index.mjs.map +1 -1
  21. package/resources/leads.d.mts +489 -0
  22. package/resources/leads.d.mts.map +1 -0
  23. package/resources/leads.d.ts +489 -0
  24. package/resources/leads.d.ts.map +1 -0
  25. package/resources/leads.js +94 -0
  26. package/resources/leads.js.map +1 -0
  27. package/resources/leads.mjs +90 -0
  28. package/resources/leads.mjs.map +1 -0
  29. package/resources/ledger-accounts.d.mts +25 -0
  30. package/resources/ledger-accounts.d.mts.map +1 -1
  31. package/resources/ledger-accounts.d.ts +25 -0
  32. package/resources/ledger-accounts.d.ts.map +1 -1
  33. package/resources/payment-methods.d.mts +17 -9
  34. package/resources/payment-methods.d.mts.map +1 -1
  35. package/resources/payment-methods.d.ts +17 -9
  36. package/resources/payment-methods.d.ts.map +1 -1
  37. package/resources/payment-methods.js +3 -3
  38. package/resources/payment-methods.js.map +1 -1
  39. package/resources/payment-methods.mjs +3 -3
  40. package/resources/payment-methods.mjs.map +1 -1
  41. package/resources/payments.d.mts +15 -3
  42. package/resources/payments.d.mts.map +1 -1
  43. package/resources/payments.d.ts +15 -3
  44. package/resources/payments.d.ts.map +1 -1
  45. package/resources/payout-methods.d.mts +86 -1
  46. package/resources/payout-methods.d.mts.map +1 -1
  47. package/resources/payout-methods.d.ts +86 -1
  48. package/resources/payout-methods.d.ts.map +1 -1
  49. package/resources/payout-methods.js +11 -0
  50. package/resources/payout-methods.js.map +1 -1
  51. package/resources/payout-methods.mjs +11 -0
  52. package/resources/payout-methods.mjs.map +1 -1
  53. package/resources/shared.d.mts +3 -3
  54. package/resources/shared.d.mts.map +1 -1
  55. package/resources/shared.d.ts +3 -3
  56. package/resources/shared.d.ts.map +1 -1
  57. package/resources/support-channels.d.mts +1 -1
  58. package/resources/support-channels.d.ts +1 -1
  59. package/resources/topups.d.mts +79 -0
  60. package/resources/topups.d.mts.map +1 -0
  61. package/resources/topups.d.ts +79 -0
  62. package/resources/topups.d.ts.map +1 -0
  63. package/resources/topups.js +29 -0
  64. package/resources/topups.js.map +1 -0
  65. package/resources/topups.mjs +25 -0
  66. package/resources/topups.mjs.map +1 -0
  67. package/resources/verifications.d.mts +38 -0
  68. package/resources/verifications.d.mts.map +1 -0
  69. package/resources/verifications.d.ts +38 -0
  70. package/resources/verifications.d.ts.map +1 -0
  71. package/resources/verifications.js +20 -0
  72. package/resources/verifications.js.map +1 -0
  73. package/resources/verifications.mjs +16 -0
  74. package/resources/verifications.mjs.map +1 -0
  75. package/resources/webhooks.d.mts +153 -2
  76. package/resources/webhooks.d.mts.map +1 -1
  77. package/resources/webhooks.d.ts +153 -2
  78. package/resources/webhooks.d.ts.map +1 -1
  79. package/src/client.ts +50 -0
  80. package/src/resources/index.ts +17 -0
  81. package/src/resources/leads.ts +583 -0
  82. package/src/resources/ledger-accounts.ts +63 -0
  83. package/src/resources/payment-methods.ts +19 -9
  84. package/src/resources/payments.ts +14 -3
  85. package/src/resources/payout-methods.ts +103 -0
  86. package/src/resources/shared.ts +4 -3
  87. package/src/resources/support-channels.ts +1 -1
  88. package/src/resources/topups.ts +95 -0
  89. package/src/resources/verifications.ts +81 -0
  90. package/src/resources/webhooks.ts +220 -1
  91. package/src/version.ts +1 -1
  92. package/version.d.mts +1 -1
  93. package/version.d.ts +1 -1
  94. package/version.js +1 -1
  95. package/version.mjs +1 -1
@@ -14,7 +14,7 @@ export class PaymentMethods extends APIResource {
14
14
  * such as a card, bank account, or digital wallet. It holds the necessary billing
15
15
  * details and can be attached to a member for future one-time or recurring
16
16
  * charges. This lets you reuse the same payment credentials across multiple
17
- * payments.
17
+ * payments. You must provide exactly one of company_id or member_id.
18
18
  *
19
19
  * Required permissions:
20
20
  *
@@ -22,7 +22,7 @@ export class PaymentMethods extends APIResource {
22
22
  */
23
23
  retrieve(
24
24
  id: string,
25
- query: PaymentMethodRetrieveParams,
25
+ query: PaymentMethodRetrieveParams | null | undefined = {},
26
26
  options?: RequestOptions,
27
27
  ): APIPromise<PaymentMethodRetrieveResponse> {
28
28
  return this._client.get(path`/payment_methods/${id}`, { query, ...options });
@@ -40,7 +40,7 @@ export class PaymentMethods extends APIResource {
40
40
  * - `member:payment_methods:read`
41
41
  */
42
42
  list(
43
- query: PaymentMethodListParams,
43
+ query: PaymentMethodListParams | null | undefined = {},
44
44
  options?: RequestOptions,
45
45
  ): PagePromise<PaymentMethodListResponsesCursorPage, PaymentMethodListResponse> {
46
46
  return this._client.getAPIList('/payment_methods', CursorPage<PaymentMethodListResponse>, {
@@ -650,22 +650,27 @@ export namespace PaymentMethodListResponse {
650
650
 
651
651
  export interface PaymentMethodRetrieveParams {
652
652
  /**
653
- * The ID of the Member associated with the PaymentMethod
653
+ * The ID of the Company. Provide either this or member_id (not both).
654
654
  */
655
- member_id: string;
656
- }
655
+ company_id?: string | null;
657
656
 
658
- export interface PaymentMethodListParams extends CursorPageParams {
659
657
  /**
660
- * The ID of the Member to list payment methods for
658
+ * The ID of the Member. Provide either this or company_id (not both).
661
659
  */
662
- member_id: string;
660
+ member_id?: string | null;
661
+ }
663
662
 
663
+ export interface PaymentMethodListParams extends CursorPageParams {
664
664
  /**
665
665
  * Returns the elements in the list that come before the specified cursor.
666
666
  */
667
667
  before?: string | null;
668
668
 
669
+ /**
670
+ * The ID of the Company. Provide either this or member_id (not both).
671
+ */
672
+ company_id?: string | null;
673
+
669
674
  /**
670
675
  * The minimum creation date to filter by
671
676
  */
@@ -690,6 +695,11 @@ export interface PaymentMethodListParams extends CursorPageParams {
690
695
  * Returns the last _n_ elements from the list.
691
696
  */
692
697
  last?: number | null;
698
+
699
+ /**
700
+ * The ID of the Member to list payment methods for
701
+ */
702
+ member_id?: string | null;
693
703
  }
694
704
 
695
705
  export declare namespace PaymentMethods {
@@ -410,8 +410,8 @@ export interface PaymentListResponse {
410
410
  membership: PaymentListResponse.Membership | null;
411
411
 
412
412
  /**
413
- * The custom metadata stored on this payment. This will be copied the checkout
414
- * configuration for which this payment was made
413
+ * The custom metadata stored on this payment. This will be copied over to the
414
+ * checkout configuration for which this payment was made
415
415
  */
416
416
  metadata: { [key: string]: unknown } | null;
417
417
 
@@ -791,7 +791,8 @@ export interface PaymentListFeesResponse {
791
791
  | 'orchestration_percentage_fee'
792
792
  | 'three_ds_fixed_fee'
793
793
  | 'billing_percentage_fee'
794
- | 'revshare_percentage_fee';
794
+ | 'revshare_percentage_fee'
795
+ | 'application_fee';
795
796
  }
796
797
 
797
798
  export type PaymentCreateParams =
@@ -820,6 +821,11 @@ export declare namespace PaymentCreateParams {
820
821
  * Pass this object to create a new plan for this payment
821
822
  */
822
823
  plan: CreatePaymentInputWithPlan.Plan;
824
+
825
+ /**
826
+ * Custom metadata to attach to the payment.
827
+ */
828
+ metadata?: { [key: string]: unknown } | null;
823
829
  }
824
830
 
825
831
  export namespace CreatePaymentInputWithPlan {
@@ -1004,6 +1010,11 @@ export declare namespace PaymentCreateParams {
1004
1010
  * An ID of an existing plan to use for the payment.
1005
1011
  */
1006
1012
  plan_id: string;
1013
+
1014
+ /**
1015
+ * Custom metadata to attach to the payment.
1016
+ */
1017
+ metadata?: { [key: string]: unknown } | null;
1007
1018
  }
1008
1019
  }
1009
1020
 
@@ -1,10 +1,23 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
4
5
  import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
5
6
  import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
6
8
 
7
9
  export class PayoutMethods extends APIResource {
10
+ /**
11
+ * Retrieves a payout method by ID
12
+ *
13
+ * Required permissions:
14
+ *
15
+ * - `payout:destination:read`
16
+ */
17
+ retrieve(id: string, options?: RequestOptions): APIPromise<PayoutMethodRetrieveResponse> {
18
+ return this._client.get(path`/payout_methods/${id}`, options);
19
+ }
20
+
8
21
  /**
9
22
  * Lists payout destinations for a company
10
23
  *
@@ -25,6 +38,75 @@ export class PayoutMethods extends APIResource {
25
38
 
26
39
  export type PayoutMethodListResponsesCursorPage = CursorPage<PayoutMethodListResponse>;
27
40
 
41
+ /**
42
+ * An object representing an user's setup payout destination.
43
+ */
44
+ export interface PayoutMethodRetrieveResponse {
45
+ /**
46
+ * The ID of the payout token
47
+ */
48
+ id: string;
49
+
50
+ /**
51
+ * The company associated with the payout token
52
+ */
53
+ company: PayoutMethodRetrieveResponse.Company | null;
54
+
55
+ /**
56
+ * The currency code of the payout destination. This is the currency that payouts
57
+ * will be made in for this token.
58
+ */
59
+ currency: string;
60
+
61
+ /**
62
+ * The payout destination associated with the payout token
63
+ */
64
+ destination: PayoutMethodRetrieveResponse.Destination | null;
65
+
66
+ /**
67
+ * Whether this payout token is the default for the payout account
68
+ */
69
+ is_default: boolean;
70
+
71
+ /**
72
+ * An optional nickname for the payout token to help the user identify it. This is
73
+ * not used by the provider and is only for the user's reference.
74
+ */
75
+ nickname: string | null;
76
+ }
77
+
78
+ export namespace PayoutMethodRetrieveResponse {
79
+ /**
80
+ * The company associated with the payout token
81
+ */
82
+ export interface Company {
83
+ /**
84
+ * The ID (tag) of the company.
85
+ */
86
+ id: string;
87
+ }
88
+
89
+ /**
90
+ * The payout destination associated with the payout token
91
+ */
92
+ export interface Destination {
93
+ /**
94
+ * The category of the payout destination
95
+ */
96
+ category: 'crypto' | 'rtp' | 'next_day_bank' | 'bank_wire' | 'digital_wallet' | 'unknown';
97
+
98
+ /**
99
+ * The country code of the payout destination
100
+ */
101
+ country_code: string;
102
+
103
+ /**
104
+ * The name of the payer associated with the payout destination
105
+ */
106
+ name: string;
107
+ }
108
+ }
109
+
28
110
  /**
29
111
  * An object representing an user's setup payout destination.
30
112
  */
@@ -34,6 +116,11 @@ export interface PayoutMethodListResponse {
34
116
  */
35
117
  id: string;
36
118
 
119
+ /**
120
+ * The company associated with the payout token
121
+ */
122
+ company: PayoutMethodListResponse.Company | null;
123
+
37
124
  /**
38
125
  * The currency code of the payout destination. This is the currency that payouts
39
126
  * will be made in for this token.
@@ -45,6 +132,11 @@ export interface PayoutMethodListResponse {
45
132
  */
46
133
  destination: PayoutMethodListResponse.Destination | null;
47
134
 
135
+ /**
136
+ * Whether this payout token is the default for the payout account
137
+ */
138
+ is_default: boolean;
139
+
48
140
  /**
49
141
  * An optional nickname for the payout token to help the user identify it. This is
50
142
  * not used by the provider and is only for the user's reference.
@@ -53,6 +145,16 @@ export interface PayoutMethodListResponse {
53
145
  }
54
146
 
55
147
  export namespace PayoutMethodListResponse {
148
+ /**
149
+ * The company associated with the payout token
150
+ */
151
+ export interface Company {
152
+ /**
153
+ * The ID (tag) of the company.
154
+ */
155
+ id: string;
156
+ }
157
+
56
158
  /**
57
159
  * The payout destination associated with the payout token
58
160
  */
@@ -98,6 +200,7 @@ export interface PayoutMethodListParams extends CursorPageParams {
98
200
 
99
201
  export declare namespace PayoutMethods {
100
202
  export {
203
+ type PayoutMethodRetrieveResponse as PayoutMethodRetrieveResponse,
101
204
  type PayoutMethodListResponse as PayoutMethodListResponse,
102
205
  type PayoutMethodListResponsesCursorPage as PayoutMethodListResponsesCursorPage,
103
206
  type PayoutMethodListParams as PayoutMethodListParams,
@@ -1951,7 +1951,8 @@ export type MembershipStatus =
1951
1951
  | 'canceled'
1952
1952
  | 'expired'
1953
1953
  | 'unresolved'
1954
- | 'drafted';
1954
+ | 'drafted'
1955
+ | 'canceling';
1955
1956
 
1956
1957
  /**
1957
1958
  * Represents a message in a DM channel
@@ -2207,8 +2208,8 @@ export interface Payment {
2207
2208
  membership: Payment.Membership | null;
2208
2209
 
2209
2210
  /**
2210
- * The custom metadata stored on this payment. This will be copied the checkout
2211
- * configuration for which this payment was made
2211
+ * The custom metadata stored on this payment. This will be copied over to the
2212
+ * checkout configuration for which this payment was made
2212
2213
  */
2213
2214
  metadata: { [key: string]: unknown } | null;
2214
2215
 
@@ -139,7 +139,7 @@ export interface SupportChannelCreateParams {
139
139
  company_id: string;
140
140
 
141
141
  /**
142
- * The ID of the user to create the support chat for
142
+ * The ID (user_xxx) or username of the user to create the support chat for
143
143
  */
144
144
  user_id: string;
145
145
  }
@@ -0,0 +1,95 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as Shared from './shared';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { RequestOptions } from '../internal/request-options';
7
+
8
+ export class Topups extends APIResource {
9
+ /**
10
+ * Add funds to your platform balance by charging a stored payment method.
11
+ *
12
+ * Required permissions:
13
+ *
14
+ * - `payment:charge`
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const topup = await client.topups.create({
19
+ * amount: 6.9,
20
+ * company_id: 'biz_xxxxxxxxxxxxxx',
21
+ * currency: 'usd',
22
+ * payment_method_id: 'pmt_xxxxxxxxxxxxxx',
23
+ * });
24
+ * ```
25
+ */
26
+ create(body: TopupCreateParams, options?: RequestOptions): APIPromise<TopupCreateResponse> {
27
+ return this._client.post('/topups', { body, ...options });
28
+ }
29
+ }
30
+
31
+ /**
32
+ * An object representing a receipt for a membership.
33
+ */
34
+ export interface TopupCreateResponse {
35
+ /**
36
+ * The payment ID
37
+ */
38
+ id: string;
39
+
40
+ /**
41
+ * The datetime the payment was created
42
+ */
43
+ created_at: string;
44
+
45
+ /**
46
+ * The available currencies on the platform
47
+ */
48
+ currency: Shared.Currency | null;
49
+
50
+ /**
51
+ * If the payment failed, the reason for the failure.
52
+ */
53
+ failure_message: string | null;
54
+
55
+ /**
56
+ * The datetime the payment was paid
57
+ */
58
+ paid_at: string | null;
59
+
60
+ /**
61
+ * The status of a receipt
62
+ */
63
+ status: Shared.ReceiptStatus | null;
64
+
65
+ /**
66
+ * The total to show to the creator (excluding buyer fees).
67
+ */
68
+ total: number | null;
69
+ }
70
+
71
+ export interface TopupCreateParams {
72
+ /**
73
+ * The amount to add to the balance.
74
+ */
75
+ amount: number;
76
+
77
+ /**
78
+ * The ID of the company to add funds to.
79
+ */
80
+ company_id: string;
81
+
82
+ /**
83
+ * The currency of the top-up.
84
+ */
85
+ currency: Shared.Currency;
86
+
87
+ /**
88
+ * The ID of the payment method to charge for the top-up.
89
+ */
90
+ payment_method_id: string;
91
+ }
92
+
93
+ export declare namespace Topups {
94
+ export { type TopupCreateResponse as TopupCreateResponse, type TopupCreateParams as TopupCreateParams };
95
+ }
@@ -0,0 +1,81 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
7
+
8
+ export class Verifications extends APIResource {
9
+ /**
10
+ * Retrieves a verification by ID
11
+ *
12
+ * Required permissions:
13
+ *
14
+ * - `payout:account:read`
15
+ */
16
+ retrieve(id: string, options?: RequestOptions): APIPromise<VerificationRetrieveResponse> {
17
+ return this._client.get(path`/verifications/${id}`, options);
18
+ }
19
+ }
20
+
21
+ /**
22
+ * An object representing an identity verification session
23
+ */
24
+ export interface VerificationRetrieveResponse {
25
+ /**
26
+ * A unique identifier for the verification.
27
+ */
28
+ id: string;
29
+
30
+ /**
31
+ * An error code for a verification attempt.
32
+ */
33
+ last_error_code:
34
+ | 'abandoned'
35
+ | 'consent_declined'
36
+ | 'country_not_supported'
37
+ | 'device_not_supported'
38
+ | 'document_expired'
39
+ | 'document_type_not_supported'
40
+ | 'document_unverified_other'
41
+ | 'email_unverified_other'
42
+ | 'email_verification_declined'
43
+ | 'id_number_insufficient_document_data'
44
+ | 'id_number_mismatch'
45
+ | 'id_number_unverified_other'
46
+ | 'phone_unverified_other'
47
+ | 'phone_verification_declined'
48
+ | 'selfie_document_missing_photo'
49
+ | 'selfie_face_mismatch'
50
+ | 'selfie_manipulated'
51
+ | 'selfie_unverified_other'
52
+ | 'under_supported_age'
53
+ | null;
54
+
55
+ /**
56
+ * The last error reason that occurred during the verification.
57
+ */
58
+ last_error_reason: string | null;
59
+
60
+ /**
61
+ * The status of the verification.
62
+ */
63
+ status:
64
+ | 'requires_input'
65
+ | 'processing'
66
+ | 'verified'
67
+ | 'canceled'
68
+ | 'created'
69
+ | 'started'
70
+ | 'submitted'
71
+ | 'approved'
72
+ | 'declined'
73
+ | 'resubmission_requested'
74
+ | 'expired'
75
+ | 'abandoned'
76
+ | 'review';
77
+ }
78
+
79
+ export declare namespace Verifications {
80
+ export { type VerificationRetrieveResponse as VerificationRetrieveResponse };
81
+ }