@whop/sdk 0.0.36 → 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 (54) hide show
  1. package/CHANGELOG.md +14 -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.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/checkout-configurations.d.mts +7 -6
  10. package/resources/checkout-configurations.d.mts.map +1 -1
  11. package/resources/checkout-configurations.d.ts +7 -6
  12. package/resources/checkout-configurations.d.ts.map +1 -1
  13. package/resources/checkout-configurations.js.map +1 -1
  14. package/resources/checkout-configurations.mjs.map +1 -1
  15. package/resources/index.d.mts +2 -2
  16. package/resources/index.d.mts.map +1 -1
  17. package/resources/index.d.ts +2 -2
  18. package/resources/index.d.ts.map +1 -1
  19. package/resources/index.js.map +1 -1
  20. package/resources/index.mjs.map +1 -1
  21. package/resources/invoices.d.mts +310 -1
  22. package/resources/invoices.d.mts.map +1 -1
  23. package/resources/invoices.d.ts +310 -1
  24. package/resources/invoices.d.ts.map +1 -1
  25. package/resources/invoices.js +70 -0
  26. package/resources/invoices.js.map +1 -1
  27. package/resources/invoices.mjs +70 -0
  28. package/resources/invoices.mjs.map +1 -1
  29. package/resources/payments.d.mts +1 -1
  30. package/resources/payments.d.mts.map +1 -1
  31. package/resources/payments.d.ts +1 -1
  32. package/resources/payments.d.ts.map +1 -1
  33. package/resources/plans.d.mts +14 -5
  34. package/resources/plans.d.mts.map +1 -1
  35. package/resources/plans.d.ts +14 -5
  36. package/resources/plans.d.ts.map +1 -1
  37. package/resources/plans.js.map +1 -1
  38. package/resources/plans.mjs.map +1 -1
  39. package/resources/refunds.d.mts +1 -1
  40. package/resources/refunds.d.mts.map +1 -1
  41. package/resources/refunds.d.ts +1 -1
  42. package/resources/refunds.d.ts.map +1 -1
  43. package/src/client.ts +8 -0
  44. package/src/resources/checkout-configurations.ts +7 -6
  45. package/src/resources/index.ts +4 -0
  46. package/src/resources/invoices.ts +371 -0
  47. package/src/resources/payments.ts +6 -0
  48. package/src/resources/plans.ts +17 -4
  49. package/src/resources/refunds.ts +2 -1
  50. package/src/version.ts +1 -1
  51. package/version.d.mts +1 -1
  52. package/version.d.ts +1 -1
  53. package/version.js +1 -1
  54. package/version.mjs +1 -1
