@whop/sdk 0.0.34 → 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 (139) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/client.d.mts +12 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +12 -6
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +7 -1
  9. package/client.mjs.map +1 -1
  10. package/internal/utils/env.js +2 -2
  11. package/internal/utils/env.js.map +1 -1
  12. package/internal/utils/env.mjs +2 -2
  13. package/internal/utils/env.mjs.map +1 -1
  14. package/package.json +1 -1
  15. package/resources/affiliates/affiliates.d.mts +353 -0
  16. package/resources/affiliates/affiliates.d.mts.map +1 -0
  17. package/resources/affiliates/affiliates.d.ts +353 -0
  18. package/resources/affiliates/affiliates.d.ts.map +1 -0
  19. package/resources/affiliates/affiliates.js +112 -0
  20. package/resources/affiliates/affiliates.js.map +1 -0
  21. package/resources/affiliates/affiliates.mjs +107 -0
  22. package/resources/affiliates/affiliates.mjs.map +1 -0
  23. package/resources/affiliates/index.d.mts +3 -0
  24. package/resources/affiliates/index.d.mts.map +1 -0
  25. package/resources/affiliates/index.d.ts +3 -0
  26. package/resources/affiliates/index.d.ts.map +1 -0
  27. package/resources/affiliates/index.js +9 -0
  28. package/resources/affiliates/index.js.map +1 -0
  29. package/resources/affiliates/index.mjs +4 -0
  30. package/resources/affiliates/index.mjs.map +1 -0
  31. package/resources/affiliates/overrides.d.mts +451 -0
  32. package/resources/affiliates/overrides.d.mts.map +1 -0
  33. package/resources/affiliates/overrides.d.ts +451 -0
  34. package/resources/affiliates/overrides.d.ts.map +1 -0
  35. package/resources/affiliates/overrides.js +117 -0
  36. package/resources/affiliates/overrides.js.map +1 -0
  37. package/resources/affiliates/overrides.mjs +113 -0
  38. package/resources/affiliates/overrides.mjs.map +1 -0
  39. package/resources/affiliates.d.mts +2 -0
  40. package/resources/affiliates.d.mts.map +1 -0
  41. package/resources/affiliates.d.ts +2 -0
  42. package/resources/affiliates.d.ts.map +1 -0
  43. package/resources/affiliates.js +6 -0
  44. package/resources/affiliates.js.map +1 -0
  45. package/resources/affiliates.mjs +3 -0
  46. package/resources/affiliates.mjs.map +1 -0
  47. package/resources/ai-chats.d.mts +21 -2
  48. package/resources/ai-chats.d.mts.map +1 -1
  49. package/resources/ai-chats.d.ts +21 -2
  50. package/resources/ai-chats.d.ts.map +1 -1
  51. package/resources/ai-chats.js +2 -1
  52. package/resources/ai-chats.js.map +1 -1
  53. package/resources/ai-chats.mjs +2 -1
  54. package/resources/ai-chats.mjs.map +1 -1
  55. package/resources/apps.d.mts +26 -0
  56. package/resources/apps.d.mts.map +1 -1
  57. package/resources/apps.d.ts +26 -0
  58. package/resources/apps.d.ts.map +1 -1
  59. package/resources/checkout-configurations.d.mts +69 -0
  60. package/resources/checkout-configurations.d.mts.map +1 -1
  61. package/resources/checkout-configurations.d.ts +69 -0
  62. package/resources/checkout-configurations.d.ts.map +1 -1
  63. package/resources/companies.d.mts +19 -0
  64. package/resources/companies.d.mts.map +1 -1
  65. package/resources/companies.d.ts +19 -0
  66. package/resources/companies.d.ts.map +1 -1
  67. package/resources/index.d.mts +4 -3
  68. package/resources/index.d.mts.map +1 -1
  69. package/resources/index.d.ts +4 -3
  70. package/resources/index.d.ts.map +1 -1
  71. package/resources/index.js +4 -2
  72. package/resources/index.js.map +1 -1
  73. package/resources/index.mjs +1 -0
  74. package/resources/index.mjs.map +1 -1
  75. package/resources/invoices.d.mts +179 -345
  76. package/resources/invoices.d.mts.map +1 -1
  77. package/resources/invoices.d.ts +179 -345
  78. package/resources/invoices.d.ts.map +1 -1
  79. package/resources/invoices.js +20 -2
  80. package/resources/invoices.js.map +1 -1
  81. package/resources/invoices.mjs +20 -2
  82. package/resources/invoices.mjs.map +1 -1
  83. package/resources/memberships.d.mts +1 -1
  84. package/resources/memberships.d.mts.map +1 -1
  85. package/resources/memberships.d.ts +1 -1
  86. package/resources/memberships.d.ts.map +1 -1
  87. package/resources/payments.d.mts +21 -2
  88. package/resources/payments.d.mts.map +1 -1
  89. package/resources/payments.d.ts +21 -2
  90. package/resources/payments.d.ts.map +1 -1
  91. package/resources/plans.d.mts +46 -0
  92. package/resources/plans.d.mts.map +1 -1
  93. package/resources/plans.d.ts +46 -0
  94. package/resources/plans.d.ts.map +1 -1
  95. package/resources/products.d.mts +2 -2
  96. package/resources/products.d.ts +2 -2
  97. package/resources/refunds.d.mts +1 -1
  98. package/resources/refunds.d.mts.map +1 -1
  99. package/resources/refunds.d.ts +1 -1
  100. package/resources/refunds.d.ts.map +1 -1
  101. package/resources/setup-intents.d.mts +74 -0
  102. package/resources/setup-intents.d.mts.map +1 -1
  103. package/resources/setup-intents.d.ts +74 -0
  104. package/resources/setup-intents.d.ts.map +1 -1
  105. package/resources/shared.d.mts +54 -5
  106. package/resources/shared.d.mts.map +1 -1
  107. package/resources/shared.d.ts +54 -5
  108. package/resources/shared.d.ts.map +1 -1
  109. package/resources/webhooks.d.mts +653 -3
  110. package/resources/webhooks.d.mts.map +1 -1
  111. package/resources/webhooks.d.ts +653 -3
  112. package/resources/webhooks.d.ts.map +1 -1
  113. package/resources/webhooks.js.map +1 -1
  114. package/resources/webhooks.mjs.map +1 -1
  115. package/src/client.ts +50 -1
  116. package/src/internal/utils/env.ts +2 -2
  117. package/src/resources/affiliates/affiliates.ts +475 -0
  118. package/src/resources/affiliates/index.ts +32 -0
  119. package/src/resources/affiliates/overrides.ts +593 -0
  120. package/src/resources/affiliates.ts +3 -0
  121. package/src/resources/ai-chats.ts +25 -1
  122. package/src/resources/apps.ts +31 -0
  123. package/src/resources/checkout-configurations.ts +81 -0
  124. package/src/resources/companies.ts +23 -0
  125. package/src/resources/index.ts +19 -0
  126. package/src/resources/invoices.ts +316 -397
  127. package/src/resources/memberships.ts +1 -1
  128. package/src/resources/payments.ts +26 -1
  129. package/src/resources/plans.ts +54 -0
  130. package/src/resources/products.ts +2 -2
  131. package/src/resources/refunds.ts +2 -1
  132. package/src/resources/setup-intents.ts +90 -0
  133. package/src/resources/shared.ts +65 -5
  134. package/src/resources/webhooks.ts +818 -0
  135. package/src/version.ts +1 -1
  136. package/version.d.mts +1 -1
  137. package/version.d.ts +1 -1
  138. package/version.js +1 -1
  139. package/version.mjs +1 -1
