@whop/sdk 0.0.35 → 0.0.36

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 (98) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/client.d.mts +4 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +4 -4
  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 +69 -0
  29. package/resources/checkout-configurations.d.mts.map +1 -1
  30. package/resources/checkout-configurations.d.ts +69 -0
  31. package/resources/checkout-configurations.d.ts.map +1 -1
  32. package/resources/companies.d.mts +19 -0
  33. package/resources/companies.d.mts.map +1 -1
  34. package/resources/companies.d.ts +19 -0
  35. package/resources/companies.d.ts.map +1 -1
  36. package/resources/index.d.mts +2 -2
  37. package/resources/index.d.mts.map +1 -1
  38. package/resources/index.d.ts +2 -2
  39. package/resources/index.d.ts.map +1 -1
  40. package/resources/index.js.map +1 -1
  41. package/resources/index.mjs.map +1 -1
  42. package/resources/invoices.d.mts +179 -345
  43. package/resources/invoices.d.mts.map +1 -1
  44. package/resources/invoices.d.ts +179 -345
  45. package/resources/invoices.d.ts.map +1 -1
  46. package/resources/invoices.js +20 -2
  47. package/resources/invoices.js.map +1 -1
  48. package/resources/invoices.mjs +20 -2
  49. package/resources/invoices.mjs.map +1 -1
  50. package/resources/memberships.d.mts +1 -1
  51. package/resources/memberships.d.mts.map +1 -1
  52. package/resources/memberships.d.ts +1 -1
  53. package/resources/memberships.d.ts.map +1 -1
  54. package/resources/payments.d.mts +21 -2
  55. package/resources/payments.d.mts.map +1 -1
  56. package/resources/payments.d.ts +21 -2
  57. package/resources/payments.d.ts.map +1 -1
  58. package/resources/plans.d.mts +46 -0
  59. package/resources/plans.d.mts.map +1 -1
  60. package/resources/plans.d.ts +46 -0
  61. package/resources/plans.d.ts.map +1 -1
  62. package/resources/products.d.mts +2 -2
  63. package/resources/products.d.ts +2 -2
  64. package/resources/refunds.d.mts +1 -1
  65. package/resources/refunds.d.mts.map +1 -1
  66. package/resources/refunds.d.ts +1 -1
  67. package/resources/refunds.d.ts.map +1 -1
  68. package/resources/shared.d.mts +54 -5
  69. package/resources/shared.d.mts.map +1 -1
  70. package/resources/shared.d.ts +54 -5
  71. package/resources/shared.d.ts.map +1 -1
  72. package/resources/webhooks.d.mts +653 -3
  73. package/resources/webhooks.d.mts.map +1 -1
  74. package/resources/webhooks.d.ts +653 -3
  75. package/resources/webhooks.d.ts.map +1 -1
  76. package/resources/webhooks.js.map +1 -1
  77. package/resources/webhooks.mjs.map +1 -1
  78. package/src/client.ts +20 -1
  79. package/src/internal/utils/env.ts +2 -2
  80. package/src/resources/affiliates/affiliates.ts +20 -12
  81. package/src/resources/affiliates/overrides.ts +16 -8
  82. package/src/resources/apps.ts +31 -0
  83. package/src/resources/checkout-configurations.ts +81 -0
  84. package/src/resources/companies.ts +23 -0
  85. package/src/resources/index.ts +7 -0
  86. package/src/resources/invoices.ts +316 -397
  87. package/src/resources/memberships.ts +1 -1
  88. package/src/resources/payments.ts +25 -1
  89. package/src/resources/plans.ts +54 -0
  90. package/src/resources/products.ts +2 -2
  91. package/src/resources/refunds.ts +2 -1
  92. package/src/resources/shared.ts +64 -5
  93. package/src/resources/webhooks.ts +818 -0
  94. package/src/version.ts +1 -1
  95. package/version.d.mts +1 -1
  96. package/version.d.ts +1 -1
  97. package/version.js +1 -1
  98. package/version.mjs +1 -1
@@ -1,6 +1,7 @@
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 * as InvoicesAPI from './invoices';
4
5
  import * as PaymentsAPI from './payments';
5
6
  import * as Shared from './shared';
6
7
  import { InvoiceListItemsCursorPage } from './shared';
