@whop/sdk 0.0.35 → 0.0.37

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 (102) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/client.d.mts +6 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -6
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs +1 -1
  8. package/client.mjs.map +1 -1
  9. package/internal/utils/env.js +2 -2
  10. package/internal/utils/env.js.map +1 -1
  11. package/internal/utils/env.mjs +2 -2
  12. package/internal/utils/env.mjs.map +1 -1
  13. package/package.json +1 -1
  14. package/resources/affiliates/affiliates.d.mts +20 -12
  15. package/resources/affiliates/affiliates.d.mts.map +1 -1
  16. package/resources/affiliates/affiliates.d.ts +20 -12
  17. package/resources/affiliates/affiliates.d.ts.map +1 -1
  18. package/resources/affiliates/affiliates.js.map +1 -1
  19. package/resources/affiliates/affiliates.mjs.map +1 -1
  20. package/resources/affiliates/overrides.d.mts +16 -8
  21. package/resources/affiliates/overrides.d.mts.map +1 -1
  22. package/resources/affiliates/overrides.d.ts +16 -8
  23. package/resources/affiliates/overrides.d.ts.map +1 -1
  24. package/resources/apps.d.mts +26 -0
  25. package/resources/apps.d.mts.map +1 -1
  26. package/resources/apps.d.ts +26 -0
  27. package/resources/apps.d.ts.map +1 -1
  28. package/resources/checkout-configurations.d.mts +70 -0
  29. package/resources/checkout-configurations.d.mts.map +1 -1
  30. package/resources/checkout-configurations.d.ts +70 -0
  31. package/resources/checkout-configurations.d.ts.map +1 -1
  32. package/resources/checkout-configurations.js.map +1 -1
  33. package/resources/checkout-configurations.mjs.map +1 -1
  34. package/resources/companies.d.mts +19 -0
  35. package/resources/companies.d.mts.map +1 -1
  36. package/resources/companies.d.ts +19 -0
  37. package/resources/companies.d.ts.map +1 -1
  38. package/resources/index.d.mts +3 -3
  39. package/resources/index.d.mts.map +1 -1
  40. package/resources/index.d.ts +3 -3
  41. package/resources/index.d.ts.map +1 -1
  42. package/resources/index.js.map +1 -1
  43. package/resources/index.mjs.map +1 -1
  44. package/resources/invoices.d.mts +472 -329
  45. package/resources/invoices.d.mts.map +1 -1
  46. package/resources/invoices.d.ts +472 -329
  47. package/resources/invoices.d.ts.map +1 -1
  48. package/resources/invoices.js +90 -2
  49. package/resources/invoices.js.map +1 -1
  50. package/resources/invoices.mjs +90 -2
  51. package/resources/invoices.mjs.map +1 -1
  52. package/resources/memberships.d.mts +1 -1
  53. package/resources/memberships.d.mts.map +1 -1
  54. package/resources/memberships.d.ts +1 -1
  55. package/resources/memberships.d.ts.map +1 -1
  56. package/resources/payments.d.mts +21 -2
  57. package/resources/payments.d.mts.map +1 -1
  58. package/resources/payments.d.ts +21 -2
  59. package/resources/payments.d.ts.map +1 -1
  60. package/resources/plans.d.mts +56 -1
  61. package/resources/plans.d.mts.map +1 -1
  62. package/resources/plans.d.ts +56 -1
  63. package/resources/plans.d.ts.map +1 -1
  64. package/resources/plans.js.map +1 -1
  65. package/resources/plans.mjs.map +1 -1
  66. package/resources/products.d.mts +2 -2
  67. package/resources/products.d.ts +2 -2
  68. package/resources/refunds.d.mts +1 -1
  69. package/resources/refunds.d.mts.map +1 -1
  70. package/resources/refunds.d.ts +1 -1
  71. package/resources/refunds.d.ts.map +1 -1
  72. package/resources/shared.d.mts +54 -5
  73. package/resources/shared.d.mts.map +1 -1
  74. package/resources/shared.d.ts +54 -5
  75. package/resources/shared.d.ts.map +1 -1
  76. package/resources/webhooks.d.mts +653 -3
  77. package/resources/webhooks.d.mts.map +1 -1
  78. package/resources/webhooks.d.ts +653 -3
  79. package/resources/webhooks.d.ts.map +1 -1
  80. package/resources/webhooks.js.map +1 -1
  81. package/resources/webhooks.mjs.map +1 -1
  82. package/src/client.ts +28 -1
  83. package/src/internal/utils/env.ts +2 -2
  84. package/src/resources/affiliates/affiliates.ts +20 -12
  85. package/src/resources/affiliates/overrides.ts +16 -8
  86. package/src/resources/apps.ts +31 -0
  87. package/src/resources/checkout-configurations.ts +82 -0
  88. package/src/resources/companies.ts +23 -0
  89. package/src/resources/index.ts +11 -0
  90. package/src/resources/invoices.ts +656 -366
  91. package/src/resources/memberships.ts +1 -1
  92. package/src/resources/payments.ts +31 -1
  93. package/src/resources/plans.ts +67 -0
  94. package/src/resources/products.ts +2 -2
  95. package/src/resources/refunds.ts +3 -1
  96. package/src/resources/shared.ts +64 -5
  97. package/src/resources/webhooks.ts +818 -0
  98. package/src/version.ts +1 -1
  99. package/version.d.mts +1 -1
  100. package/version.d.ts +1 -1
  101. package/version.js +1 -1
  102. package/version.mjs +1 -1
@@ -1,4 +1,5 @@
1
1
  import { APIResource } from "../core/resource.mjs";
2
+ import * as InvoicesAPI from "./invoices.mjs";
2
3
  import * as PaymentsAPI from "./payments.mjs";