@@ -1,4 +1,5 @@
1
1
  import { APIResource } from "../core/resource.js";
2
+ import * as InvoicesAPI from "./invoices.js";
2
3
  import * as PaymentsAPI from "./payments.js";
3
4
  import * as Shared from "./shared.js";
4
5
  import { InvoiceListItemsCursorPage } from "./shared.js";
@@ -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
  * });
@@ -47,6 +46,22 @@ export declare class Invoices extends APIResource {
47
46
  * - `invoice:basic:read`
48
47
  */
49
48
  list(query?: InvoiceListParams | null | undefined, options?: RequestOptions): PagePromise<InvoiceListItemsCursorPage, Shared.InvoiceListItem>;
49
+ /**
50
+ * Mark an open invoice as paid when payment was collected outside of Whop.
51
+ *
52
+ * Required permissions:
53
+ *
54
+ * - `invoice:update`
55
+ */
56
+ markPaid(id: string, options?: RequestOptions): APIPromise<InvoiceMarkPaidResponse>;
57
+ /**
58
+ * Mark an open invoice as uncollectible when payment is not expected.
59
+ *
60
+ * Required permissions:
61
+ *
62
+ * - `invoice:update`
63
+ */
64
+ markUncollectible(id: string, options?: RequestOptions): APIPromise<InvoiceMarkUncollectibleResponse>;
50
65
  /**
51
66
  * Void an open invoice so it can no longer be paid. Voiding is permanent and
52
67
  * cannot be undone.
@@ -57,13 +72,25 @@ export declare class Invoices extends APIResource {
57
72
  */
58
73
  void(id: string, options?: RequestOptions): APIPromise<InvoiceVoidResponse>;
59
74
  }