@@ -26,8 +27,6 @@ export class Invoices extends APIResource {
26
27
  * const invoice = await client.invoices.create({
27
28
  * collection_method: 'send_invoice',
28
29
  * company_id: 'biz_xxxxxxxxxxxxxx',
29
- * due_date: '2023-12-01T05:00:00.401Z',
30
- * member_id: 'mber_xxxxxxxxxxxxx',
31
30
  * plan: {},
32
31
  * product: { title: 'title' },
33
32
  * });
@@ -63,6 +62,28 @@ export class Invoices extends APIResource {
63
62
  return this._client.getAPIList('/invoices', CursorPage<Shared.InvoiceListItem>, { query, ...options });
64
63
  }
65
64
 
65
+ /**
66
+ * Mark an open invoice as paid when payment was collected outside of Whop.
67
+ *
68
+ * Required permissions:
69
+ *
70
+ * - `invoice:update`
71
+ */
72
+ markPaid(id: string, options?: RequestOptions): APIPromise<InvoiceMarkPaidResponse> {
73
+ return this._client.post(path`/invoices/${id}/mark_paid`, options);
74
+ }
75
+
76
+ /**
77
+ * Mark an open invoice as uncollectible when payment is not expected.
78
+ *
79
+ * Required permissions:
80
+ *
81
+ * - `invoice:update`
82
+ */
83
+ markUncollectible(id: string, options?: RequestOptions): APIPromise<InvoiceMarkUncollectibleResponse> {
84
+ return this._client.post(path`/invoices/${id}/mark_uncollectible`, options);
85
+ }
86
+
66
87
  /**
67
88
  * Void an open invoice so it can no longer be paid. Voiding is permanent and
68
89
  * cannot be undone.
@@ -76,19 +97,143 @@ export class Invoices extends APIResource {
76
97
  }
77
98
  }
78
99
 
100
+ /**
101
+ * The type of tax identifier
102
+ */
103
+ export type TaxIdentifierType =
104
+ | 'ad_nrt'
105
+ | 'ao_tin'
106
+ | 'ar_cuit'
107
+ | 'am_tin'
108
+ | 'aw_tin'
109
+ | 'au_abn'
110
+ | 'au_arn'
111
+ | 'eu_vat'
112
+ | 'az_tin'
113
+ | 'bs_tin'
114
+ | 'bh_vat'
115
+ | 'bd_bin'
116
+ | 'bb_tin'
117
+ | 'by_tin'
118
+ | 'bj_ifu'
119
+ | 'bo_tin'
120
+ | 'ba_tin'
121
+ | 'br_cnpj'
122
+ | 'br_cpf'
123
+ | 'bg_uic'
124
+ | 'bf_ifu'
125
+ | 'kh_tin'
126
+ | 'cm_niu'
127
+ | 'ca_bn'
128
+ | 'ca_gst_hst'
129
+ | 'ca_pst_bc'
130
+ | 'ca_pst_mb'
131
+ | 'ca_pst_sk'
132
+ | 'ca_qst'
133
+ | 'cv_nif'
134
+ | 'cl_tin'
135
+ | 'cn_tin'
136
+ | 'co_nit'
137
+ | 'cd_nif'
138
+ | 'cr_tin'
139
+ | 'hr_oib'
140
+ | 'do_rcn'
141
+ | 'ec_ruc'
142
+ | 'eg_tin'
143
+ | 'sv_nit'
144
+ | 'et_tin'
145
+ | 'eu_oss_vat'
146
+ | 'ge_vat'
147
+ | 'de_stn'
148
+ | 'gb_vat'
149
+ | 'gn_nif'
150
+ | 'hk_br'
151
+ | 'hu_tin'
152
+ | 'is_vat'
153
+ | 'in_gst'
154
+ | 'id_npwp'
155
+ | 'il_vat'
156
+ | 'jp_cn'
157
+ | 'jp_rn'
158
+ | 'jp_trn'
159
+ | 'kz_bin'
160
+ | 'ke_pin'
161
+ | 'kg_tin'
162
+ | 'la_tin'
163
+ | 'li_uid'
164
+ | 'li_vat'
165
+ | 'my_frp'
166
+ | 'my_itn'
167
+ | 'my_sst'
168
+ | 'mr_nif'
169
+ | 'mx_rfc'
170
+ | 'md_vat'
171
+ | 'me_pib'
172
+ | 'ma_vat'
173
+ | 'np_pan'
174
+ | 'nz_gst'
175
+ | 'ng_tin'
176
+ | 'mk_vat'
177
+ | 'no_vat'
178
+ | 'no_voec'
179
+ | 'om_vat'
180
+ | 'pe_ruc'
181
+ | 'ph_tin'
182
+ | 'pl_nip'
183
+ | 'ro_tin'
184
+ | 'ru_inn'
185
+ | 'ru_kpp'
186
+ | 'sa_vat'
187
+ | 'sn_ninea'
188
+ | 'rs_pib'
189
+ | 'sg_gst'
190
+ | 'sg_uen'
191
+ | 'si_tin'
192
+ | 'za_vat'
193
+ | 'kr_brn'
194
+ | 'es_cif'
195
+ | 'ch_uid'
196
+ | 'ch_vat'
197
+ | 'tw_vat'
198
+ | 'tj_tin'
199
+ | 'tz_vat'
200
+ | 'th_vat'
201
+ | 'tr_tin'
202
+ | 'ug_tin'
203
+ | 'ua_vat'
204
+ | 'ae_trn'
205
+ | 'us_ein'
206
+ | 'uy_ruc'
207
+ | 'uz_tin'
208
+ | 'uz_vat'
209
+ | 've_rif'
210
+ | 'vn_tin'
211
+ | 'zm_tin'
212
+ | 'zw_tin'
213
+ | 'sr_fin'
214
+ | 'xi_vat';
215
+
216
+ /**
217
+ * Represents `true` or `false` values.
218
+ */
219
+ export type InvoiceMarkPaidResponse = boolean;
220
+
221
+ /**
222
+ * Represents `true` or `false` values.
223
+ */
224
+ export type InvoiceMarkUncollectibleResponse = boolean;
225
+
79
226
  /**
80
227
  * Represents `true` or `false` values.
81
228
  */
82
229
  export type InvoiceVoidResponse = boolean;
83
230
 
84
231
  export type InvoiceCreateParams =
85
- | InvoiceCreateParams.CreateInvoiceInputWithProductAndMemberID
86
- | InvoiceCreateParams.CreateInvoiceInputWithProductAndEmailAddress
87
- | InvoiceCreateParams.CreateInvoiceInputWithProductIDAndMemberID
88
- | InvoiceCreateParams.CreateInvoiceInputWithProductIDAndEmailAddress;
232
+ | InvoiceCreateParams.CreateInvoiceInputWithProduct
233
+ | InvoiceCreateParams.CreateInvoiceInputWithProductID;
89
234
 
90
235
  export declare namespace InvoiceCreateParams {
91
- export interface CreateInvoiceInputWithProductAndMemberID {
236
+ export interface CreateInvoiceInputWithProduct {
92
237
  /**
93
238
  * How the invoice should be collected. Use charge_automatically to charge a stored
94
239
  * payment method, or send_invoice to email the customer.
@@ -100,28 +245,17 @@ export declare namespace InvoiceCreateParams {
100
245
  */
101
246
  company_id: string;
102
247
 
103
- /**
104
- * The date by which the invoice must be paid.
105
- */
106
- due_date: string;
107
-
108
- /**
109
- * The unique identifier of an existing member to create this invoice for. If not
110
- * provided, you must supply an email_address and customer_name.
111
- */
112
- member_id: string;
113
-
114
248
  /**
115
249
  * The plan attributes defining the price, currency, and billing interval for this
116
250
  * invoice.
117
251
  */
118
- plan: CreateInvoiceInputWithProductAndMemberID.Plan;
252
+ plan: CreateInvoiceInputWithProduct.Plan;
119
253
 
120
254
  /**
121
255
  * The properties of the product to create for this invoice. Provide this to create
122
256
  * a new product inline.
123
257
  */
124
- product: CreateInvoiceInputWithProductAndMemberID.Product;
258
+ product: CreateInvoiceInputWithProduct.Product;
125
259
 
126
260
  /**
127
261
  * The date and time when the invoice will be automatically finalized and charged.
@@ -130,6 +264,12 @@ export declare namespace InvoiceCreateParams {
130
264
  */
131
265
  automatically_finalizes_at?: string | null;
132
266
 
267
+ /**
268
+ * Inline billing address to create a new mailing address for this invoice. Cannot
269
+ * be used together with mailing_address_id.
270
+ */
271
+ billing_address?: CreateInvoiceInputWithProduct.BillingAddress | null;
272
+
133
273
  /**
134
274
  * Whether to charge the customer a buyer fee on this invoice.
135
275
  */
@@ -141,6 +281,36 @@ export declare namespace InvoiceCreateParams {
141
281
  */
142
282
  customer_name?: string | null;
143
283
 
284
+ /**
285
+ * The date by which the invoice must be paid. Required unless save_as_draft is
286
+ * true.
287
+ */
288
+ due_date?: string | null;
289
+
290
+ /**
291
+ * The email address of the customer. Required when creating an invoice for a
292
+ * customer who is not yet a member of the company.
293
+ */
294
+ email_address?: string | null;
295
+
296
+ /**
297
+ * Optional line items that break down the invoice total. When provided, the sum of
298
+ * (quantity \* unit_price) for all items must equal the plan price.
299
+ */
300
+ line_items?: Array<CreateInvoiceInputWithProduct.LineItem> | null;
301
+
302
+ /**
303
+ * The unique identifier of an existing mailing address to attach to this invoice.
304
+ * Cannot be used together with billing_address.
305
+ */
306
+ mailing_address_id?: string | null;
307
+
308
+ /**
309
+ * The unique identifier of an existing member to create this invoice for. If not
310
+ * provided, you must supply an email_address and customer_name.
311
+ */
312
+ member_id?: string | null;
313
+
144
314
  /**
145
315
  * The unique identifier of the payment method to charge. Required when
146
316
  * collection_method is charge_automatically.
@@ -152,9 +322,15 @@ export declare namespace InvoiceCreateParams {
152
322
  * must provide a payment_token.
153
323
  */
154
324
  payment_token_id?: string | null;
325
+
326
+ /**
327
+ * When true, creates the invoice as a draft without sending or charging. Relaxes
328
+ * customer and due date requirements.
329
+ */
330
+ save_as_draft?: boolean | null;
155
331
  }
156
332
 
157
- export namespace CreateInvoiceInputWithProductAndMemberID {
333
+ export namespace CreateInvoiceInputWithProduct {
158
334
  /**
159
335
  * The plan attributes defining the price, currency, and billing interval for this
160
336
  * invoice.
@@ -318,241 +494,87 @@ export declare namespace InvoiceCreateParams {
318
494
  */
319
495
  product_tax_code_id?: string | null;
320
496
  }
321
- }
322
-
323
- export interface CreateInvoiceInputWithProductAndEmailAddress {
324
- /**
325
- * How the invoice should be collected. Use charge_automatically to charge a stored
326
- * payment method, or send_invoice to email the customer.
327
- */
328
- collection_method: Shared.CollectionMethod;
329
-
330
- /**
331
- * The unique identifier of the company to create this invoice for.
332
- */
333
- company_id: string;
334
-
335
- /**
336
- * The date by which the invoice must be paid.
337
- */
338
- due_date: string;
339
-
340
- /**
341
- * The email address of the customer. Required when creating an invoice for a
342
- * customer who is not yet a member of the company.
343
- */
344
- email_address: string;
345
-
346
- /**
347
- * The plan attributes defining the price, currency, and billing interval for this
348
- * invoice.
349
- */
350
- plan: CreateInvoiceInputWithProductAndEmailAddress.Plan;
351
-
352
- /**
353
- * The properties of the product to create for this invoice. Provide this to create
354
- * a new product inline.
355
- */
356
- product: CreateInvoiceInputWithProductAndEmailAddress.Product;
357
-
358
- /**
359
- * The date and time when the invoice will be automatically finalized and charged.
360
- * Only valid when collection_method is charge_automatically. If not provided, the
361
- * charge will be processed immediately.
362
- */
363
- automatically_finalizes_at?: string | null;
364
-
365
- /**
366
- * Whether to charge the customer a buyer fee on this invoice.
367
- */
368
- charge_buyer_fee?: boolean | null;
369
-
370
- /**
371
- * The name of the customer. Required when creating an invoice for a customer who
372
- * is not yet a member of the company.
373
- */
374
- customer_name?: string | null;
375
-
376
- /**
377
- * The unique identifier of the payment method to charge. Required when
378
- * collection_method is charge_automatically.
379
- */
380
- payment_method_id?: string | null;
381
-
382
- /**
383
- * The payment token ID to use for this invoice. If using charge_automatically, you
384
- * must provide a payment_token.
385
- */
386
- payment_token_id?: string | null;
387
- }
388
497
 
389
- export namespace CreateInvoiceInputWithProductAndEmailAddress {
390
498
  /**
391
- * The plan attributes defining the price, currency, and billing interval for this
392
- * invoice.
499
+ * Inline billing address to create a new mailing address for this invoice. Cannot
500
+ * be used together with mailing_address_id.
393
501
  */
394
- export interface Plan {
395
- /**
396
- * The interval in days at which the plan charges (renewal plans).
397
- */
398
- billing_period?: number | null;
399
-
400
- /**
401
- * An array of custom field objects.
402
- */
403
- custom_fields?: Array<Plan.CustomField> | null;
404
-
405
- /**
406
- * The description of the plan.
407
- */
408
- description?: string | null;
409
-
410
- /**
411
- * The number of days until the membership expires and revokes access (expiration
412
- * plans). For example, 365 for a one-year access period.
413
- */
414
- expiration_days?: number | null;
415
-
416
- /**
417
- * An additional amount charged upon first purchase. Use only if a one time payment
418
- * OR you want to charge an additional amount on top of the renewal price. Provided
419
- * as a number in the specified currency. Eg: 10.43 for $10.43
420
- */
421
- initial_price?: number | null;
422
-
502
+ export interface BillingAddress {
423
503
  /**
424
- * A personal description or notes section for the business.
504
+ * The city of the address.
425
505
  */
426
- internal_notes?: string | null;
506
+ city?: string | null;
427
507
 
428
508
  /**
429
- * Whether this plan uses legacy payment method controls
509
+ * The country of the address.
430
510
  */
431
- legacy_payment_method_controls?: boolean | null;
511
+ country?: string | null;
432
512
 
433
513
  /**
434
- * The explicit payment method configuration for the plan. If not provided, the
435
- * platform or company's defaults will apply.
514
+ * The line 1 of the address.
436
515
  */
437
- payment_method_configuration?: Plan.PaymentMethodConfiguration | null;
516
+ line1?: string | null;
438
517
 
439
518
  /**
440
- * The type of plan that can be attached to a product
519
+ * The line 2 of the address.
441
520
  */
442
- plan_type?: Shared.PlanType | null;
521
+ line2?: string | null;
443
522
 
444
523
  /**
445
- * The methods of how a plan can be released.
524
+ * The name of the customer.
446
525
  */
447
- release_method?: Shared.ReleaseMethod | null;
526
+ name?: string | null;
448
527
 
449
528
  /**
450
- * The amount the customer is charged every billing period. Use only if a recurring
451
- * payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43
529
+ * The phone number of the customer.
452
530
  */
453
- renewal_price?: number | null;
531
+ phone?: string | null;
454
532
 
455
533
  /**
456
- * The number of units available for purchase.
534
+ * The postal code of the address.
457
535
  */
458
- stock?: number | null;
536
+ postal_code?: string | null;
459
537
 
460
538
  /**
461
- * The number of free trial days added before a renewal plan.
539
+ * The state of the address.
462
540
  */
463
- trial_period_days?: number | null;
541
+ state?: string | null;
464
542
 
465
543
  /**
466
- * When true, the plan has unlimited stock (stock field is ignored). When false,
467
- * purchases are limited by the stock field.
544
+ * The type of tax identifier
468
545
  */
469
- unlimited_stock?: boolean | null;
546
+ tax_id_type?: InvoicesAPI.TaxIdentifierType | null;
470
547
 
471
548
  /**
472
- * Visibility of a resource
549
+ * The value of the tax identifier.
473
550
  */
474
- visibility?: Shared.Visibility | null;
551
+ tax_id_value?: string | null;
475
552
  }
476
553
 
477
- export namespace Plan {
478
- export interface CustomField {
479
- /**
480
- * The type of the custom field.
481
- */
482
- field_type: 'text';
483
-
484
- /**
485
- * The name of the custom field.
486
- */
487
- name: string;
488
-
489
- /**
490
- * The ID of the custom field (if being updated)
491
- */
492
- id?: string | null;
493
-
494
- /**
495
- * The order of the field.
496
- */
497
- order?: number | null;
498
-
499
- /**
500
- * The placeholder value of the field.
501
- */
502
- placeholder?: string | null;
503
-
504
- /**
505
- * Whether or not the field is required.
506
- */
507
- required?: boolean | null;
508
- }
509
-
554
+ /**
555
+ * A single line item to include on the invoice, with a label, quantity, and unit
556
+ * price.
557
+ */
558
+ export interface LineItem {
510
559
  /**
511
- * The explicit payment method configuration for the plan. If not provided, the
512
- * platform or company's defaults will apply.
560
+ * The label or description for this line item.
513
561
  */
514
- export interface PaymentMethodConfiguration {
515
- /**
516
- * An array of payment method identifiers that are explicitly disabled. Only
517
- * applies if the include_platform_defaults is true.
518
- */
519
- disabled: Array<PaymentsAPI.PaymentMethodTypes>;
562
+ label: string;
520
563
 
521
- /**
522
- * An array of payment method identifiers that are explicitly enabled. This means
523
- * these payment methods will be shown on checkout. Example use case is to only
524
- * enable a specific payment method like cashapp, or extending the platform
525
- * defaults with additional methods.
526
- */
527
- enabled: Array<PaymentsAPI.PaymentMethodTypes>;
528
-
529
- /**
530
- * Whether Whop's platform default payment method enablement settings are included
531
- * in this configuration. The full list of default payment methods can be found in
532
- * the documentation at docs.whop.com/payments.
533
- */
534
- include_platform_defaults: boolean;
535
- }
536
- }
537
-
538
- /**
539
- * The properties of the product to create for this invoice. Provide this to create
540
- * a new product inline.
541
- */
542
- export interface Product {
543
564
  /**
544
- * The title of the product.
565
+ * The unit price for this line item. Provided as a number in the specified
566
+ * currency. Eg: 10.43 for $10.43
545
567
  */
546
- title: string;
568
+ unit_price: number;
547
569
 
548
570
  /**
549
- * The ID of the product tax code to apply to this product.
571
+ * The quantity of this line item. Defaults to 1.
550
572
  */
551
- product_tax_code_id?: string | null;
573
+ quantity?: number | null;
552
574
  }
553
575
  }
554
576
 
555
- export interface CreateInvoiceInputWithProductIDAndMemberID {
577
+ export interface CreateInvoiceInputWithProductID {
556
578
  /**
557
579
  * How the invoice should be collected. Use charge_automatically to charge a stored
558
580
  * payment method, or send_invoice to email the customer.
@@ -564,22 +586,11 @@ export declare namespace InvoiceCreateParams {
564
586
  */
565
587
  company_id: string;
566
588
 
567
- /**
568
- * The date by which the invoice must be paid.
569
- */
570
- due_date: string;
571
-
572
- /**
573
- * The unique identifier of an existing member to create this invoice for. If not
574
- * provided, you must supply an email_address and customer_name.
575
- */
576
- member_id: string;
577
-
578
589
  /**
579
590
  * The plan attributes defining the price, currency, and billing interval for this
580
591
  * invoice.
581
592
  */
582
- plan: CreateInvoiceInputWithProductIDAndMemberID.Plan;
593
+ plan: CreateInvoiceInputWithProductID.Plan;
583
594
 
584
595
  /**
585
596
  * The unique identifier of an existing product to create this invoice for.
@@ -593,6 +604,12 @@ export declare namespace InvoiceCreateParams {
593
604
  */
594
605
  automatically_finalizes_at?: string | null;
595
606
 
607
+ /**
608
+ * Inline billing address to create a new mailing address for this invoice. Cannot
609
+ * be used together with mailing_address_id.
610
+ */
611
+ billing_address?: CreateInvoiceInputWithProductID.BillingAddress | null;
612
+
596
613
  /**
597
614
  * Whether to charge the customer a buyer fee on this invoice.
598
615
  */
@@ -604,6 +621,36 @@ export declare namespace InvoiceCreateParams {
604
621
  */
605
622
  customer_name?: string | null;
606
623
 
624
+ /**
625
+ * The date by which the invoice must be paid. Required unless save_as_draft is
626
+ * true.
627
+ */
628
+ due_date?: string | null;
629
+
630
+ /**
631
+ * The email address of the customer. Required when creating an invoice for a
632
+ * customer who is not yet a member of the company.
633
+ */
634
+ email_address?: string | null;
635
+
636
+ /**
637
+ * Optional line items that break down the invoice total. When provided, the sum of
638
+ * (quantity \* unit_price) for all items must equal the plan price.
639
+ */
640
+ line_items?: Array<CreateInvoiceInputWithProductID.LineItem> | null;
641
+
642
+ /**
643
+ * The unique identifier of an existing mailing address to attach to this invoice.
644
+ * Cannot be used together with billing_address.
645
+ */
646
+ mailing_address_id?: string | null;
647
+
648
+ /**
649
+ * The unique identifier of an existing member to create this invoice for. If not
650
+ * provided, you must supply an email_address and customer_name.
651
+ */
652
+ member_id?: string | null;
653
+
607
654
  /**
608
655
  * The unique identifier of the payment method to charge. Required when
609
656
  * collection_method is charge_automatically.
@@ -615,9 +662,15 @@ export declare namespace InvoiceCreateParams {
615
662
  * must provide a payment_token.
616
663
  */
617
664
  payment_token_id?: string | null;
665
+
666
+ /**
667
+ * When true, creates the invoice as a draft without sending or charging. Relaxes
668
+ * customer and due date requirements.
669
+ */
670
+ save_as_draft?: boolean | null;
618
671
  }
619
672
 
620
- export namespace CreateInvoiceInputWithProductIDAndMemberID {
673
+ export namespace CreateInvoiceInputWithProductID {
621
674
  /**
622
675
  * The plan attributes defining the price, currency, and billing interval for this
623
676
  * invoice.
@@ -765,220 +818,83 @@ export declare namespace InvoiceCreateParams {
765
818
  include_platform_defaults: boolean;
766
819
  }
767
820
  }
768
- }
769
-
770
- export interface CreateInvoiceInputWithProductIDAndEmailAddress {
771
- /**
772
- * How the invoice should be collected. Use charge_automatically to charge a stored
773
- * payment method, or send_invoice to email the customer.
774
- */
775
- collection_method: Shared.CollectionMethod;
776
-
777
- /**
778
- * The unique identifier of the company to create this invoice for.
779
- */
780
- company_id: string;
781
-
782
- /**
783
- * The date by which the invoice must be paid.
784
- */
785
- due_date: string;
786
-
787
- /**
788
- * The email address of the customer. Required when creating an invoice for a
789
- * customer who is not yet a member of the company.
790
- */
791
- email_address: string;
792
-
793
- /**
794
- * The plan attributes defining the price, currency, and billing interval for this
795
- * invoice.
796
- */
797
- plan: CreateInvoiceInputWithProductIDAndEmailAddress.Plan;
798
-
799
- /**
800
- * The unique identifier of an existing product to create this invoice for.
801
- */
802
- product_id: string;
803
-
804
- /**
805
- * The date and time when the invoice will be automatically finalized and charged.
806
- * Only valid when collection_method is charge_automatically. If not provided, the
807
- * charge will be processed immediately.
808
- */
809
- automatically_finalizes_at?: string | null;
810
-
811
- /**
812
- * Whether to charge the customer a buyer fee on this invoice.
813
- */
814
- charge_buyer_fee?: boolean | null;
815
-
816
- /**
817
- * The name of the customer. Required when creating an invoice for a customer who
818
- * is not yet a member of the company.
819
- */
820
- customer_name?: string | null;
821
-
822
- /**
823
- * The unique identifier of the payment method to charge. Required when
824
- * collection_method is charge_automatically.
825
- */
826
- payment_method_id?: string | null;
827
821
 
828
822
  /**
829
- * The payment token ID to use for this invoice. If using charge_automatically, you
830
- * must provide a payment_token.
823
+ * Inline billing address to create a new mailing address for this invoice. Cannot
824
+ * be used together with mailing_address_id.
831
825
  */
832
- payment_token_id?: string | null;
833
- }
834
-
835
- export namespace CreateInvoiceInputWithProductIDAndEmailAddress {
836
- /**
837
- * The plan attributes defining the price, currency, and billing interval for this
838
- * invoice.
839
- */
840
- export interface Plan {
841
- /**
842
- * The interval in days at which the plan charges (renewal plans).
843
- */
844
- billing_period?: number | null;
845
-
846
- /**
847
- * An array of custom field objects.
848
- */
849
- custom_fields?: Array<Plan.CustomField> | null;
850
-
826
+ export interface BillingAddress {
851
827
  /**
852
- * The description of the plan.
828
+ * The city of the address.
853
829
  */
854
- description?: string | null;
830
+ city?: string | null;
855
831
 
856
832
  /**
857
- * The number of days until the membership expires and revokes access (expiration
858
- * plans). For example, 365 for a one-year access period.
833
+ * The country of the address.
859
834
  */
860
- expiration_days?: number | null;
835
+ country?: string | null;
861
836
 
862
837
  /**
863
- * An additional amount charged upon first purchase. Use only if a one time payment
864
- * OR you want to charge an additional amount on top of the renewal price. Provided
865
- * as a number in the specified currency. Eg: 10.43 for $10.43
838
+ * The line 1 of the address.
866
839
  */
867
- initial_price?: number | null;
840
+ line1?: string | null;
868
841
 
869
842
  /**
870
- * A personal description or notes section for the business.
843
+ * The line 2 of the address.
871
844
  */
872
- internal_notes?: string | null;
845
+ line2?: string | null;
873
846
 
874
847
  /**
875
- * Whether this plan uses legacy payment method controls
848
+ * The name of the customer.
876
849
  */
877
- legacy_payment_method_controls?: boolean | null;
850
+ name?: string | null;
878
851
 
879
852
  /**
880
- * The explicit payment method configuration for the plan. If not provided, the
881
- * platform or company's defaults will apply.
853
+ * The phone number of the customer.
882
854
  */
883
- payment_method_configuration?: Plan.PaymentMethodConfiguration | null;
855
+ phone?: string | null;
884
856
 
885
857
  /**
886
- * The type of plan that can be attached to a product
858
+ * The postal code of the address.
887
859
  */
888
- plan_type?: Shared.PlanType | null;
860
+ postal_code?: string | null;
889
861
 
890
862
  /**
891
- * The methods of how a plan can be released.
863
+ * The state of the address.
892
864
  */
893
- release_method?: Shared.ReleaseMethod | null;
865
+ state?: string | null;
894
866
 
895
867
  /**
896
- * The amount the customer is charged every billing period. Use only if a recurring
897
- * payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43
868
+ * The type of tax identifier
898
869
  */
899
- renewal_price?: number | null;
870
+ tax_id_type?: InvoicesAPI.TaxIdentifierType | null;
900
871
 
901
872
  /**
902
- * The number of units available for purchase.
873
+ * The value of the tax identifier.
903
874
  */
904
- stock?: number | null;
875
+ tax_id_value?: string | null;
876
+ }
905
877
 
878
+ /**
879
+ * A single line item to include on the invoice, with a label, quantity, and unit
880
+ * price.
881
+ */
882
+ export interface LineItem {
906
883
  /**
907
- * The number of free trial days added before a renewal plan.
884
+ * The label or description for this line item.
908
885
  */
909
- trial_period_days?: number | null;
886
+ label: string;
910
887
 
911
888
  /**
912
- * When true, the plan has unlimited stock (stock field is ignored). When false,
913
- * purchases are limited by the stock field.
889
+ * The unit price for this line item. Provided as a number in the specified
890
+ * currency. Eg: 10.43 for $10.43
914
891
  */
915
- unlimited_stock?: boolean | null;
892
+ unit_price: number;
916
893
 
917
894
  /**
918
- * Visibility of a resource
895
+ * The quantity of this line item. Defaults to 1.
919
896
  */
920
- visibility?: Shared.Visibility | null;
921
- }
922
-
923
- export namespace Plan {
924
- export interface CustomField {
925
- /**
926
- * The type of the custom field.
927
- */
928
- field_type: 'text';
929
-
930
- /**
931
- * The name of the custom field.
932
- */
933
- name: string;
934
-
935
- /**
936
- * The ID of the custom field (if being updated)
937
- */
938
- id?: string | null;
939
-
940
- /**
941
- * The order of the field.
942
- */
943
- order?: number | null;
944
-
945
- /**
946
- * The placeholder value of the field.
947
- */
948
- placeholder?: string | null;
949
-
950
- /**
951
- * Whether or not the field is required.
952
- */
953
- required?: boolean | null;
954
- }
955
-
956
- /**
957
- * The explicit payment method configuration for the plan. If not provided, the
958
- * platform or company's defaults will apply.
959
- */
960
- export interface PaymentMethodConfiguration {
961
- /**
962
- * An array of payment method identifiers that are explicitly disabled. Only
963
- * applies if the include_platform_defaults is true.
964
- */
965
- disabled: Array<PaymentsAPI.PaymentMethodTypes>;
966
-
967
- /**
968
- * An array of payment method identifiers that are explicitly enabled. This means
969
- * these payment methods will be shown on checkout. Example use case is to only
970
- * enable a specific payment method like cashapp, or extending the platform
971
- * defaults with additional methods.
972
- */
973
- enabled: Array<PaymentsAPI.PaymentMethodTypes>;
974
-
975
- /**
976
- * Whether Whop's platform default payment method enablement settings are included
977
- * in this configuration. The full list of default payment methods can be found in
978
- * the documentation at docs.whop.com/payments.
979
- */
980
- include_platform_defaults: boolean;
981
- }
897
+ quantity?: number | null;
982
898
  }
983
899
  }
984
900
  }
@@ -1043,6 +959,9 @@ export interface InvoiceListParams extends CursorPageParams {
1043
959
 
1044
960
  export declare namespace Invoices {
1045
961
  export {
962
+ type TaxIdentifierType as TaxIdentifierType,
963
+ type InvoiceMarkPaidResponse as InvoiceMarkPaidResponse,
964
+ type InvoiceMarkUncollectibleResponse as InvoiceMarkUncollectibleResponse,
1046
965
  type InvoiceVoidResponse as InvoiceVoidResponse,
1047
966
  type InvoiceCreateParams as InvoiceCreateParams,
1048
967
  type InvoiceListParams as InvoiceListParams,