3
4
  import * as Shared from "./shared.mjs";
4
5
  import { InvoiceListItemsCursorPage } from "./shared.mjs";
@@ -22,8 +23,6 @@ export declare class Invoices extends APIResource {
22
23
  * const invoice = await client.invoices.create({
23
24
  * collection_method: 'send_invoice',
24
25
  * company_id: 'biz_xxxxxxxxxxxxxx',
25
- * due_date: '2023-12-01T05:00:00.401Z',
26
- * member_id: 'mber_xxxxxxxxxxxxx',
27
26
  * plan: {},
28
27
  * product: { title: 'title' },
29
28
  * });
@@ -36,8 +35,30 @@ export declare class Invoices extends APIResource {
36
35
  * Required permissions:
37
36
  *
38
37
  * - `invoice:basic:read`
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const invoice = await client.invoices.retrieve(
42
+ * 'inv_xxxxxxxxxxxxxx',
43
+ * );
44
+ * ```
39
45
  */
40
46
  retrieve(id: string, options?: RequestOptions): APIPromise<Shared.Invoice>;
47
+ /**
48
+ * Update a draft invoice's details.
49
+ *
50
+ * Required permissions:
51
+ *
52
+ * - `invoice:update`
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const invoice = await client.invoices.update(
57
+ * 'inv_xxxxxxxxxxxxxx',
58
+ * );
59
+ * ```
60
+ */
61
+ update(id: string, body?: InvoiceUpdateParams | null | undefined, options?: RequestOptions): APIPromise<Shared.Invoice>;
41
62
  /**
42
63
  * Returns a paginated list of invoices for a company, with optional filtering by
43
64
  * product, status, collection method, and creation date.
@@ -45,8 +66,61 @@ export declare class Invoices extends APIResource {
45
66
  * Required permissions:
46
67
  *
47
68
  * - `invoice:basic:read`
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * // Automatically fetches more pages as needed.
73
+ * for await (const invoiceListItem of client.invoices.list()) {
74
+ * // ...
75
+ * }
76
+ * ```
48
77
  */
49
78
  list(query?: InvoiceListParams | null | undefined, options?: RequestOptions): PagePromise<InvoiceListItemsCursorPage, Shared.InvoiceListItem>;
79
+ /**
80
+ * Delete a draft invoice.
81
+ *
82
+ * Required permissions:
83
+ *
84
+ * - `invoice:update`
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const invoice = await client.invoices.delete(
89
+ * 'inv_xxxxxxxxxxxxxx',
90
+ * );
91
+ * ```
92
+ */
93
+ delete(id: string, options?: RequestOptions): APIPromise<InvoiceDeleteResponse>;
94
+ /**
95
+ * Mark an open invoice as paid when payment was collected outside of Whop.
96
+ *
97
+ * Required permissions:
98
+ *
99
+ * - `invoice:update`
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * const response = await client.invoices.markPaid(
104
+ * 'inv_xxxxxxxxxxxxxx',
105
+ * );
106
+ * ```
107
+ */
108
+ markPaid(id: string, options?: RequestOptions): APIPromise<InvoiceMarkPaidResponse>;
109
+ /**
110
+ * Mark an open invoice as uncollectible when payment is not expected.
111
+ *
112
+ * Required permissions:
113
+ *
114
+ * - `invoice:update`
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const response = await client.invoices.markUncollectible(
119
+ * 'inv_xxxxxxxxxxxxxx',
120
+ * );
121
+ * ```
122
+ */
123
+ markUncollectible(id: string, options?: RequestOptions): APIPromise<InvoiceMarkUncollectibleResponse>;
50
124
  /**
51
125
  * Void an open invoice so it can no longer be paid. Voiding is permanent and
52
126
  * cannot be undone.
@@ -54,16 +128,39 @@ export declare class Invoices extends APIResource {
54
128
  * Required permissions:
55
129
  *
56
130
  * - `invoice:update`
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * const response = await client.invoices.void(
135
+ * 'inv_xxxxxxxxxxxxxx',
136
+ * );
137
+ * ```
57
138
  */
58
139
  void(id: string, options?: RequestOptions): APIPromise<InvoiceVoidResponse>;
59
140
  }
141
+ /**
142
+ * The type of tax identifier
143
+ */
144
+ export type TaxIdentifierType = 'ad_nrt' | 'ao_tin' | 'ar_cuit' | 'am_tin' | 'aw_tin' | 'au_abn' | 'au_arn' | 'eu_vat' | 'az_tin' | 'bs_tin' | 'bh_vat' | 'bd_bin' | 'bb_tin' | 'by_tin' | 'bj_ifu' | 'bo_tin' | 'ba_tin' | 'br_cnpj' | 'br_cpf' | 'bg_uic' | 'bf_ifu' | 'kh_tin' | 'cm_niu' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' | 'cv_nif' | 'cl_tin' | 'cn_tin' | 'co_nit' | 'cd_nif' | 'cr_tin' | 'hr_oib' | 'do_rcn' | 'ec_ruc' | 'eg_tin' | 'sv_nit' | 'et_tin' | 'eu_oss_vat' | 'ge_vat' | 'de_stn' | 'gb_vat' | 'gn_nif' | 'hk_br' | 'hu_tin' | 'is_vat' | 'in_gst' | 'id_npwp' | 'il_vat' | 'jp_cn' | 'jp_rn' | 'jp_trn' | 'kz_bin' | 'ke_pin' | 'kg_tin' | 'la_tin' | 'li_uid' | 'li_vat' | 'my_frp' | 'my_itn' | 'my_sst' | 'mr_nif' | 'mx_rfc' | 'md_vat' | 'me_pib' | 'ma_vat' | 'np_pan' | 'nz_gst' | 'ng_tin' | 'mk_vat' | 'no_vat' | 'no_voec' | 'om_vat' | 'pe_ruc' | 'ph_tin' | 'pl_nip' | 'ro_tin' | 'ru_inn' | 'ru_kpp' | 'sa_vat' | 'sn_ninea' | 'rs_pib' | 'sg_gst' | 'sg_uen' | 'si_tin' | 'za_vat' | 'kr_brn' | 'es_cif' | 'ch_uid' | 'ch_vat' | 'tw_vat' | 'tj_tin' | 'tz_vat' | 'th_vat' | 'tr_tin' | 'ug_tin' | 'ua_vat' | 'ae_trn' | 'us_ein' | 'uy_ruc' | 'uz_tin' | 'uz_vat' | 've_rif' | 'vn_tin' | 'zm_tin' | 'zw_tin' | 'sr_fin' | 'xi_vat';
145
+ /**
146
+ * Represents `true` or `false` values.
147
+ */
148
+ export type InvoiceDeleteResponse = boolean;
149
+ /**
150
+ * Represents `true` or `false` values.
151
+ */
152
+ export type InvoiceMarkPaidResponse = boolean;
153
+ /**
154
+ * Represents `true` or `false` values.
155
+ */
156
+ export type InvoiceMarkUncollectibleResponse = boolean;
60
157
  /**
61
158
  * Represents `true` or `false` values.
62
159
  */
63
160
  export type InvoiceVoidResponse = boolean;
64
- export type InvoiceCreateParams = InvoiceCreateParams.CreateInvoiceInputWithProductAndMemberID | InvoiceCreateParams.CreateInvoiceInputWithProductAndEmailAddress | InvoiceCreateParams.CreateInvoiceInputWithProductIDAndMemberID | InvoiceCreateParams.CreateInvoiceInputWithProductIDAndEmailAddress;
161
+ export type InvoiceCreateParams = InvoiceCreateParams.CreateInvoiceInputWithProduct | InvoiceCreateParams.CreateInvoiceInputWithProductID;
65
162
  export declare namespace InvoiceCreateParams {
66
- interface CreateInvoiceInputWithProductAndMemberID {
163
+ interface CreateInvoiceInputWithProduct {
67
164
  /**
68
165
  * How the invoice should be collected. Use charge_automatically to charge a stored
69
166
  * payment method, or send_invoice to email the customer.
@@ -73,31 +170,27 @@ export declare namespace InvoiceCreateParams {
73
170
  * The unique identifier of the company to create this invoice for.
74
171
  */
75
172
  company_id: string;
76
- /**
77
- * The date by which the invoice must be paid.
78
- */
79
- due_date: string;
80
- /**
81
- * The unique identifier of an existing member to create this invoice for. If not
82
- * provided, you must supply an email_address and customer_name.
83
- */
84
- member_id: string;
85
173
  /**
86
174
  * The plan attributes defining the price, currency, and billing interval for this
87
175
  * invoice.
88
176
  */
89
- plan: CreateInvoiceInputWithProductAndMemberID.Plan;
177
+ plan: CreateInvoiceInputWithProduct.Plan;
90
178
  /**
91
179
  * The properties of the product to create for this invoice. Provide this to create
92
180
  * a new product inline.
93
181
  */
94
- product: CreateInvoiceInputWithProductAndMemberID.Product;
182
+ product: CreateInvoiceInputWithProduct.Product;
95
183
  /**
96
184
  * The date and time when the invoice will be automatically finalized and charged.
97
185
  * Only valid when collection_method is charge_automatically. If not provided, the
98
186
  * charge will be processed immediately.
99
187
  */
100
188
  automatically_finalizes_at?: string | null;
189
+ /**
190
+ * Inline billing address to create a new mailing address for this invoice. Cannot
191
+ * be used together with mailing_address_id.
192
+ */
193
+ billing_address?: CreateInvoiceInputWithProduct.BillingAddress | null;
101
194
  /**
102
195
  * Whether to charge the customer a buyer fee on this invoice.
103
196
  */
@@ -107,6 +200,31 @@ export declare namespace InvoiceCreateParams {
107
200
  * is not yet a member of the company.
108
201
  */
109
202
  customer_name?: string | null;
203
+ /**
204
+ * The date by which the invoice must be paid. Required unless save_as_draft is
205
+ * true.
206
+ */
207
+ due_date?: string | null;
208
+ /**
209
+ * The email address of the customer. Required when creating an invoice for a
210
+ * customer who is not yet a member of the company.
211
+ */
212
+ email_address?: string | null;
213
+ /**
214
+ * Optional line items that break down the invoice total. When provided, the sum of
215
+ * (quantity \* unit_price) for all items must equal the plan price.
216
+ */
217
+ line_items?: Array<CreateInvoiceInputWithProduct.LineItem> | null;
218
+ /**
219
+ * The unique identifier of an existing mailing address to attach to this invoice.
220
+ * Cannot be used together with billing_address.
221
+ */
222
+ mailing_address_id?: string | null;
223
+ /**
224
+ * The unique identifier of an existing member to create this invoice for. If not
225
+ * provided, you must supply an email_address and customer_name.
226
+ */
227
+ member_id?: string | null;
110
228
  /**
111
229
  * The unique identifier of the payment method to charge. Required when
112
230
  * collection_method is charge_automatically.
@@ -117,8 +235,13 @@ export declare namespace InvoiceCreateParams {
117
235
  * must provide a payment_token.
118
236
  */
119
237
  payment_token_id?: string | null;
238
+ /**
239
+ * When true, creates the invoice as a draft without sending or charging. Relaxes
240
+ * customer and due date requirements.
241
+ */
242
+ save_as_draft?: boolean | null;
120
243
  }
121
- namespace CreateInvoiceInputWithProductAndMemberID {
244
+ namespace CreateInvoiceInputWithProduct {
122
245
  /**
123
246
  * The plan attributes defining the price, currency, and billing interval for this
124
247
  * invoice.
@@ -257,203 +380,73 @@ export declare namespace InvoiceCreateParams {
257
380
  */
258
381
  product_tax_code_id?: string | null;
259
382
  }
260
- }
261
- interface CreateInvoiceInputWithProductAndEmailAddress {
262
- /**
263
- * How the invoice should be collected. Use charge_automatically to charge a stored
264
- * payment method, or send_invoice to email the customer.
265
- */
266
- collection_method: Shared.CollectionMethod;
267
383
  /**
268
- * The unique identifier of the company to create this invoice for.
384
+ * Inline billing address to create a new mailing address for this invoice. Cannot
385
+ * be used together with mailing_address_id.
269
386
  */
270
- company_id: string;
271
- /**
272
- * The date by which the invoice must be paid.
273
- */
274
- due_date: string;
275
- /**
276
- * The email address of the customer. Required when creating an invoice for a
277
- * customer who is not yet a member of the company.
278
- */
279
- email_address: string;
280
- /**
281
- * The plan attributes defining the price, currency, and billing interval for this
282
- * invoice.
283
- */
284
- plan: CreateInvoiceInputWithProductAndEmailAddress.Plan;
285
- /**
286
- * The properties of the product to create for this invoice. Provide this to create
287
- * a new product inline.
288
- */
289
- product: CreateInvoiceInputWithProductAndEmailAddress.Product;
290
- /**
291
- * The date and time when the invoice will be automatically finalized and charged.
292
- * Only valid when collection_method is charge_automatically. If not provided, the
293
- * charge will be processed immediately.
294
- */
295
- automatically_finalizes_at?: string | null;
296
- /**
297
- * Whether to charge the customer a buyer fee on this invoice.
298
- */
299
- charge_buyer_fee?: boolean | null;
300
- /**
301
- * The name of the customer. Required when creating an invoice for a customer who
302
- * is not yet a member of the company.
303
- */
304
- customer_name?: string | null;
305
- /**
306
- * The unique identifier of the payment method to charge. Required when
307
- * collection_method is charge_automatically.
308
- */
309
- payment_method_id?: string | null;
310
- /**
311
- * The payment token ID to use for this invoice. If using charge_automatically, you
312
- * must provide a payment_token.
313
- */
314
- payment_token_id?: string | null;
315
- }
316
- namespace CreateInvoiceInputWithProductAndEmailAddress {
317
- /**
318
- * The plan attributes defining the price, currency, and billing interval for this
319
- * invoice.
320
- */
321
- interface Plan {
387
+ interface BillingAddress {
322
388
  /**
323
- * The interval in days at which the plan charges (renewal plans).
389
+ * The city of the address.
324
390
  */
325
- billing_period?: number | null;
391
+ city?: string | null;
326
392
  /**
327
- * An array of custom field objects.
393
+ * The country of the address.
328
394
  */
329
- custom_fields?: Array<Plan.CustomField> | null;
395
+ country?: string | null;
330
396
  /**
331
- * The description of the plan.
397
+ * The line 1 of the address.
332
398
  */
333
- description?: string | null;
399
+ line1?: string | null;
334
400
  /**
335
- * The number of days until the membership expires and revokes access (expiration
336
- * plans). For example, 365 for a one-year access period.
401
+ * The line 2 of the address.
337
402
  */
338
- expiration_days?: number | null;
403
+ line2?: string | null;
339
404
  /**
340
- * An additional amount charged upon first purchase. Use only if a one time payment
341
- * OR you want to charge an additional amount on top of the renewal price. Provided
342
- * as a number in the specified currency. Eg: 10.43 for $10.43
405
+ * The name of the customer.
343
406
  */
344
- initial_price?: number | null;
407
+ name?: string | null;
345
408
  /**
346
- * A personal description or notes section for the business.
409
+ * The phone number of the customer.
347
410
  */
348
- internal_notes?: string | null;
411
+ phone?: string | null;
349
412
  /**
350
- * Whether this plan uses legacy payment method controls
413
+ * The postal code of the address.
351
414
  */
352
- legacy_payment_method_controls?: boolean | null;
415
+ postal_code?: string | null;
353
416
  /**
354
- * The explicit payment method configuration for the plan. If not provided, the
355
- * platform or company's defaults will apply.
356
- */
357
- payment_method_configuration?: Plan.PaymentMethodConfiguration | null;
358
- /**
359
- * The type of plan that can be attached to a product
360
- */
361
- plan_type?: Shared.PlanType | null;
362
- /**
363
- * The methods of how a plan can be released.
417
+ * The state of the address.
364
418
  */
365
- release_method?: Shared.ReleaseMethod | null;
419
+ state?: string | null;
366
420
  /**
367
- * The amount the customer is charged every billing period. Use only if a recurring
368
- * payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43
421
+ * The type of tax identifier
369
422
  */
370
- renewal_price?: number | null;
423
+ tax_id_type?: InvoicesAPI.TaxIdentifierType | null;
371
424
  /**
372
- * The number of units available for purchase.
425
+ * The value of the tax identifier.
373
426
  */
374
- stock?: number | null;
375
- /**
376
- * The number of free trial days added before a renewal plan.
377
- */
378
- trial_period_days?: number | null;
379
- /**
380
- * When true, the plan has unlimited stock (stock field is ignored). When false,
381
- * purchases are limited by the stock field.
382
- */
383
- unlimited_stock?: boolean | null;
384
- /**
385
- * Visibility of a resource
386
- */
387
- visibility?: Shared.Visibility | null;
388
- }
389
- namespace Plan {
390
- interface CustomField {
391
- /**
392
- * The type of the custom field.
393
- */
394
- field_type: 'text';
395
- /**
396
- * The name of the custom field.
397
- */
398
- name: string;
399
- /**
400
- * The ID of the custom field (if being updated)
401
- */
402
- id?: string | null;
403
- /**
404
- * The order of the field.
405
- */
406
- order?: number | null;
407
- /**
408
- * The placeholder value of the field.
409
- */
410
- placeholder?: string | null;
411
- /**
412
- * Whether or not the field is required.
413
- */
414
- required?: boolean | null;
415
- }
416
- /**
417
- * The explicit payment method configuration for the plan. If not provided, the
418
- * platform or company's defaults will apply.
419
- */
420
- interface PaymentMethodConfiguration {
421
- /**
422
- * An array of payment method identifiers that are explicitly disabled. Only
423
- * applies if the include_platform_defaults is true.
424
- */
425
- disabled: Array<PaymentsAPI.PaymentMethodTypes>;
426
- /**
427
- * An array of payment method identifiers that are explicitly enabled. This means
428
- * these payment methods will be shown on checkout. Example use case is to only
429
- * enable a specific payment method like cashapp, or extending the platform
430
- * defaults with additional methods.
431
- */
432
- enabled: Array<PaymentsAPI.PaymentMethodTypes>;
433
- /**
434
- * Whether Whop's platform default payment method enablement settings are included
435
- * in this configuration. The full list of default payment methods can be found in
436
- * the documentation at docs.whop.com/payments.
437
- */
438
- include_platform_defaults: boolean;
439
- }
427
+ tax_id_value?: string | null;
440
428
  }
441
429
  /**
442
- * The properties of the product to create for this invoice. Provide this to create
443
- * a new product inline.
430
+ * A single line item to include on the invoice, with a label, quantity, and unit
431
+ * price.
444
432
  */
445
- interface Product {
433
+ interface LineItem {
446
434
  /**
447
- * The title of the product.
435
+ * The label or description for this line item.
448
436
  */
449
- title: string;
437
+ label: string;
450
438
  /**
451
- * The ID of the product tax code to apply to this product.
439
+ * The unit price for this line item. Provided as a number in the specified
440
+ * currency. Eg: 10.43 for $10.43
452
441
  */
453
- product_tax_code_id?: string | null;
442
+ unit_price: number;
443
+ /**
444
+ * The quantity of this line item. Defaults to 1.
445
+ */
446
+ quantity?: number | null;
454
447
  }
455
448
  }
456
- interface CreateInvoiceInputWithProductIDAndMemberID {
449
+ interface CreateInvoiceInputWithProductID {
457
450
  /**
458
451
  * How the invoice should be collected. Use charge_automatically to charge a stored
459
452
  * payment method, or send_invoice to email the customer.
@@ -463,20 +456,11 @@ export declare namespace InvoiceCreateParams {
463
456
  * The unique identifier of the company to create this invoice for.
464
457
  */
465
458
  company_id: string;
466
- /**
467
- * The date by which the invoice must be paid.
468
- */
469
- due_date: string;
470
- /**
471
- * The unique identifier of an existing member to create this invoice for. If not
472
- * provided, you must supply an email_address and customer_name.
473
- */
474
- member_id: string;
475
459
  /**
476
460
  * The plan attributes defining the price, currency, and billing interval for this
477
461
  * invoice.
478
462
  */
479
- plan: CreateInvoiceInputWithProductIDAndMemberID.Plan;
463
+ plan: CreateInvoiceInputWithProductID.Plan;
480
464
  /**
481
465
  * The unique identifier of an existing product to create this invoice for.
482
466
  */
@@ -487,6 +471,11 @@ export declare namespace InvoiceCreateParams {
487
471
  * charge will be processed immediately.
488
472
  */
489
473
  automatically_finalizes_at?: string | null;
474
+ /**
475
+ * Inline billing address to create a new mailing address for this invoice. Cannot
476
+ * be used together with mailing_address_id.
477
+ */
478
+ billing_address?: CreateInvoiceInputWithProductID.BillingAddress | null;
490
479
  /**
491
480
  * Whether to charge the customer a buyer fee on this invoice.
492
481
  */
@@ -496,6 +485,31 @@ export declare namespace InvoiceCreateParams {
496
485
  * is not yet a member of the company.
497
486
  */
498
487
  customer_name?: string | null;
488
+ /**
489
+ * The date by which the invoice must be paid. Required unless save_as_draft is
490
+ * true.
491
+ */
492
+ due_date?: string | null;
493
+ /**
494
+ * The email address of the customer. Required when creating an invoice for a
495
+ * customer who is not yet a member of the company.
496
+ */
497
+ email_address?: string | null;
498
+ /**
499
+ * Optional line items that break down the invoice total. When provided, the sum of
500
+ * (quantity \* unit_price) for all items must equal the plan price.
501
+ */
502
+ line_items?: Array<CreateInvoiceInputWithProductID.LineItem> | null;
503
+ /**
504
+ * The unique identifier of an existing mailing address to attach to this invoice.
505
+ * Cannot be used together with billing_address.
506
+ */
507
+ mailing_address_id?: string | null;
508
+ /**
509
+ * The unique identifier of an existing member to create this invoice for. If not
510
+ * provided, you must supply an email_address and customer_name.
511
+ */
512
+ member_id?: string | null;
499
513
  /**
500
514
  * The unique identifier of the payment method to charge. Required when
501
515
  * collection_method is charge_automatically.
@@ -506,8 +520,13 @@ export declare namespace InvoiceCreateParams {
506
520
  * must provide a payment_token.
507
521
  */
508
522
  payment_token_id?: string | null;
523
+ /**
524
+ * When true, creates the invoice as a draft without sending or charging. Relaxes
525
+ * customer and due date requirements.
526
+ */
527
+ save_as_draft?: boolean | null;
509
528
  }
510
- namespace CreateInvoiceInputWithProductIDAndMemberID {
529
+ namespace CreateInvoiceInputWithProductID {
511
530
  /**
512
531
  * The plan attributes defining the price, currency, and billing interval for this
513
532
  * invoice.
@@ -632,185 +651,309 @@ export declare namespace InvoiceCreateParams {
632
651
  include_platform_defaults: boolean;
633
652
  }
634
653
  }
654
+ /**
655
+ * Inline billing address to create a new mailing address for this invoice. Cannot
656
+ * be used together with mailing_address_id.
657
+ */
658
+ interface BillingAddress {
659
+ /**
660
+ * The city of the address.
661
+ */
662
+ city?: string | null;
663
+ /**
664
+ * The country of the address.
665
+ */
666
+ country?: string | null;
667
+ /**
668
+ * The line 1 of the address.
669
+ */
670
+ line1?: string | null;
671
+ /**
672
+ * The line 2 of the address.
673
+ */
674
+ line2?: string | null;
675
+ /**
676
+ * The name of the customer.
677
+ */
678
+ name?: string | null;
679
+ /**
680
+ * The phone number of the customer.
681
+ */
682
+ phone?: string | null;
683
+ /**
684
+ * The postal code of the address.
685
+ */
686
+ postal_code?: string | null;
687
+ /**
688
+ * The state of the address.
689
+ */
690
+ state?: string | null;
691
+ /**
692
+ * The type of tax identifier
693
+ */
694
+ tax_id_type?: InvoicesAPI.TaxIdentifierType | null;
695
+ /**
696
+ * The value of the tax identifier.
697
+ */
698
+ tax_id_value?: string | null;
699
+ }
700
+ /**
701
+ * A single line item to include on the invoice, with a label, quantity, and unit
702
+ * price.
703
+ */
704
+ interface LineItem {
705
+ /**
706
+ * The label or description for this line item.
707
+ */
708
+ label: string;
709
+ /**
710
+ * The unit price for this line item. Provided as a number in the specified
711
+ * currency. Eg: 10.43 for $10.43
712
+ */
713
+ unit_price: number;
714
+ /**
715
+ * The quantity of this line item. Defaults to 1.
716
+ */
717
+ quantity?: number | null;
718
+ }
635
719
  }
636
- interface CreateInvoiceInputWithProductIDAndEmailAddress {
720
+ }
721
+ export interface InvoiceUpdateParams {
722
+ /**
723
+ * The date and time when the invoice will be automatically finalized and charged.
724
+ */
725
+ automatically_finalizes_at?: string | null;
726
+ /**
727
+ * Inline billing address to create or update a mailing address for this invoice.
728
+ */
729
+ billing_address?: InvoiceUpdateParams.BillingAddress | null;
730
+ /**
731
+ * Whether to charge the customer a buyer fee on this invoice.
732
+ */
733
+ charge_buyer_fee?: boolean | null;
734
+ /**
735
+ * The method of collection for an invoice.
736
+ */
737
+ collection_method?: Shared.CollectionMethod | null;
738
+ /**
739
+ * The name of the customer.
740
+ */
741
+ customer_name?: string | null;
742
+ /**
743
+ * The date by which the invoice must be paid.
744
+ */
745
+ due_date?: string | null;
746
+ /**
747
+ * The email address of the customer.
748
+ */
749
+ email_address?: string | null;
750
+ /**
751
+ * Line items that break down the invoice total.
752
+ */
753
+ line_items?: Array<InvoiceUpdateParams.LineItem> | null;
754
+ /**
755
+ * The unique identifier of an existing mailing address to attach.
756
+ */
757
+ mailing_address_id?: string | null;
758
+ /**
759
+ * The unique identifier of a member to assign as the customer.
760
+ */
761
+ member_id?: string | null;
762
+ /**
763
+ * The unique identifier of the payment method to charge.
764
+ */
765
+ payment_method_id?: string | null;
766
+ /**
767
+ * Updated plan attributes.
768
+ */
769
+ plan?: InvoiceUpdateParams.Plan | null;
770
+ }
771
+ export declare namespace InvoiceUpdateParams {
772
+ /**
773
+ * Inline billing address to create or update a mailing address for this invoice.
774
+ */
775
+ interface BillingAddress {
637
776
  /**
638
- * How the invoice should be collected. Use charge_automatically to charge a stored
639
- * payment method, or send_invoice to email the customer.
777
+ * The city of the address.
640
778
  */
641
- collection_method: Shared.CollectionMethod;
779
+ city?: string | null;
642
780
  /**
643
- * The unique identifier of the company to create this invoice for.
781
+ * The country of the address.
644
782
  */
645
- company_id: string;
783
+ country?: string | null;
646
784
  /**
647
- * The date by which the invoice must be paid.
785
+ * The line 1 of the address.
648
786
  */
649
- due_date: string;
787
+ line1?: string | null;
650
788
  /**
651
- * The email address of the customer. Required when creating an invoice for a
652
- * customer who is not yet a member of the company.
789
+ * The line 2 of the address.
653
790
  */
654
- email_address: string;
791
+ line2?: string | null;
655
792
  /**
656
- * The plan attributes defining the price, currency, and billing interval for this
657
- * invoice.
793
+ * The name of the customer.
658
794
  */
659
- plan: CreateInvoiceInputWithProductIDAndEmailAddress.Plan;
795
+ name?: string | null;
660
796
  /**
661
- * The unique identifier of an existing product to create this invoice for.
797
+ * The phone number of the customer.
662
798
  */
663
- product_id: string;
799
+ phone?: string | null;
664
800
  /**
665
- * The date and time when the invoice will be automatically finalized and charged.
666
- * Only valid when collection_method is charge_automatically. If not provided, the
667
- * charge will be processed immediately.
801
+ * The postal code of the address.
668
802
  */
669
- automatically_finalizes_at?: string | null;
803
+ postal_code?: string | null;
670
804
  /**
671
- * Whether to charge the customer a buyer fee on this invoice.
805
+ * The state of the address.
672
806
  */
673
- charge_buyer_fee?: boolean | null;
807
+ state?: string | null;
674
808
  /**
675
- * The name of the customer. Required when creating an invoice for a customer who
676
- * is not yet a member of the company.
809
+ * The type of tax identifier
677
810
  */
678
- customer_name?: string | null;
811
+ tax_id_type?: InvoicesAPI.TaxIdentifierType | null;
679
812
  /**
680
- * The unique identifier of the payment method to charge. Required when
681
- * collection_method is charge_automatically.
813
+ * The value of the tax identifier.
682
814
  */
683
- payment_method_id?: string | null;
815
+ tax_id_value?: string | null;
816
+ }
817
+ /**
818
+ * A single line item to include on the invoice, with a label, quantity, and unit
819
+ * price.
820
+ */
821
+ interface LineItem {
684
822
  /**
685
- * The payment token ID to use for this invoice. If using charge_automatically, you
686
- * must provide a payment_token.
823
+ * The label or description for this line item.
687
824
  */
688
- payment_token_id?: string | null;
825
+ label: string;
826
+ /**
827
+ * The unit price for this line item. Provided as a number in the specified
828
+ * currency. Eg: 10.43 for $10.43
829
+ */
830
+ unit_price: number;
831
+ /**
832
+ * The quantity of this line item. Defaults to 1.
833
+ */
834
+ quantity?: number | null;
689
835
  }
690
- namespace CreateInvoiceInputWithProductIDAndEmailAddress {
836
+ /**
837
+ * Updated plan attributes.
838
+ */
839
+ interface Plan {
691
840
  /**
692
- * The plan attributes defining the price, currency, and billing interval for this
693
- * invoice.
841
+ * The interval in days at which the plan charges (renewal plans).
694
842
  */
695
- interface Plan {
696
- /**
697
- * The interval in days at which the plan charges (renewal plans).
698
- */
699
- billing_period?: number | null;
700
- /**
701
- * An array of custom field objects.
702
- */
703
- custom_fields?: Array<Plan.CustomField> | null;
704
- /**
705
- * The description of the plan.
706
- */
707
- description?: string | null;
708
- /**
709
- * The number of days until the membership expires and revokes access (expiration
710
- * plans). For example, 365 for a one-year access period.
711
- */
712
- expiration_days?: number | null;
713
- /**
714
- * An additional amount charged upon first purchase. Use only if a one time payment
715
- * OR you want to charge an additional amount on top of the renewal price. Provided
716
- * as a number in the specified currency. Eg: 10.43 for $10.43
717
- */
718
- initial_price?: number | null;
719
- /**
720
- * A personal description or notes section for the business.
721
- */
722
- internal_notes?: string | null;
843
+ billing_period?: number | null;
844
+ /**
845
+ * An array of custom field objects.
846
+ */
847
+ custom_fields?: Array<Plan.CustomField> | null;
848
+ /**
849
+ * The description of the plan.
850
+ */
851
+ description?: string | null;
852
+ /**
853
+ * The number of days until the membership expires and revokes access (expiration
854
+ * plans). For example, 365 for a one-year access period.
855
+ */
856
+ expiration_days?: number | null;
857
+ /**
858
+ * An additional amount charged upon first purchase. Use only if a one time payment
859
+ * OR you want to charge an additional amount on top of the renewal price. Provided
860
+ * as a number in the specified currency. Eg: 10.43 for $10.43
861
+ */
862
+ initial_price?: number | null;
863
+ /**
864
+ * A personal description or notes section for the business.
865
+ */
866
+ internal_notes?: string | null;
867
+ /**
868
+ * Whether this plan uses legacy payment method controls
869
+ */
870
+ legacy_payment_method_controls?: boolean | null;
871
+ /**
872
+ * The explicit payment method configuration for the plan. If not provided, the
873
+ * platform or company's defaults will apply.
874
+ */
875
+ payment_method_configuration?: Plan.PaymentMethodConfiguration | null;
876
+ /**
877
+ * The type of plan that can be attached to a product
878
+ */
879
+ plan_type?: Shared.PlanType | null;
880
+ /**
881
+ * The methods of how a plan can be released.
882
+ */
883
+ release_method?: Shared.ReleaseMethod | null;
884
+ /**
885
+ * The amount the customer is charged every billing period. Use only if a recurring
886
+ * payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43
887
+ */
888
+ renewal_price?: number | null;
889
+ /**
890
+ * The number of units available for purchase.
891
+ */
892
+ stock?: number | null;
893
+ /**
894
+ * The number of free trial days added before a renewal plan.
895
+ */
896
+ trial_period_days?: number | null;
897
+ /**
898
+ * When true, the plan has unlimited stock (stock field is ignored). When false,
899
+ * purchases are limited by the stock field.
900
+ */
901
+ unlimited_stock?: boolean | null;
902
+ /**
903
+ * Visibility of a resource
904
+ */
905
+ visibility?: Shared.Visibility | null;
906
+ }
907
+ namespace Plan {
908
+ interface CustomField {
723
909
  /**
724
- * Whether this plan uses legacy payment method controls
910
+ * The type of the custom field.
725
911
  */
726
- legacy_payment_method_controls?: boolean | null;
912
+ field_type: 'text';
727
913
  /**
728
- * The explicit payment method configuration for the plan. If not provided, the
729
- * platform or company's defaults will apply.
914
+ * The name of the custom field.
730
915
  */
731
- payment_method_configuration?: Plan.PaymentMethodConfiguration | null;
916
+ name: string;
732
917
  /**
733
- * The type of plan that can be attached to a product
918
+ * The ID of the custom field (if being updated)
734
919
  */
735
- plan_type?: Shared.PlanType | null;
920
+ id?: string | null;
736
921
  /**
737
- * The methods of how a plan can be released.
922
+ * The order of the field.
738
923
  */
739
- release_method?: Shared.ReleaseMethod | null;
924
+ order?: number | null;
740
925
  /**
741
- * The amount the customer is charged every billing period. Use only if a recurring
742
- * payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43
926
+ * The placeholder value of the field.
743
927
  */
744
- renewal_price?: number | null;
928
+ placeholder?: string | null;
745
929
  /**
746
- * The number of units available for purchase.
930
+ * Whether or not the field is required.
747
931
  */
748
- stock?: number | null;
749
- /**
750
- * The number of free trial days added before a renewal plan.
751
- */
752
- trial_period_days?: number | null;
932
+ required?: boolean | null;
933
+ }
934
+ /**
935
+ * The explicit payment method configuration for the plan. If not provided, the
936
+ * platform or company's defaults will apply.
937
+ */
938
+ interface PaymentMethodConfiguration {
753
939
  /**
754
- * When true, the plan has unlimited stock (stock field is ignored). When false,
755
- * purchases are limited by the stock field.
940
+ * An array of payment method identifiers that are explicitly disabled. Only
941
+ * applies if the include_platform_defaults is true.
756
942
  */
757
- unlimited_stock?: boolean | null;
943
+ disabled: Array<PaymentsAPI.PaymentMethodTypes>;
758
944
  /**
759
- * Visibility of a resource
945
+ * An array of payment method identifiers that are explicitly enabled. This means
946
+ * these payment methods will be shown on checkout. Example use case is to only
947
+ * enable a specific payment method like cashapp, or extending the platform
948
+ * defaults with additional methods.
760
949
  */
761
- visibility?: Shared.Visibility | null;
762
- }
763
- namespace Plan {
764
- interface CustomField {
765
- /**
766
- * The type of the custom field.
767
- */
768
- field_type: 'text';
769
- /**
770
- * The name of the custom field.
771
- */
772
- name: string;
773
- /**
774
- * The ID of the custom field (if being updated)
775
- */
776
- id?: string | null;
777
- /**
778
- * The order of the field.
779
- */
780
- order?: number | null;
781
- /**
782
- * The placeholder value of the field.
783
- */
784
- placeholder?: string | null;
785
- /**
786
- * Whether or not the field is required.
787
- */
788
- required?: boolean | null;
789
- }
950
+ enabled: Array<PaymentsAPI.PaymentMethodTypes>;
790
951
  /**
791
- * The explicit payment method configuration for the plan. If not provided, the
792
- * platform or company's defaults will apply.
952
+ * Whether Whop's platform default payment method enablement settings are included
953
+ * in this configuration. The full list of default payment methods can be found in
954
+ * the documentation at docs.whop.com/payments.
793
955
  */
794
- interface PaymentMethodConfiguration {
795
- /**
796
- * An array of payment method identifiers that are explicitly disabled. Only
797
- * applies if the include_platform_defaults is true.
798
- */
799
- disabled: Array<PaymentsAPI.PaymentMethodTypes>;
800
- /**
801
- * An array of payment method identifiers that are explicitly enabled. This means
802
- * these payment methods will be shown on checkout. Example use case is to only
803
- * enable a specific payment method like cashapp, or extending the platform
804
- * defaults with additional methods.
805
- */
806
- enabled: Array<PaymentsAPI.PaymentMethodTypes>;
807
- /**
808
- * Whether Whop's platform default payment method enablement settings are included
809
- * in this configuration. The full list of default payment methods can be found in
810
- * the documentation at docs.whop.com/payments.
811
- */
812
- include_platform_defaults: boolean;
813
- }
956
+ include_platform_defaults: boolean;
814
957
  }
815
958
  }
816
959
  }
@@ -862,7 +1005,7 @@ export interface InvoiceListParams extends CursorPageParams {
862
1005
  statuses?: Array<Shared.InvoiceStatus> | null;
863
1006
  }
864
1007
  export declare namespace Invoices {
865
- export { type InvoiceVoidResponse as InvoiceVoidResponse, type InvoiceCreateParams as InvoiceCreateParams, type InvoiceListParams as InvoiceListParams, };
1008
+ export { type TaxIdentifierType as TaxIdentifierType, type InvoiceDeleteResponse as InvoiceDeleteResponse, type InvoiceMarkPaidResponse as InvoiceMarkPaidResponse, type InvoiceMarkUncollectibleResponse as InvoiceMarkUncollectibleResponse, type InvoiceVoidResponse as InvoiceVoidResponse, type InvoiceCreateParams as InvoiceCreateParams, type InvoiceUpdateParams as InvoiceUpdateParams, type InvoiceListParams as InvoiceListParams, };
866
1009
  }
867
1010
  export { type InvoiceListItemsCursorPage };
868
1011
  //# sourceMappingURL=invoices.d.mts.map