75
+ /**
76
+ * The type of tax identifier
77
+ */
78
+ 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';
79
+ /**
80
+ * Represents `true` or `false` values.
81
+ */
82
+ export type InvoiceMarkPaidResponse = boolean;
83
+ /**
84
+ * Represents `true` or `false` values.
85
+ */
86
+ export type InvoiceMarkUncollectibleResponse = boolean;
60
87
  /**
61
88
  * Represents `true` or `false` values.
62
89
  */
63
90
  export type InvoiceVoidResponse = boolean;
64
- export type InvoiceCreateParams = InvoiceCreateParams.CreateInvoiceInputWithProductAndMemberID | InvoiceCreateParams.CreateInvoiceInputWithProductAndEmailAddress | InvoiceCreateParams.CreateInvoiceInputWithProductIDAndMemberID | InvoiceCreateParams.CreateInvoiceInputWithProductIDAndEmailAddress;
91
+ export type InvoiceCreateParams = InvoiceCreateParams.CreateInvoiceInputWithProduct | InvoiceCreateParams.CreateInvoiceInputWithProductID;
65
92
  export declare namespace InvoiceCreateParams {
66
- interface CreateInvoiceInputWithProductAndMemberID {
93
+ interface CreateInvoiceInputWithProduct {
67
94
  /**
68
95
  * How the invoice should be collected. Use charge_automatically to charge a stored
69
96
  * payment method, or send_invoice to email the customer.
@@ -73,31 +100,27 @@ export declare namespace InvoiceCreateParams {
73
100
  * The unique identifier of the company to create this invoice for.
74
101
  */
75
102
  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
103
  /**
86
104
  * The plan attributes defining the price, currency, and billing interval for this
87
105
  * invoice.
88
106
  */
89
- plan: CreateInvoiceInputWithProductAndMemberID.Plan;
107
+ plan: CreateInvoiceInputWithProduct.Plan;
90
108
  /**
91
109
  * The properties of the product to create for this invoice. Provide this to create
92
110
  * a new product inline.
93
111
  */
94
- product: CreateInvoiceInputWithProductAndMemberID.Product;
112
+ product: CreateInvoiceInputWithProduct.Product;
95
113
  /**
96
114
  * The date and time when the invoice will be automatically finalized and charged.
97
115
  * Only valid when collection_method is charge_automatically. If not provided, the
98
116
  * charge will be processed immediately.
99
117
  */
100
118
  automatically_finalizes_at?: string | null;
119
+ /**
120
+ * Inline billing address to create a new mailing address for this invoice. Cannot
121
+ * be used together with mailing_address_id.
122
+ */
123
+ billing_address?: CreateInvoiceInputWithProduct.BillingAddress | null;
101
124
  /**
102
125
  * Whether to charge the customer a buyer fee on this invoice.
103
126
  */
@@ -107,6 +130,31 @@ export declare namespace InvoiceCreateParams {
107
130
  * is not yet a member of the company.
108
131
  */
109
132
  customer_name?: string | null;
133
+ /**
134
+ * The date by which the invoice must be paid. Required unless save_as_draft is
135
+ * true.
136
+ */
137
+ due_date?: string | null;
138
+ /**
139
+ * The email address of the customer. Required when creating an invoice for a
140
+ * customer who is not yet a member of the company.
141
+ */
142
+ email_address?: string | null;
143
+ /**
144
+ * Optional line items that break down the invoice total. When provided, the sum of
145
+ * (quantity \* unit_price) for all items must equal the plan price.
146
+ */
147
+ line_items?: Array<CreateInvoiceInputWithProduct.LineItem> | null;
148
+ /**
149
+ * The unique identifier of an existing mailing address to attach to this invoice.
150
+ * Cannot be used together with billing_address.
151
+ */
152
+ mailing_address_id?: string | null;
153
+ /**
154
+ * The unique identifier of an existing member to create this invoice for. If not
155
+ * provided, you must supply an email_address and customer_name.
156
+ */
157
+ member_id?: string | null;
110
158
  /**
111
159
  * The unique identifier of the payment method to charge. Required when
112
160
  * collection_method is charge_automatically.
@@ -117,8 +165,13 @@ export declare namespace InvoiceCreateParams {
117
165
  * must provide a payment_token.
118
166
  */
119
167
  payment_token_id?: string | null;
168
+ /**
169
+ * When true, creates the invoice as a draft without sending or charging. Relaxes
170
+ * customer and due date requirements.
171
+ */
172
+ save_as_draft?: boolean | null;
120
173
  }
121
- namespace CreateInvoiceInputWithProductAndMemberID {
174
+ namespace CreateInvoiceInputWithProduct {
122
175
  /**
123
176
  * The plan attributes defining the price, currency, and billing interval for this
124
177
  * invoice.
@@ -257,203 +310,73 @@ export declare namespace InvoiceCreateParams {
257
310
  */
258
311
  product_tax_code_id?: string | null;
259
312
  }
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
- /**
268
- * The unique identifier of the company to create this invoice for.
269
- */
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
313
  /**
318
- * The plan attributes defining the price, currency, and billing interval for this
319
- * invoice.
314
+ * Inline billing address to create a new mailing address for this invoice. Cannot
315
+ * be used together with mailing_address_id.
320
316
  */
321
- interface Plan {
317
+ interface BillingAddress {
322
318
  /**
323
- * The interval in days at which the plan charges (renewal plans).
319
+ * The city of the address.
324
320
  */
325
- billing_period?: number | null;
321
+ city?: string | null;
326
322
  /**
327
- * An array of custom field objects.
323
+ * The country of the address.
328
324
  */
329
- custom_fields?: Array<Plan.CustomField> | null;
325
+ country?: string | null;
330
326
  /**
331
- * The description of the plan.
327
+ * The line 1 of the address.
332
328
  */
333
- description?: string | null;
329
+ line1?: string | null;
334
330
  /**
335
- * The number of days until the membership expires and revokes access (expiration
336
- * plans). For example, 365 for a one-year access period.
331
+ * The line 2 of the address.
337
332
  */
338
- expiration_days?: number | null;
333
+ line2?: string | null;
339
334
  /**
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
335
+ * The name of the customer.
343
336
  */
344
- initial_price?: number | null;
337
+ name?: string | null;
345
338
  /**
346
- * A personal description or notes section for the business.
339
+ * The phone number of the customer.
347
340
  */
348
- internal_notes?: string | null;
341
+ phone?: string | null;
349
342
  /**
350
- * Whether this plan uses legacy payment method controls
343
+ * The postal code of the address.
351
344
  */
352
- legacy_payment_method_controls?: boolean | null;
345
+ postal_code?: string | null;
353
346
  /**
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.
364
- */
365
- release_method?: Shared.ReleaseMethod | null;
366
- /**
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
369
- */
370
- renewal_price?: number | null;
371
- /**
372
- * The number of units available for purchase.
373
- */
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.
347
+ * The state of the address.
382
348
  */
383
- unlimited_stock?: boolean | null;
349
+ state?: string | null;
384
350
  /**
385
- * Visibility of a resource
351
+ * The type of tax identifier
386
352
  */
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
- }
353
+ tax_id_type?: InvoicesAPI.TaxIdentifierType | null;
416
354
  /**
417
- * The explicit payment method configuration for the plan. If not provided, the
418
- * platform or company's defaults will apply.
355
+ * The value of the tax identifier.
419
356
  */
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
- }
357
+ tax_id_value?: string | null;
440
358
  }
441
359
  /**
442
- * The properties of the product to create for this invoice. Provide this to create
443
- * a new product inline.
360
+ * A single line item to include on the invoice, with a label, quantity, and unit
361
+ * price.
444
362
  */
445
- interface Product {
363
+ interface LineItem {
446
364
  /**
447
- * The title of the product.
365
+ * The label or description for this line item.
448
366
  */
449
- title: string;
367
+ label: string;
450
368
  /**
451
- * The ID of the product tax code to apply to this product.
369
+ * The unit price for this line item. Provided as a number in the specified
370
+ * currency. Eg: 10.43 for $10.43
452
371
  */
453
- product_tax_code_id?: string | null;
372
+ unit_price: number;
373
+ /**
374
+ * The quantity of this line item. Defaults to 1.
375
+ */
376
+ quantity?: number | null;
454
377
  }
455
378
  }
456
- interface CreateInvoiceInputWithProductIDAndMemberID {
379
+ interface CreateInvoiceInputWithProductID {
457
380
  /**
458
381
  * How the invoice should be collected. Use charge_automatically to charge a stored
459
382
  * payment method, or send_invoice to email the customer.
@@ -463,20 +386,11 @@ export declare namespace InvoiceCreateParams {
463
386
  * The unique identifier of the company to create this invoice for.
464
387
  */
465
388
  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
389
  /**
476
390
  * The plan attributes defining the price, currency, and billing interval for this
477
391
  * invoice.
478
392
  */
479
- plan: CreateInvoiceInputWithProductIDAndMemberID.Plan;
393
+ plan: CreateInvoiceInputWithProductID.Plan;
480
394
  /**
481
395
  * The unique identifier of an existing product to create this invoice for.
482
396
  */
@@ -487,6 +401,11 @@ export declare namespace InvoiceCreateParams {
487
401
  * charge will be processed immediately.
488
402
  */
489
403
  automatically_finalizes_at?: string | null;
404
+ /**
405
+ * Inline billing address to create a new mailing address for this invoice. Cannot
406
+ * be used together with mailing_address_id.
407
+ */
408
+ billing_address?: CreateInvoiceInputWithProductID.BillingAddress | null;
490
409
  /**
491
410
  * Whether to charge the customer a buyer fee on this invoice.
492
411
  */
@@ -496,6 +415,31 @@ export declare namespace InvoiceCreateParams {
496
415
  * is not yet a member of the company.
497
416
  */
498
417
  customer_name?: string | null;
418
+ /**
419
+ * The date by which the invoice must be paid. Required unless save_as_draft is
420
+ * true.
421
+ */
422
+ due_date?: string | null;
423
+ /**
424
+ * The email address of the customer. Required when creating an invoice for a
425
+ * customer who is not yet a member of the company.
426
+ */
427
+ email_address?: string | null;
428
+ /**
429
+ * Optional line items that break down the invoice total. When provided, the sum of
430
+ * (quantity \* unit_price) for all items must equal the plan price.
431
+ */
432
+ line_items?: Array<CreateInvoiceInputWithProductID.LineItem> | null;
433
+ /**
434
+ * The unique identifier of an existing mailing address to attach to this invoice.
435
+ * Cannot be used together with billing_address.
436
+ */
437
+ mailing_address_id?: string | null;
438
+ /**
439
+ * The unique identifier of an existing member to create this invoice for. If not
440
+ * provided, you must supply an email_address and customer_name.
441
+ */
442
+ member_id?: string | null;
499
443
  /**
500
444
  * The unique identifier of the payment method to charge. Required when
501
445
  * collection_method is charge_automatically.
@@ -506,8 +450,13 @@ export declare namespace InvoiceCreateParams {
506
450
  * must provide a payment_token.
507
451
  */
508
452
  payment_token_id?: string | null;
453
+ /**
454
+ * When true, creates the invoice as a draft without sending or charging. Relaxes
455
+ * customer and due date requirements.
456
+ */
457
+ save_as_draft?: boolean | null;
509
458
  }
510
- namespace CreateInvoiceInputWithProductIDAndMemberID {
459
+ namespace CreateInvoiceInputWithProductID {
511
460
  /**
512
461
  * The plan attributes defining the price, currency, and billing interval for this
513
462
  * invoice.
@@ -632,185 +581,70 @@ export declare namespace InvoiceCreateParams {
632
581
  include_platform_defaults: boolean;
633
582
  }
634
583
  }
635
- }
636
- interface CreateInvoiceInputWithProductIDAndEmailAddress {
637
- /**
638
- * How the invoice should be collected. Use charge_automatically to charge a stored
639
- * payment method, or send_invoice to email the customer.
640
- */
641
- collection_method: Shared.CollectionMethod;
642
- /**
643
- * The unique identifier of the company to create this invoice for.
644
- */
645
- company_id: string;
646
- /**
647
- * The date by which the invoice must be paid.
648
- */
649
- due_date: string;
650
- /**
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.
653
- */
654
- email_address: string;
655
- /**
656
- * The plan attributes defining the price, currency, and billing interval for this
657
- * invoice.
658
- */
659
- plan: CreateInvoiceInputWithProductIDAndEmailAddress.Plan;
660
- /**
661
- * The unique identifier of an existing product to create this invoice for.
662
- */
663
- product_id: string;
664
- /**
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.
668
- */
669
- automatically_finalizes_at?: string | null;
670
584
  /**
671
- * Whether to charge the customer a buyer fee on this invoice.
585
+ * Inline billing address to create a new mailing address for this invoice. Cannot
586
+ * be used together with mailing_address_id.
672
587
  */
673
- charge_buyer_fee?: boolean | null;
674
- /**
675
- * The name of the customer. Required when creating an invoice for a customer who
676
- * is not yet a member of the company.
677
- */
678
- customer_name?: string | null;
679
- /**
680
- * The unique identifier of the payment method to charge. Required when
681
- * collection_method is charge_automatically.
682
- */
683
- payment_method_id?: string | null;
684
- /**
685
- * The payment token ID to use for this invoice. If using charge_automatically, you
686
- * must provide a payment_token.
687
- */
688
- payment_token_id?: string | null;
689
- }
690
- namespace CreateInvoiceInputWithProductIDAndEmailAddress {
691
- /**
692
- * The plan attributes defining the price, currency, and billing interval for this
693
- * invoice.
694
- */
695
- interface Plan {
696
- /**
697
- * The interval in days at which the plan charges (renewal plans).
698
- */
699
- billing_period?: number | null;
588
+ interface BillingAddress {
700
589
  /**
701
- * An array of custom field objects.
590
+ * The city of the address.
702
591
  */
703
- custom_fields?: Array<Plan.CustomField> | null;
592
+ city?: string | null;
704
593
  /**
705
- * The description of the plan.
594
+ * The country of the address.
706
595
  */
707
- description?: string | null;
596
+ country?: string | null;
708
597
  /**
709
- * The number of days until the membership expires and revokes access (expiration
710
- * plans). For example, 365 for a one-year access period.
598
+ * The line 1 of the address.
711
599
  */
712
- expiration_days?: number | null;
600
+ line1?: string | null;
713
601
  /**
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
602
+ * The line 2 of the address.
717
603
  */
718
- initial_price?: number | null;
604
+ line2?: string | null;
719
605
  /**
720
- * A personal description or notes section for the business.
606
+ * The name of the customer.
721
607
  */
722
- internal_notes?: string | null;
608
+ name?: string | null;
723
609
  /**
724
- * Whether this plan uses legacy payment method controls
610
+ * The phone number of the customer.
725
611
  */
726
- legacy_payment_method_controls?: boolean | null;
612
+ phone?: string | null;
727
613
  /**
728
- * The explicit payment method configuration for the plan. If not provided, the
729
- * platform or company's defaults will apply.
614
+ * The postal code of the address.
730
615
  */
731
- payment_method_configuration?: Plan.PaymentMethodConfiguration | null;
616
+ postal_code?: string | null;
732
617
  /**
733
- * The type of plan that can be attached to a product
618
+ * The state of the address.
734
619
  */
735
- plan_type?: Shared.PlanType | null;
620
+ state?: string | null;
736
621
  /**
737
- * The methods of how a plan can be released.
622
+ * The type of tax identifier
738
623
  */
739
- release_method?: Shared.ReleaseMethod | null;
740
- /**
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
743
- */
744
- renewal_price?: number | null;
624
+ tax_id_type?: InvoicesAPI.TaxIdentifierType | null;
745
625
  /**
746
- * The number of units available for purchase.
747
- */
748
- stock?: number | null;
749
- /**
750
- * The number of free trial days added before a renewal plan.
626
+ * The value of the tax identifier.
751
627
  */
752
- trial_period_days?: number | null;
628
+ tax_id_value?: string | null;
629
+ }
630
+ /**
631
+ * A single line item to include on the invoice, with a label, quantity, and unit
632
+ * price.
633
+ */
634
+ interface LineItem {
753
635
  /**
754
- * When true, the plan has unlimited stock (stock field is ignored). When false,
755
- * purchases are limited by the stock field.
636
+ * The label or description for this line item.
756
637
  */
757
- unlimited_stock?: boolean | null;
638
+ label: string;
758
639
  /**
759
- * Visibility of a resource
640
+ * The unit price for this line item. Provided as a number in the specified
641
+ * currency. Eg: 10.43 for $10.43
760
642
  */
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
- }
643
+ unit_price: number;
790
644
  /**
791
- * The explicit payment method configuration for the plan. If not provided, the
792
- * platform or company's defaults will apply.
645
+ * The quantity of this line item. Defaults to 1.
793
646
  */
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
- }
647
+ quantity?: number | null;
814
648
  }
815
649
  }
816
650
  }
@@ -862,7 +696,7 @@ export interface InvoiceListParams extends CursorPageParams {
862
696
  statuses?: Array<Shared.InvoiceStatus> | null;
863
697
  }
864
698
  export declare namespace Invoices {
865
- export { type InvoiceVoidResponse as InvoiceVoidResponse, type InvoiceCreateParams as InvoiceCreateParams, type InvoiceListParams as InvoiceListParams, };
699
+ export { type TaxIdentifierType as TaxIdentifierType, type InvoiceMarkPaidResponse as InvoiceMarkPaidResponse, type InvoiceMarkUncollectibleResponse as InvoiceMarkUncollectibleResponse, type InvoiceVoidResponse as InvoiceVoidResponse, type InvoiceCreateParams as InvoiceCreateParams, type InvoiceListParams as InvoiceListParams, };
866
700
  }
867
701
  export { type InvoiceListItemsCursorPage };
868
702
  //# sourceMappingURL=invoices.d.ts.map