@@ -42,11 +42,40 @@ export class Invoices extends APIResource {
42
42
  * Required permissions:
43
43
  *
44
44
  * - `invoice:basic:read`
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const invoice = await client.invoices.retrieve(
49
+ * 'inv_xxxxxxxxxxxxxx',
50
+ * );
51
+ * ```
45
52
  */
46
53
  retrieve(id: string, options?: RequestOptions): APIPromise<Shared.Invoice> {
47
54
  return this._client.get(path`/invoices/${id}`, options);
48
55
  }
49
56
 
57
+ /**
58
+ * Update a draft invoice's details.
59
+ *
60
+ * Required permissions:
61
+ *
62
+ * - `invoice:update`
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const invoice = await client.invoices.update(
67
+ * 'inv_xxxxxxxxxxxxxx',
68
+ * );
69
+ * ```
70
+ */
71
+ update(
72
+ id: string,
73
+ body: InvoiceUpdateParams | null | undefined = {},
74
+ options?: RequestOptions,
75
+ ): APIPromise<Shared.Invoice> {
76
+ return this._client.patch(path`/invoices/${id}`, { body, ...options });
77
+ }
78
+
50
79
  /**
51
80
  * Returns a paginated list of invoices for a company, with optional filtering by
52
81
  * product, status, collection method, and creation date.
@@ -54,6 +83,14 @@ export class Invoices extends APIResource {
54
83
  * Required permissions:
55
84
  *
56
85
  * - `invoice:basic:read`
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * // Automatically fetches more pages as needed.
90
+ * for await (const invoiceListItem of client.invoices.list()) {
91
+ * // ...
92
+ * }
93
+ * ```
57
94
  */
58
95
  list(
59
96
  query: InvoiceListParams | null | undefined = {},
@@ -62,12 +99,37 @@ export class Invoices extends APIResource {
62
99
  return this._client.getAPIList('/invoices', CursorPage<Shared.InvoiceListItem>, { query, ...options });
63
100
  }
64
101
 
102
+ /**
103
+ * Delete a draft invoice.
104
+ *
105
+ * Required permissions:
106
+ *
107
+ * - `invoice:update`
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const invoice = await client.invoices.delete(
112
+ * 'inv_xxxxxxxxxxxxxx',
113
+ * );
114
+ * ```
115
+ */
116
+ delete(id: string, options?: RequestOptions): APIPromise<InvoiceDeleteResponse> {
117
+ return this._client.delete(path`/invoices/${id}`, options);
118
+ }
119
+
65
120
  /**
66
121
  * Mark an open invoice as paid when payment was collected outside of Whop.
67
122
  *
68
123
  * Required permissions:
69
124
  *
70
125
  * - `invoice:update`
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * const response = await client.invoices.markPaid(
130
+ * 'inv_xxxxxxxxxxxxxx',
131
+ * );
132
+ * ```
71
133
  */
72
134
  markPaid(id: string, options?: RequestOptions): APIPromise<InvoiceMarkPaidResponse> {
73
135
  return this._client.post(path`/invoices/${id}/mark_paid`, options);
@@ -79,6 +141,13 @@ export class Invoices extends APIResource {
79
141
  * Required permissions:
80
142
  *
81
143
  * - `invoice:update`
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * const response = await client.invoices.markUncollectible(
148
+ * 'inv_xxxxxxxxxxxxxx',
149
+ * );
150
+ * ```
82
151
  */
83
152
  markUncollectible(id: string, options?: RequestOptions): APIPromise<InvoiceMarkUncollectibleResponse> {
84
153
  return this._client.post(path`/invoices/${id}/mark_uncollectible`, options);
@@ -91,6 +160,13 @@ export class Invoices extends APIResource {
91
160
  * Required permissions:
92
161
  *
93
162
  * - `invoice:update`
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const response = await client.invoices.void(
167
+ * 'inv_xxxxxxxxxxxxxx',
168
+ * );
169
+ * ```
94
170
  */
95
171
  void(id: string, options?: RequestOptions): APIPromise<InvoiceVoidResponse> {
96
172
  return this._client.post(path`/invoices/${id}/void`, options);
@@ -213,6 +289,11 @@ export type TaxIdentifierType =
213
289
  | 'sr_fin'
214
290
  | 'xi_vat';
215
291
 
292
+ /**
293
+ * Represents `true` or `false` values.
294
+ */
295
+ export type InvoiceDeleteResponse = boolean;
296
+
216
297
  /**
217
298
  * Represents `true` or `false` values.
218
299
  */
@@ -899,6 +980,294 @@ export declare namespace InvoiceCreateParams {
899
980
  }
900
981
  }
901
982
 
983
+ export interface InvoiceUpdateParams {
984
+ /**
985
+ * The date and time when the invoice will be automatically finalized and charged.
986
+ */
987
+ automatically_finalizes_at?: string | null;
988
+
989
+ /**
990
+ * Inline billing address to create or update a mailing address for this invoice.
991
+ */
992
+ billing_address?: InvoiceUpdateParams.BillingAddress | null;
993
+
994
+ /**
995
+ * Whether to charge the customer a buyer fee on this invoice.
996
+ */
997
+ charge_buyer_fee?: boolean | null;
998
+
999
+ /**
1000
+ * The method of collection for an invoice.
1001
+ */
1002
+ collection_method?: Shared.CollectionMethod | null;
1003
+
1004
+ /**
1005
+ * The name of the customer.
1006
+ */
1007
+ customer_name?: string | null;
1008
+
1009
+ /**
1010
+ * The date by which the invoice must be paid.
1011
+ */
1012
+ due_date?: string | null;
1013
+
1014
+ /**
1015
+ * The email address of the customer.
1016
+ */
1017
+ email_address?: string | null;
1018
+
1019
+ /**
1020
+ * Line items that break down the invoice total.
1021
+ */
1022
+ line_items?: Array<InvoiceUpdateParams.LineItem> | null;
1023
+
1024
+ /**
1025
+ * The unique identifier of an existing mailing address to attach.
1026
+ */
1027
+ mailing_address_id?: string | null;
1028
+
1029
+ /**
1030
+ * The unique identifier of a member to assign as the customer.
1031
+ */
1032
+ member_id?: string | null;
1033
+
1034
+ /**
1035
+ * The unique identifier of the payment method to charge.
1036
+ */
1037
+ payment_method_id?: string | null;
1038
+
1039
+ /**
1040
+ * Updated plan attributes.
1041
+ */
1042
+ plan?: InvoiceUpdateParams.Plan | null;
1043
+ }
1044
+
1045
+ export namespace InvoiceUpdateParams {
1046
+ /**
1047
+ * Inline billing address to create or update a mailing address for this invoice.
1048
+ */
1049
+ export interface BillingAddress {
1050
+ /**
1051
+ * The city of the address.
1052
+ */
1053
+ city?: string | null;
1054
+
1055
+ /**
1056
+ * The country of the address.
1057
+ */
1058
+ country?: string | null;
1059
+
1060
+ /**
1061
+ * The line 1 of the address.
1062
+ */
1063
+ line1?: string | null;
1064
+
1065
+ /**
1066
+ * The line 2 of the address.
1067
+ */
1068
+ line2?: string | null;
1069
+
1070
+ /**
1071
+ * The name of the customer.
1072
+ */
1073
+ name?: string | null;
1074
+
1075
+ /**
1076
+ * The phone number of the customer.
1077
+ */
1078
+ phone?: string | null;
1079
+
1080
+ /**
1081
+ * The postal code of the address.
1082
+ */
1083
+ postal_code?: string | null;
1084
+
1085
+ /**
1086
+ * The state of the address.
1087
+ */
1088
+ state?: string | null;
1089
+
1090
+ /**
1091
+ * The type of tax identifier
1092
+ */
1093
+ tax_id_type?: InvoicesAPI.TaxIdentifierType | null;
1094
+
1095
+ /**
1096
+ * The value of the tax identifier.
1097
+ */
1098
+ tax_id_value?: string | null;
1099
+ }
1100
+
1101
+ /**
1102
+ * A single line item to include on the invoice, with a label, quantity, and unit
1103
+ * price.
1104
+ */
1105
+ export interface LineItem {
1106
+ /**
1107
+ * The label or description for this line item.
1108
+ */
1109
+ label: string;
1110
+
1111
+ /**
1112
+ * The unit price for this line item. Provided as a number in the specified
1113
+ * currency. Eg: 10.43 for $10.43
1114
+ */
1115
+ unit_price: number;
1116
+
1117
+ /**
1118
+ * The quantity of this line item. Defaults to 1.
1119
+ */
1120
+ quantity?: number | null;
1121
+ }
1122
+
1123
+ /**
1124
+ * Updated plan attributes.
1125
+ */
1126
+ export interface Plan {
1127
+ /**
1128
+ * The interval in days at which the plan charges (renewal plans).
1129
+ */
1130
+ billing_period?: number | null;
1131
+
1132
+ /**
1133
+ * An array of custom field objects.
1134
+ */
1135
+ custom_fields?: Array<Plan.CustomField> | null;
1136
+
1137
+ /**
1138
+ * The description of the plan.
1139
+ */
1140
+ description?: string | null;
1141
+
1142
+ /**
1143
+ * The number of days until the membership expires and revokes access (expiration
1144
+ * plans). For example, 365 for a one-year access period.
1145
+ */
1146
+ expiration_days?: number | null;
1147
+
1148
+ /**
1149
+ * An additional amount charged upon first purchase. Use only if a one time payment
1150
+ * OR you want to charge an additional amount on top of the renewal price. Provided
1151
+ * as a number in the specified currency. Eg: 10.43 for $10.43
1152
+ */
1153
+ initial_price?: number | null;
1154
+
1155
+ /**
1156
+ * A personal description or notes section for the business.
1157
+ */
1158
+ internal_notes?: string | null;
1159
+
1160
+ /**
1161
+ * Whether this plan uses legacy payment method controls
1162
+ */
1163
+ legacy_payment_method_controls?: boolean | null;
1164
+
1165
+ /**
1166
+ * The explicit payment method configuration for the plan. If not provided, the
1167
+ * platform or company's defaults will apply.
1168
+ */
1169
+ payment_method_configuration?: Plan.PaymentMethodConfiguration | null;
1170
+
1171
+ /**
1172
+ * The type of plan that can be attached to a product
1173
+ */
1174
+ plan_type?: Shared.PlanType | null;
1175
+
1176
+ /**
1177
+ * The methods of how a plan can be released.
1178
+ */
1179
+ release_method?: Shared.ReleaseMethod | null;
1180
+
1181
+ /**
1182
+ * The amount the customer is charged every billing period. Use only if a recurring
1183
+ * payment. Provided as a number in the specified currency. Eg: 10.43 for $10.43
1184
+ */
1185
+ renewal_price?: number | null;
1186
+
1187
+ /**
1188
+ * The number of units available for purchase.
1189
+ */
1190
+ stock?: number | null;
1191
+
1192
+ /**
1193
+ * The number of free trial days added before a renewal plan.
1194
+ */
1195
+ trial_period_days?: number | null;
1196
+
1197
+ /**
1198
+ * When true, the plan has unlimited stock (stock field is ignored). When false,
1199
+ * purchases are limited by the stock field.
1200
+ */
1201
+ unlimited_stock?: boolean | null;
1202
+
1203
+ /**
1204
+ * Visibility of a resource
1205
+ */
1206
+ visibility?: Shared.Visibility | null;
1207
+ }
1208
+
1209
+ export namespace Plan {
1210
+ export interface CustomField {
1211
+ /**
1212
+ * The type of the custom field.
1213
+ */
1214
+ field_type: 'text';
1215
+
1216
+ /**
1217
+ * The name of the custom field.
1218
+ */
1219
+ name: string;
1220
+
1221
+ /**
1222
+ * The ID of the custom field (if being updated)
1223
+ */
1224
+ id?: string | null;
1225
+
1226
+ /**
1227
+ * The order of the field.
1228
+ */
1229
+ order?: number | null;
1230
+
1231
+ /**
1232
+ * The placeholder value of the field.
1233
+ */
1234
+ placeholder?: string | null;
1235
+
1236
+ /**
1237
+ * Whether or not the field is required.
1238
+ */
1239
+ required?: boolean | null;
1240
+ }
1241
+
1242
+ /**
1243
+ * The explicit payment method configuration for the plan. If not provided, the
1244
+ * platform or company's defaults will apply.
1245
+ */
1246
+ export interface PaymentMethodConfiguration {
1247
+ /**
1248
+ * An array of payment method identifiers that are explicitly disabled. Only
1249
+ * applies if the include_platform_defaults is true.
1250
+ */
1251
+ disabled: Array<PaymentsAPI.PaymentMethodTypes>;
1252
+
1253
+ /**
1254
+ * An array of payment method identifiers that are explicitly enabled. This means
1255
+ * these payment methods will be shown on checkout. Example use case is to only
1256
+ * enable a specific payment method like cashapp, or extending the platform
1257
+ * defaults with additional methods.
1258
+ */
1259
+ enabled: Array<PaymentsAPI.PaymentMethodTypes>;
1260
+
1261
+ /**
1262
+ * Whether Whop's platform default payment method enablement settings are included
1263
+ * in this configuration. The full list of default payment methods can be found in
1264
+ * the documentation at docs.whop.com/payments.
1265
+ */
1266
+ include_platform_defaults: boolean;
1267
+ }
1268
+ }
1269
+ }
1270
+
902
1271
  export interface InvoiceListParams extends CursorPageParams {
903
1272
  /**
904
1273
  * Returns the elements in the list that come before the specified cursor.
@@ -960,10 +1329,12 @@ export interface InvoiceListParams extends CursorPageParams {
960
1329
  export declare namespace Invoices {
961
1330
  export {
962
1331
  type TaxIdentifierType as TaxIdentifierType,
1332
+ type InvoiceDeleteResponse as InvoiceDeleteResponse,
963
1333
  type InvoiceMarkPaidResponse as InvoiceMarkPaidResponse,
964
1334
  type InvoiceMarkUncollectibleResponse as InvoiceMarkUncollectibleResponse,
965
1335
  type InvoiceVoidResponse as InvoiceVoidResponse,
966
1336
  type InvoiceCreateParams as InvoiceCreateParams,
1337
+ type InvoiceUpdateParams as InvoiceUpdateParams,
967
1338
  type InvoiceListParams as InvoiceListParams,
968
1339
  };
969
1340
  }
@@ -292,6 +292,7 @@ export type PaymentMethodTypes =
292
292
  | 'apple_pay'
293
293
  | 'au_becs_debit'
294
294
  | 'bacs_debit'
295
+ | 'bancolombia'
295
296
  | 'bancontact'
296
297
  | 'billie'
297
298
  | 'bizum'
@@ -306,6 +307,7 @@ export type PaymentMethodTypes =
306
307
  | 'custom'
307
308
  | 'customer_balance'
308
309
  | 'demo_pay'
310
+ | 'efecty'
309
311
  | 'eps'
310
312
  | 'eu_bank_transfer'
311
313
  | 'fpx'
@@ -324,10 +326,12 @@ export type PaymentMethodTypes =
324
326
  | 'kriya'
325
327
  | 'link'
326
328
  | 'mb_way'
329
+ | 'mercado_pago'
327
330
  | 'mobilepay'
328
331
  | 'mondu'
329
332
  | 'multibanco'
330
333
  | 'naver_pay'
334
+ | 'nequi'
331
335
  | 'netbanking'
332
336
  | 'ng_bank'
333
337
  | 'ng_bank_transfer'
@@ -338,6 +342,7 @@ export type PaymentMethodTypes =
338
342
  | 'nz_bank_account'
339
343
  | 'oxxo'
340
344
  | 'p24'
345
+ | 'pse'
341
346
  | 'pay_by_bank'
342
347
  | 'payco'
343
348
  | 'paynow'
@@ -360,6 +365,7 @@ export type PaymentMethodTypes =
360
365
  | 'shopeepay'
361
366
  | 'sofort'
362
367
  | 'south_korea_market'
368
+ | 'spei'
363
369
  | 'splitit'
364
370
  | 'sunbit'
365
371
  | 'swish'
@@ -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 PlansAPI from './plans';
4
5
  import * as PaymentsAPI from './payments';
5
6
  import * as Shared from './shared';
6
7
  import { APIPromise } from '../core/api-promise';
@@ -124,6 +125,16 @@ export class Plans extends APIResource {
124
125
 
125
126
  export type PlanListResponsesCursorPage = CursorPage<PlanListResponse>;
126
127
 
128
+ /**
129
+ * The different font families available for checkout pages.
130
+ */
131
+ export type CheckoutFont = 'system' | 'roboto' | 'open_sans';
132
+
133
+ /**
134
+ * The different border-radius styles available for checkout pages.
135
+ */
136
+ export type CheckoutShape = 'rounded' | 'pill' | 'rectangular';
137
+
127
138
  /**
128
139
  * A plan defines pricing and billing terms for a checkout. Plans can optionally
129
140
  * belong to a product, where they represent different pricing options such as
@@ -488,7 +499,7 @@ export namespace PlanCreateParams {
488
499
  /**
489
500
  * The different border-radius styles available for checkout pages.
490
501
  */
491
- border_style?: 'rounded' | 'pill' | 'rectangular' | null;
502
+ border_style?: PlansAPI.CheckoutShape | null;
492
503
 
493
504
  /**
494
505
  * A hex color code for the button color (e.g. #FF5733).
@@ -498,7 +509,7 @@ export namespace PlanCreateParams {
498
509
  /**
499
510
  * The different font families available for checkout pages.
500
511
  */
501
- font_family?: 'system' | 'roboto' | 'open_sans' | null;
512
+ font_family?: PlansAPI.CheckoutFont | null;
502
513
  }
503
514
 
504
515
  export interface CustomField {
@@ -697,7 +708,7 @@ export namespace PlanUpdateParams {
697
708
  /**
698
709
  * The different border-radius styles available for checkout pages.
699
710
  */
700
- border_style?: 'rounded' | 'pill' | 'rectangular' | null;
711
+ border_style?: PlansAPI.CheckoutShape | null;
701
712
 
702
713
  /**
703
714
  * A hex color code for the button color (e.g. #FF5733).
@@ -707,7 +718,7 @@ export namespace PlanUpdateParams {
707
718
  /**
708
719
  * The different font families available for checkout pages.
709
720
  */
710
- font_family?: 'system' | 'roboto' | 'open_sans' | null;
721
+ font_family?: PlansAPI.CheckoutFont | null;
711
722
  }
712
723
 
713
724
  export interface CustomField {
@@ -844,6 +855,8 @@ export interface PlanListParams extends CursorPageParams {
844
855
 
845
856
  export declare namespace Plans {
846
857
  export {
858
+ type CheckoutFont as CheckoutFont,
859
+ type CheckoutShape as CheckoutShape,
847
860
  type PlanListResponse as PlanListResponse,
848
861
  type PlanDeleteResponse as PlanDeleteResponse,
849
862
  type PlanListResponsesCursorPage as PlanListResponsesCursorPage,
@@ -61,7 +61,8 @@ export type PaymentProvider =
61
61
  | 'checkout_dot_com'
62
62
  | 'airwallex'
63
63
  | 'coinflow'
64
- | 'sequra';
64
+ | 'sequra'
65
+ | 'dlocal';
65
66
 
66
67
  /**
67
68
  * The status of the refund reference.
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.0.36'; // x-release-please-version
1
+ export const VERSION = '0.0.37'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.36";
1
+ export declare const VERSION = "0.0.37";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.36";
1
+ export declare const VERSION = "0.0.37";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.0.36'; // x-release-please-version
4
+ exports.VERSION = '0.0.37'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.0.36'; // x-release-please-version
1
+ export const VERSION = '0.0.37'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map