@whop/sdk 0.0.10 → 0.0.12
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.
- package/CHANGELOG.md +25 -0
- package/client.d.mts +5 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +5 -5
- package/client.d.ts.map +1 -1
- package/client.js +3 -3
- package/client.js.map +1 -1
- package/client.mjs +3 -3
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/checkout-configurations.d.mts +4 -0
- package/resources/checkout-configurations.d.mts.map +1 -1
- package/resources/checkout-configurations.d.ts +4 -0
- package/resources/checkout-configurations.d.ts.map +1 -1
- package/resources/index.d.mts +2 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/invoices.d.mts +20 -0
- package/resources/invoices.d.mts.map +1 -1
- package/resources/invoices.d.ts +20 -0
- package/resources/invoices.d.ts.map +1 -1
- package/resources/payment-methods.d.mts +163 -0
- package/resources/payment-methods.d.mts.map +1 -0
- package/resources/payment-methods.d.ts +163 -0
- package/resources/payment-methods.d.ts.map +1 -0
- package/resources/payment-methods.js +42 -0
- package/resources/payment-methods.js.map +1 -0
- package/resources/payment-methods.mjs +38 -0
- package/resources/payment-methods.mjs.map +1 -0
- package/resources/payments.d.mts +23 -23
- package/resources/payments.d.mts.map +1 -1
- package/resources/payments.d.ts +23 -23
- package/resources/payments.d.ts.map +1 -1
- package/resources/payments.js +6 -4
- package/resources/payments.js.map +1 -1
- package/resources/payments.mjs +6 -4
- package/resources/payments.mjs.map +1 -1
- package/resources/plans.d.mts +8 -0
- package/resources/plans.d.mts.map +1 -1
- package/resources/plans.d.ts +8 -0
- package/resources/plans.d.ts.map +1 -1
- package/resources/products.d.mts +1 -1
- package/resources/products.d.ts +1 -1
- package/resources/setup-intents.d.mts +32 -28
- package/resources/setup-intents.d.mts.map +1 -1
- package/resources/setup-intents.d.ts +32 -28
- package/resources/setup-intents.d.ts.map +1 -1
- package/resources/setup-intents.js +10 -2
- package/resources/setup-intents.js.map +1 -1
- package/resources/setup-intents.mjs +10 -2
- package/resources/setup-intents.mjs.map +1 -1
- package/resources/shared.d.mts +17 -15
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +17 -15
- package/resources/shared.d.ts.map +1 -1
- package/resources/webhooks.d.mts +269 -2
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +269 -2
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs.map +1 -1
- package/resources/withdrawals.d.mts +26 -34
- package/resources/withdrawals.d.mts.map +1 -1
- package/resources/withdrawals.d.ts +26 -34
- package/resources/withdrawals.d.ts.map +1 -1
- package/src/client.ts +19 -15
- package/src/resources/checkout-configurations.ts +5 -0
- package/src/resources/index.ts +9 -7
- package/src/resources/invoices.ts +24 -0
- package/src/resources/payment-methods.ts +213 -0
- package/src/resources/payments.ts +23 -23
- package/src/resources/plans.ts +10 -0
- package/src/resources/products.ts +1 -1
- package/src/resources/setup-intents.ts +32 -28
- package/src/resources/shared.ts +18 -15
- package/src/resources/webhooks.ts +417 -0
- package/src/resources/withdrawals.ts +76 -95
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/payment-tokens.d.mts +0 -157
- package/resources/payment-tokens.d.mts.map +0 -1
- package/resources/payment-tokens.d.ts +0 -157
- package/resources/payment-tokens.d.ts.map +0 -1
- package/resources/payment-tokens.js +0 -34
- package/resources/payment-tokens.js.map +0 -1
- package/resources/payment-tokens.mjs +0 -30
- package/resources/payment-tokens.mjs.map +0 -1
- package/src/resources/payment-tokens.ts +0 -207
package/src/client.ts
CHANGED
|
@@ -193,13 +193,13 @@ import {
|
|
|
193
193
|
Notifications,
|
|
194
194
|
} from './resources/notifications';
|
|
195
195
|
import {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
} from './resources/payment-
|
|
196
|
+
PaymentMethodListParams,
|
|
197
|
+
PaymentMethodListResponse,
|
|
198
|
+
PaymentMethodListResponsesCursorPage,
|
|
199
|
+
PaymentMethodRetrieveParams,
|
|
200
|
+
PaymentMethodRetrieveResponse,
|
|
201
|
+
PaymentMethods,
|
|
202
|
+
} from './resources/payment-methods';
|
|
203
203
|
import {
|
|
204
204
|
BillingReasons,
|
|
205
205
|
CardBrands,
|
|
@@ -323,6 +323,8 @@ import {
|
|
|
323
323
|
SetupIntentSucceededWebhookEvent,
|
|
324
324
|
UnwrapWebhookEvent,
|
|
325
325
|
Webhooks,
|
|
326
|
+
WithdrawalCreatedWebhookEvent,
|
|
327
|
+
WithdrawalUpdatedWebhookEvent,
|
|
326
328
|
} from './resources/webhooks';
|
|
327
329
|
import {
|
|
328
330
|
WithdrawalFeeTypes,
|
|
@@ -1099,7 +1101,7 @@ export class Whop {
|
|
|
1099
1101
|
withdrawals: API.Withdrawals = new API.Withdrawals(this);
|
|
1100
1102
|
accountLinks: API.AccountLinks = new API.AccountLinks(this);
|
|
1101
1103
|
setupIntents: API.SetupIntents = new API.SetupIntents(this);
|
|
1102
|
-
|
|
1104
|
+
paymentMethods: API.PaymentMethods = new API.PaymentMethods(this);
|
|
1103
1105
|
}
|
|
1104
1106
|
|
|
1105
1107
|
Whop.Apps = Apps;
|
|
@@ -1140,7 +1142,7 @@ Whop.Refunds = Refunds;
|
|
|
1140
1142
|
Whop.Withdrawals = Withdrawals;
|
|
1141
1143
|
Whop.AccountLinks = AccountLinks;
|
|
1142
1144
|
Whop.SetupIntents = SetupIntents;
|
|
1143
|
-
Whop.
|
|
1145
|
+
Whop.PaymentMethods = PaymentMethods;
|
|
1144
1146
|
|
|
1145
1147
|
export declare namespace Whop {
|
|
1146
1148
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -1201,6 +1203,8 @@ export declare namespace Whop {
|
|
|
1201
1203
|
type SetupIntentRequiresActionWebhookEvent as SetupIntentRequiresActionWebhookEvent,
|
|
1202
1204
|
type SetupIntentSucceededWebhookEvent as SetupIntentSucceededWebhookEvent,
|
|
1203
1205
|
type SetupIntentCanceledWebhookEvent as SetupIntentCanceledWebhookEvent,
|
|
1206
|
+
type WithdrawalCreatedWebhookEvent as WithdrawalCreatedWebhookEvent,
|
|
1207
|
+
type WithdrawalUpdatedWebhookEvent as WithdrawalUpdatedWebhookEvent,
|
|
1204
1208
|
type CourseLessonInteractionCompletedWebhookEvent as CourseLessonInteractionCompletedWebhookEvent,
|
|
1205
1209
|
type PaymentSucceededWebhookEvent as PaymentSucceededWebhookEvent,
|
|
1206
1210
|
type PaymentFailedWebhookEvent as PaymentFailedWebhookEvent,
|
|
@@ -1511,12 +1515,12 @@ export declare namespace Whop {
|
|
|
1511
1515
|
};
|
|
1512
1516
|
|
|
1513
1517
|
export {
|
|
1514
|
-
|
|
1515
|
-
type
|
|
1516
|
-
type
|
|
1517
|
-
type
|
|
1518
|
-
type
|
|
1519
|
-
type
|
|
1518
|
+
PaymentMethods as PaymentMethods,
|
|
1519
|
+
type PaymentMethodRetrieveResponse as PaymentMethodRetrieveResponse,
|
|
1520
|
+
type PaymentMethodListResponse as PaymentMethodListResponse,
|
|
1521
|
+
type PaymentMethodListResponsesCursorPage as PaymentMethodListResponsesCursorPage,
|
|
1522
|
+
type PaymentMethodRetrieveParams as PaymentMethodRetrieveParams,
|
|
1523
|
+
type PaymentMethodListParams as PaymentMethodListParams,
|
|
1520
1524
|
};
|
|
1521
1525
|
|
|
1522
1526
|
export type AccessLevel = API.AccessLevel;
|
|
@@ -344,6 +344,11 @@ export declare namespace CheckoutConfigurationCreateParams {
|
|
|
344
344
|
*/
|
|
345
345
|
renewal_price?: number | null;
|
|
346
346
|
|
|
347
|
+
/**
|
|
348
|
+
* The number of payments required before pausing the subscription.
|
|
349
|
+
*/
|
|
350
|
+
split_pay_required_payments?: number | null;
|
|
351
|
+
|
|
347
352
|
/**
|
|
348
353
|
* The title of the plan. This will be visible on the product page to customers.
|
|
349
354
|
*/
|
package/src/resources/index.ts
CHANGED
|
@@ -180,13 +180,13 @@ export {
|
|
|
180
180
|
type NotificationCreateParams,
|
|
181
181
|
} from './notifications';
|
|
182
182
|
export {
|
|
183
|
-
|
|
184
|
-
type
|
|
185
|
-
type
|
|
186
|
-
type
|
|
187
|
-
type
|
|
188
|
-
type
|
|
189
|
-
} from './payment-
|
|
183
|
+
PaymentMethods,
|
|
184
|
+
type PaymentMethodRetrieveResponse,
|
|
185
|
+
type PaymentMethodListResponse,
|
|
186
|
+
type PaymentMethodRetrieveParams,
|
|
187
|
+
type PaymentMethodListParams,
|
|
188
|
+
type PaymentMethodListResponsesCursorPage,
|
|
189
|
+
} from './payment-methods';
|
|
190
190
|
export {
|
|
191
191
|
Payments,
|
|
192
192
|
type BillingReasons,
|
|
@@ -301,6 +301,8 @@ export {
|
|
|
301
301
|
type SetupIntentRequiresActionWebhookEvent,
|
|
302
302
|
type SetupIntentSucceededWebhookEvent,
|
|
303
303
|
type SetupIntentCanceledWebhookEvent,
|
|
304
|
+
type WithdrawalCreatedWebhookEvent,
|
|
305
|
+
type WithdrawalUpdatedWebhookEvent,
|
|
304
306
|
type CourseLessonInteractionCompletedWebhookEvent,
|
|
305
307
|
type PaymentSucceededWebhookEvent,
|
|
306
308
|
type PaymentFailedWebhookEvent,
|
|
@@ -131,6 +131,12 @@ export declare namespace InvoiceCreateParams {
|
|
|
131
131
|
*/
|
|
132
132
|
customer_name?: string | null;
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* The payment method ID to use for this invoice. If using charge_automatically,
|
|
136
|
+
* you must provide a payment_method_id.
|
|
137
|
+
*/
|
|
138
|
+
payment_method_id?: string | null;
|
|
139
|
+
|
|
134
140
|
/**
|
|
135
141
|
* The payment token ID to use for this invoice. If using charge_automatically, you
|
|
136
142
|
* must provide a payment_token.
|
|
@@ -309,6 +315,12 @@ export declare namespace InvoiceCreateParams {
|
|
|
309
315
|
*/
|
|
310
316
|
customer_name?: string | null;
|
|
311
317
|
|
|
318
|
+
/**
|
|
319
|
+
* The payment method ID to use for this invoice. If using charge_automatically,
|
|
320
|
+
* you must provide a payment_method_id.
|
|
321
|
+
*/
|
|
322
|
+
payment_method_id?: string | null;
|
|
323
|
+
|
|
312
324
|
/**
|
|
313
325
|
* The payment token ID to use for this invoice. If using charge_automatically, you
|
|
314
326
|
* must provide a payment_token.
|
|
@@ -488,6 +500,12 @@ export declare namespace InvoiceCreateParams {
|
|
|
488
500
|
*/
|
|
489
501
|
customer_name?: string | null;
|
|
490
502
|
|
|
503
|
+
/**
|
|
504
|
+
* The payment method ID to use for this invoice. If using charge_automatically,
|
|
505
|
+
* you must provide a payment_method_id.
|
|
506
|
+
*/
|
|
507
|
+
payment_method_id?: string | null;
|
|
508
|
+
|
|
491
509
|
/**
|
|
492
510
|
* The payment token ID to use for this invoice. If using charge_automatically, you
|
|
493
511
|
* must provide a payment_token.
|
|
@@ -650,6 +668,12 @@ export declare namespace InvoiceCreateParams {
|
|
|
650
668
|
*/
|
|
651
669
|
customer_name?: string | null;
|
|
652
670
|
|
|
671
|
+
/**
|
|
672
|
+
* The payment method ID to use for this invoice. If using charge_automatically,
|
|
673
|
+
* you must provide a payment_method_id.
|
|
674
|
+
*/
|
|
675
|
+
payment_method_id?: string | null;
|
|
676
|
+
|
|
653
677
|
/**
|
|
654
678
|
* The payment token ID to use for this invoice. If using charge_automatically, you
|
|
655
679
|
* must provide a payment_token.
|
|
@@ -0,0 +1,213 @@
|
|
|
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 PaymentMethods extends APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* A payment method is a stored representation of how a customer intends to pay,
|
|
14
|
+
* such as a card, bank account, or digital wallet. It holds the necessary billing
|
|
15
|
+
* details and can be attached to a member for future one-time or recurring
|
|
16
|
+
* charges. This lets you reuse the same payment credentials across multiple
|
|
17
|
+
* payments.
|
|
18
|
+
*
|
|
19
|
+
* Required permissions:
|
|
20
|
+
*
|
|
21
|
+
* - `member:payment_methods:read`
|
|
22
|
+
*/
|
|
23
|
+
retrieve(
|
|
24
|
+
id: string,
|
|
25
|
+
query: PaymentMethodRetrieveParams,
|
|
26
|
+
options?: RequestOptions,
|
|
27
|
+
): APIPromise<PaymentMethodRetrieveResponse> {
|
|
28
|
+
return this._client.get(path`/payment_methods/${id}`, { query, ...options });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A payment method is a stored representation of how a customer intends to pay,
|
|
33
|
+
* such as a card, bank account, or digital wallet. It holds the necessary billing
|
|
34
|
+
* details and can be attached to a member for future one-time or recurring
|
|
35
|
+
* charges. This lets you reuse the same payment credentials across multiple
|
|
36
|
+
* payments.
|
|
37
|
+
*
|
|
38
|
+
* Required permissions:
|
|
39
|
+
*
|
|
40
|
+
* - `member:payment_methods:read`
|
|
41
|
+
*/
|
|
42
|
+
list(
|
|
43
|
+
query: PaymentMethodListParams,
|
|
44
|
+
options?: RequestOptions,
|
|
45
|
+
): PagePromise<PaymentMethodListResponsesCursorPage, PaymentMethodListResponse> {
|
|
46
|
+
return this._client.getAPIList('/payment_methods', CursorPage<PaymentMethodListResponse>, {
|
|
47
|
+
query,
|
|
48
|
+
...options,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type PaymentMethodListResponsesCursorPage = CursorPage<PaymentMethodListResponse>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A stored payment method used to process payments. This could be a credit/debit
|
|
57
|
+
* card, bank account, PayPal wallet, etc.
|
|
58
|
+
*/
|
|
59
|
+
export interface PaymentMethodRetrieveResponse {
|
|
60
|
+
/**
|
|
61
|
+
* The ID of the payment method
|
|
62
|
+
*/
|
|
63
|
+
id: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
67
|
+
*/
|
|
68
|
+
card: PaymentMethodRetrieveResponse.Card | null;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The date and time the payment method was created
|
|
72
|
+
*/
|
|
73
|
+
created_at: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The payment method type of the payment method
|
|
77
|
+
*/
|
|
78
|
+
payment_method_type: PaymentsAPI.PaymentMethodTypes;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export namespace PaymentMethodRetrieveResponse {
|
|
82
|
+
/**
|
|
83
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
84
|
+
*/
|
|
85
|
+
export interface Card {
|
|
86
|
+
/**
|
|
87
|
+
* Possible card brands that a payment token can have
|
|
88
|
+
*/
|
|
89
|
+
brand: PaymentsAPI.CardBrands | null;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Card expiration month, like 03 for March.
|
|
93
|
+
*/
|
|
94
|
+
exp_month: number | null;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Card expiration year, like 27 for 2027.
|
|
98
|
+
*/
|
|
99
|
+
exp_year: number | null;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Last four digits of the card.
|
|
103
|
+
*/
|
|
104
|
+
last4: string | null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A stored payment method used to process payments. This could be a credit/debit
|
|
110
|
+
* card, bank account, PayPal wallet, etc.
|
|
111
|
+
*/
|
|
112
|
+
export interface PaymentMethodListResponse {
|
|
113
|
+
/**
|
|
114
|
+
* The ID of the payment method
|
|
115
|
+
*/
|
|
116
|
+
id: string;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
120
|
+
*/
|
|
121
|
+
card: PaymentMethodListResponse.Card | null;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The date and time the payment method was created
|
|
125
|
+
*/
|
|
126
|
+
created_at: string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The payment method type of the payment method
|
|
130
|
+
*/
|
|
131
|
+
payment_method_type: PaymentsAPI.PaymentMethodTypes;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export namespace PaymentMethodListResponse {
|
|
135
|
+
/**
|
|
136
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
137
|
+
*/
|
|
138
|
+
export interface Card {
|
|
139
|
+
/**
|
|
140
|
+
* Possible card brands that a payment token can have
|
|
141
|
+
*/
|
|
142
|
+
brand: PaymentsAPI.CardBrands | null;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Card expiration month, like 03 for March.
|
|
146
|
+
*/
|
|
147
|
+
exp_month: number | null;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Card expiration year, like 27 for 2027.
|
|
151
|
+
*/
|
|
152
|
+
exp_year: number | null;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Last four digits of the card.
|
|
156
|
+
*/
|
|
157
|
+
last4: string | null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface PaymentMethodRetrieveParams {
|
|
162
|
+
/**
|
|
163
|
+
* The ID of the Member associated with the PaymentMethod
|
|
164
|
+
*/
|
|
165
|
+
member_id: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface PaymentMethodListParams extends CursorPageParams {
|
|
169
|
+
/**
|
|
170
|
+
* The ID of the Member to list payment methods for
|
|
171
|
+
*/
|
|
172
|
+
member_id: string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Returns the elements in the list that come before the specified cursor.
|
|
176
|
+
*/
|
|
177
|
+
before?: string | null;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The minimum creation date to filter by
|
|
181
|
+
*/
|
|
182
|
+
created_after?: string | null;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* The maximum creation date to filter by
|
|
186
|
+
*/
|
|
187
|
+
created_before?: string | null;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The direction of the sort.
|
|
191
|
+
*/
|
|
192
|
+
direction?: Shared.Direction | null;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Returns the first _n_ elements from the list.
|
|
196
|
+
*/
|
|
197
|
+
first?: number | null;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Returns the last _n_ elements from the list.
|
|
201
|
+
*/
|
|
202
|
+
last?: number | null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export declare namespace PaymentMethods {
|
|
206
|
+
export {
|
|
207
|
+
type PaymentMethodRetrieveResponse as PaymentMethodRetrieveResponse,
|
|
208
|
+
type PaymentMethodListResponse as PaymentMethodListResponse,
|
|
209
|
+
type PaymentMethodListResponsesCursorPage as PaymentMethodListResponsesCursorPage,
|
|
210
|
+
type PaymentMethodRetrieveParams as PaymentMethodRetrieveParams,
|
|
211
|
+
type PaymentMethodListParams as PaymentMethodListParams,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
@@ -10,9 +10,11 @@ import { path } from '../internal/utils/path';
|
|
|
10
10
|
|
|
11
11
|
export class Payments extends APIResource {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Charge an existing member off-session using one of their stored payment methods.
|
|
14
|
+
* You can provide an existing plan, or create a new one in-line. This endpoint
|
|
15
|
+
* will respond with a payment object immediately, but the payment is processed
|
|
16
|
+
* asynchronously in the background. Use webhooks to be notified when the payment
|
|
17
|
+
* succeeds or fails.
|
|
16
18
|
*
|
|
17
19
|
* Required permissions:
|
|
18
20
|
*
|
|
@@ -32,7 +34,7 @@ export class Payments extends APIResource {
|
|
|
32
34
|
* const payment = await client.payments.create({
|
|
33
35
|
* company_id: 'biz_xxxxxxxxxxxxxx',
|
|
34
36
|
* member_id: 'mber_xxxxxxxxxxxxx',
|
|
35
|
-
*
|
|
37
|
+
* payment_method_id: 'pmt_xxxxxxxxxxxxxx',
|
|
36
38
|
* plan: { currency: 'usd' },
|
|
37
39
|
* });
|
|
38
40
|
* ```
|
|
@@ -389,14 +391,14 @@ export interface PaymentListResponse {
|
|
|
389
391
|
paid_at: string | null;
|
|
390
392
|
|
|
391
393
|
/**
|
|
392
|
-
* The
|
|
394
|
+
* The payment method used for the payment, if available.
|
|
393
395
|
*/
|
|
394
|
-
|
|
396
|
+
payment_method: PaymentListResponse.PaymentMethod | null;
|
|
395
397
|
|
|
396
398
|
/**
|
|
397
|
-
* The
|
|
399
|
+
* The different types of payment methods that can be used.
|
|
398
400
|
*/
|
|
399
|
-
|
|
401
|
+
payment_method_type: PaymentMethodTypes | null;
|
|
400
402
|
|
|
401
403
|
/**
|
|
402
404
|
* The plan attached to this payment.
|
|
@@ -565,35 +567,33 @@ export namespace PaymentListResponse {
|
|
|
565
567
|
}
|
|
566
568
|
|
|
567
569
|
/**
|
|
568
|
-
* The payment
|
|
570
|
+
* The payment method used for the payment, if available.
|
|
569
571
|
*/
|
|
570
|
-
export interface
|
|
572
|
+
export interface PaymentMethod {
|
|
571
573
|
/**
|
|
572
|
-
* The ID of the payment
|
|
574
|
+
* The ID of the payment method
|
|
573
575
|
*/
|
|
574
576
|
id: string;
|
|
575
577
|
|
|
576
578
|
/**
|
|
577
|
-
* The card data associated with the payment
|
|
578
|
-
* token.
|
|
579
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
579
580
|
*/
|
|
580
|
-
card:
|
|
581
|
+
card: PaymentMethod.Card | null;
|
|
581
582
|
|
|
582
583
|
/**
|
|
583
|
-
* The date and time the payment
|
|
584
|
+
* The date and time the payment method was created
|
|
584
585
|
*/
|
|
585
586
|
created_at: string;
|
|
586
587
|
|
|
587
588
|
/**
|
|
588
|
-
* The payment method type of the payment
|
|
589
|
+
* The payment method type of the payment method
|
|
589
590
|
*/
|
|
590
591
|
payment_method_type: PaymentsAPI.PaymentMethodTypes;
|
|
591
592
|
}
|
|
592
593
|
|
|
593
|
-
export namespace
|
|
594
|
+
export namespace PaymentMethod {
|
|
594
595
|
/**
|
|
595
|
-
* The card data associated with the payment
|
|
596
|
-
* token.
|
|
596
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
597
597
|
*/
|
|
598
598
|
export interface Card {
|
|
599
599
|
/**
|
|
@@ -726,10 +726,10 @@ export declare namespace PaymentCreateParams {
|
|
|
726
726
|
member_id: string;
|
|
727
727
|
|
|
728
728
|
/**
|
|
729
|
-
* The ID of the payment
|
|
729
|
+
* The ID of the payment method to use for the payment. It must be connected to the
|
|
730
730
|
* Member being charged.
|
|
731
731
|
*/
|
|
732
|
-
|
|
732
|
+
payment_method_id: string;
|
|
733
733
|
|
|
734
734
|
/**
|
|
735
735
|
* Pass this object to create a new plan for this payment
|
|
@@ -910,10 +910,10 @@ export declare namespace PaymentCreateParams {
|
|
|
910
910
|
member_id: string;
|
|
911
911
|
|
|
912
912
|
/**
|
|
913
|
-
* The ID of the payment
|
|
913
|
+
* The ID of the payment method to use for the payment. It must be connected to the
|
|
914
914
|
* Member being charged.
|
|
915
915
|
*/
|
|
916
|
-
|
|
916
|
+
payment_method_id: string;
|
|
917
917
|
|
|
918
918
|
/**
|
|
919
919
|
* An ID of an existing plan to use for the payment.
|
package/src/resources/plans.ts
CHANGED
|
@@ -208,6 +208,11 @@ export interface PlanListResponse {
|
|
|
208
208
|
*/
|
|
209
209
|
renewal_price: number;
|
|
210
210
|
|
|
211
|
+
/**
|
|
212
|
+
* The number of payments required before pausing the subscription.
|
|
213
|
+
*/
|
|
214
|
+
split_pay_required_payments: number | null;
|
|
215
|
+
|
|
211
216
|
/**
|
|
212
217
|
* The number of units available for purchase. Only displayed to authorized actors
|
|
213
218
|
*/
|
|
@@ -393,6 +398,11 @@ export interface PlanCreateParams {
|
|
|
393
398
|
*/
|
|
394
399
|
renewal_price?: number | null;
|
|
395
400
|
|
|
401
|
+
/**
|
|
402
|
+
* The number of payments required before pausing the subscription.
|
|
403
|
+
*/
|
|
404
|
+
split_pay_required_payments?: number | null;
|
|
405
|
+
|
|
396
406
|
/**
|
|
397
407
|
* The number of units available for purchase.
|
|
398
408
|
*/
|
|
@@ -10,7 +10,11 @@ import { path } from '../internal/utils/path';
|
|
|
10
10
|
|
|
11
11
|
export class SetupIntents extends APIResource {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* A setup intent is an object used to securely collect and store a member’s
|
|
14
|
+
* payment method for future use without charging them immediately. It handles
|
|
15
|
+
* authentication steps up front so future off-session payments can be completed
|
|
16
|
+
* smoothly. This ensures the payment method is verified and ready for later
|
|
17
|
+
* billing.
|
|
14
18
|
*
|
|
15
19
|
* Required permissions:
|
|
16
20
|
*
|
|
@@ -23,7 +27,11 @@ export class SetupIntents extends APIResource {
|
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
|
-
*
|
|
30
|
+
* A setup intent is an object used to securely collect and store a member’s
|
|
31
|
+
* payment method for future use without charging them immediately. It handles
|
|
32
|
+
* authentication steps up front so future off-session payments can be completed
|
|
33
|
+
* smoothly. This ensures the payment method is verified and ready for later
|
|
34
|
+
* billing.
|
|
27
35
|
*
|
|
28
36
|
* Required permissions:
|
|
29
37
|
*
|
|
@@ -85,9 +93,9 @@ export interface SetupIntent {
|
|
|
85
93
|
metadata: { [key: string]: unknown } | null;
|
|
86
94
|
|
|
87
95
|
/**
|
|
88
|
-
* The payment
|
|
96
|
+
* The payment method created during the setup, if available.
|
|
89
97
|
*/
|
|
90
|
-
|
|
98
|
+
payment_method: SetupIntent.PaymentMethod | null;
|
|
91
99
|
|
|
92
100
|
/**
|
|
93
101
|
* The status of the setup intent
|
|
@@ -159,35 +167,33 @@ export namespace SetupIntent {
|
|
|
159
167
|
}
|
|
160
168
|
|
|
161
169
|
/**
|
|
162
|
-
* The payment
|
|
170
|
+
* The payment method created during the setup, if available.
|
|
163
171
|
*/
|
|
164
|
-
export interface
|
|
172
|
+
export interface PaymentMethod {
|
|
165
173
|
/**
|
|
166
|
-
* The ID of the payment
|
|
174
|
+
* The ID of the payment method
|
|
167
175
|
*/
|
|
168
176
|
id: string;
|
|
169
177
|
|
|
170
178
|
/**
|
|
171
|
-
* The card data associated with the payment
|
|
172
|
-
* token.
|
|
179
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
173
180
|
*/
|
|
174
|
-
card:
|
|
181
|
+
card: PaymentMethod.Card | null;
|
|
175
182
|
|
|
176
183
|
/**
|
|
177
|
-
* The date and time the payment
|
|
184
|
+
* The date and time the payment method was created
|
|
178
185
|
*/
|
|
179
186
|
created_at: string;
|
|
180
187
|
|
|
181
188
|
/**
|
|
182
|
-
* The payment method type of the payment
|
|
189
|
+
* The payment method type of the payment method
|
|
183
190
|
*/
|
|
184
191
|
payment_method_type: PaymentsAPI.PaymentMethodTypes;
|
|
185
192
|
}
|
|
186
193
|
|
|
187
|
-
export namespace
|
|
194
|
+
export namespace PaymentMethod {
|
|
188
195
|
/**
|
|
189
|
-
* The card data associated with the payment
|
|
190
|
-
* token.
|
|
196
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
191
197
|
*/
|
|
192
198
|
export interface Card {
|
|
193
199
|
/**
|
|
@@ -259,9 +265,9 @@ export interface SetupIntentListResponse {
|
|
|
259
265
|
metadata: { [key: string]: unknown } | null;
|
|
260
266
|
|
|
261
267
|
/**
|
|
262
|
-
* The payment
|
|
268
|
+
* The payment method created during the setup, if available.
|
|
263
269
|
*/
|
|
264
|
-
|
|
270
|
+
payment_method: SetupIntentListResponse.PaymentMethod | null;
|
|
265
271
|
|
|
266
272
|
/**
|
|
267
273
|
* The status of the setup intent
|
|
@@ -333,35 +339,33 @@ export namespace SetupIntentListResponse {
|
|
|
333
339
|
}
|
|
334
340
|
|
|
335
341
|
/**
|
|
336
|
-
* The payment
|
|
342
|
+
* The payment method created during the setup, if available.
|
|
337
343
|
*/
|
|
338
|
-
export interface
|
|
344
|
+
export interface PaymentMethod {
|
|
339
345
|
/**
|
|
340
|
-
* The ID of the payment
|
|
346
|
+
* The ID of the payment method
|
|
341
347
|
*/
|
|
342
348
|
id: string;
|
|
343
349
|
|
|
344
350
|
/**
|
|
345
|
-
* The card data associated with the payment
|
|
346
|
-
* token.
|
|
351
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
347
352
|
*/
|
|
348
|
-
card:
|
|
353
|
+
card: PaymentMethod.Card | null;
|
|
349
354
|
|
|
350
355
|
/**
|
|
351
|
-
* The date and time the payment
|
|
356
|
+
* The date and time the payment method was created
|
|
352
357
|
*/
|
|
353
358
|
created_at: string;
|
|
354
359
|
|
|
355
360
|
/**
|
|
356
|
-
* The payment method type of the payment
|
|
361
|
+
* The payment method type of the payment method
|
|
357
362
|
*/
|
|
358
363
|
payment_method_type: PaymentsAPI.PaymentMethodTypes;
|
|
359
364
|
}
|
|
360
365
|
|
|
361
|
-
export namespace
|
|
366
|
+
export namespace PaymentMethod {
|
|
362
367
|
/**
|
|
363
|
-
* The card data associated with the payment
|
|
364
|
-
* token.
|
|
368
|
+
* The card data associated with the payment method, if its a debit or credit card.
|
|
365
369
|
*/
|
|
366
370
|
export interface Card {
|
|
367
371
|
/**
|