@commet/node 7.10.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.d.mts +2029 -940
- package/dist/index.d.ts +2029 -940
- package/dist/index.js +396 -342
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +396 -342
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -71,13 +71,6 @@ type CommetClientOptions = {
|
|
|
71
71
|
retries?: number;
|
|
72
72
|
telemetry?: boolean;
|
|
73
73
|
};
|
|
74
|
-
interface ApiResponse<T = unknown> {
|
|
75
|
-
success: boolean;
|
|
76
|
-
data?: T;
|
|
77
|
-
error?: ApiErrorDetail;
|
|
78
|
-
hasMore?: boolean;
|
|
79
|
-
nextCursor?: string;
|
|
80
|
-
}
|
|
81
74
|
interface ApiErrorDetail {
|
|
82
75
|
type: string;
|
|
83
76
|
code: string;
|
|
@@ -86,16 +79,6 @@ interface ApiErrorDetail {
|
|
|
86
79
|
details?: unknown;
|
|
87
80
|
doc_url?: string;
|
|
88
81
|
}
|
|
89
|
-
interface PaginatedResponse<T> {
|
|
90
|
-
data: T[];
|
|
91
|
-
hasMore: boolean;
|
|
92
|
-
nextCursor?: string;
|
|
93
|
-
totalCount?: number;
|
|
94
|
-
}
|
|
95
|
-
interface PaginatedList<T> extends PaginatedResponse<T> {
|
|
96
|
-
next(): Promise<PaginatedList<T>>;
|
|
97
|
-
all(): Promise<T[]>;
|
|
98
|
-
}
|
|
99
82
|
declare class CommetError extends Error {
|
|
100
83
|
code?: string | undefined;
|
|
101
84
|
statusCode?: number | undefined;
|
|
@@ -115,9 +98,6 @@ declare class CommetValidationError extends CommetError {
|
|
|
115
98
|
validationErrors: Record<string, string[]>;
|
|
116
99
|
constructor(message: string, validationErrors: Record<string, string[]>);
|
|
117
100
|
}
|
|
118
|
-
type CustomerID = string;
|
|
119
|
-
type EventID = `evt_${string}`;
|
|
120
|
-
type Currency = "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "ARS" | "BRL" | "MXN" | "CLP";
|
|
121
101
|
interface RequestOptions {
|
|
122
102
|
apiVersion?: string;
|
|
123
103
|
idempotencyKey?: string;
|
|
@@ -137,15 +117,14 @@ type ResolvedPlanCode<TConfig> = [InferPlanCodes<TConfig>] extends [
|
|
|
137
117
|
never
|
|
138
118
|
] ? string : InferPlanCodes<TConfig>;
|
|
139
119
|
|
|
140
|
-
type SubscriptionStatus = "draft" | "pending_payment" | "trialing" | "active" | "past_due" | "canceled";
|
|
141
120
|
type BillingInterval = "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
|
|
142
121
|
type ConsumptionModel = "metered" | "credits" | "balance";
|
|
122
|
+
type FeatureType = "boolean" | "usage" | "seats" | "quota";
|
|
143
123
|
type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation" | "one_time_payment" | "reactivation";
|
|
144
|
-
type TransactionStatus = "pending" | "succeeded" | "failed" | "refunded" | "disputed";
|
|
145
124
|
type PaymentProvider = "stripe" | "commet" | "dlocal";
|
|
146
|
-
type
|
|
147
|
-
type DiscountType = "percentage" | "amount";
|
|
125
|
+
type SubscriptionStatus = "draft" | "pending_payment" | "trialing" | "active" | "past_due" | "canceled";
|
|
148
126
|
type Timezone = "UTC" | "America/New_York" | "America/Chicago" | "America/Denver" | "America/Los_Angeles" | "America/Sao_Paulo" | "America/Mexico_City" | "America/Buenos_Aires" | "America/Santiago" | "America/Bogota" | "America/Lima" | "America/Asuncion" | "Europe/London" | "Europe/Paris" | "Europe/Berlin" | "Europe/Madrid" | "Asia/Tokyo" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Dubai" | "Australia/Sydney";
|
|
127
|
+
type TransactionStatus = "pending" | "succeeded" | "failed" | "refunded" | "disputed";
|
|
149
128
|
|
|
150
129
|
interface ActiveAddon {
|
|
151
130
|
slug: string;
|
|
@@ -157,12 +136,12 @@ interface ActiveAddon {
|
|
|
157
136
|
consumptionModel: "boolean" | "metered" | "credits" | "balance";
|
|
158
137
|
/** @format date-time */
|
|
159
138
|
activatedAt: string;
|
|
160
|
-
object: "
|
|
139
|
+
object: "subscription_addon";
|
|
161
140
|
livemode: boolean;
|
|
162
141
|
}
|
|
163
142
|
interface AddedPlanToGroup {
|
|
164
143
|
success: boolean;
|
|
165
|
-
object: "
|
|
144
|
+
object: "plan_group_membership";
|
|
166
145
|
livemode: boolean;
|
|
167
146
|
}
|
|
168
147
|
interface Addon {
|
|
@@ -171,16 +150,16 @@ interface Addon {
|
|
|
171
150
|
slug: string;
|
|
172
151
|
description: string | null;
|
|
173
152
|
basePrice: number;
|
|
174
|
-
consumptionModel: "boolean" | "metered" | "credits" | "balance";
|
|
175
153
|
featureCode: string;
|
|
176
154
|
featureName: string;
|
|
177
|
-
includedUnits: number | null;
|
|
178
|
-
overageRate: number | null;
|
|
179
|
-
creditCost: number | null;
|
|
180
155
|
/** @format date-time */
|
|
181
156
|
createdAt: string;
|
|
182
157
|
/** @format date-time */
|
|
183
158
|
updatedAt: string;
|
|
159
|
+
consumptionModel: "boolean" | "metered" | "credits" | "balance";
|
|
160
|
+
includedUnits: number | null;
|
|
161
|
+
overageRate: number | null;
|
|
162
|
+
creditCost: number | null;
|
|
184
163
|
object: "addon";
|
|
185
164
|
livemode: boolean;
|
|
186
165
|
}
|
|
@@ -199,38 +178,12 @@ interface BalanceAdjustment {
|
|
|
199
178
|
amount: number;
|
|
200
179
|
newBalance: number;
|
|
201
180
|
reason: string | null;
|
|
202
|
-
object: "
|
|
181
|
+
object: "balance_transaction";
|
|
203
182
|
livemode: boolean;
|
|
204
183
|
}
|
|
205
184
|
interface BalanceTopup {
|
|
206
185
|
amount: number;
|
|
207
|
-
object: "
|
|
208
|
-
livemode: boolean;
|
|
209
|
-
}
|
|
210
|
-
interface BulkSeatUpdate {
|
|
211
|
-
id: string;
|
|
212
|
-
featureCode: string;
|
|
213
|
-
previousBalance: number;
|
|
214
|
-
newBalance: number;
|
|
215
|
-
/** @format date-time */
|
|
216
|
-
ts: string;
|
|
217
|
-
/** @format date-time */
|
|
218
|
-
createdAt: string;
|
|
219
|
-
object: "seat";
|
|
220
|
-
livemode: boolean;
|
|
221
|
-
}
|
|
222
|
-
interface CanceledSubscription {
|
|
223
|
-
id: string;
|
|
224
|
-
customerId: string;
|
|
225
|
-
status: SubscriptionStatus;
|
|
226
|
-
/** @format date-time */
|
|
227
|
-
canceledAt: string;
|
|
228
|
-
cancelReason: string | null;
|
|
229
|
-
/** @format date-time */
|
|
230
|
-
scheduledCancellationDate: string;
|
|
231
|
-
/** @format date-time */
|
|
232
|
-
updatedAt: string;
|
|
233
|
-
object: "subscription";
|
|
186
|
+
object: "balance_topup";
|
|
234
187
|
livemode: boolean;
|
|
235
188
|
}
|
|
236
189
|
interface ClaimLink {
|
|
@@ -252,32 +205,79 @@ interface CreatedApiKey {
|
|
|
252
205
|
object: "api_key";
|
|
253
206
|
livemode: boolean;
|
|
254
207
|
}
|
|
255
|
-
interface
|
|
208
|
+
interface CreatedSubscription {
|
|
256
209
|
id: string;
|
|
257
210
|
customerId: string;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
211
|
+
plan: {
|
|
212
|
+
id: string;
|
|
213
|
+
name: string;
|
|
214
|
+
};
|
|
215
|
+
name: string;
|
|
216
|
+
description: string | null;
|
|
217
|
+
status: SubscriptionStatus;
|
|
218
|
+
billingInterval: BillingInterval | null;
|
|
219
|
+
trialEndsAt: string | null;
|
|
220
|
+
currentPeriod: {
|
|
221
|
+
/** @format date-time */
|
|
222
|
+
start: string;
|
|
223
|
+
/** @format date-time */
|
|
224
|
+
end: string;
|
|
225
|
+
daysRemaining: number;
|
|
226
|
+
} | null;
|
|
227
|
+
cancellation: {
|
|
228
|
+
/** @format date-time */
|
|
229
|
+
scheduledAt: string;
|
|
230
|
+
reason: string | null;
|
|
231
|
+
/** @format date-time */
|
|
232
|
+
effectiveAt: string;
|
|
233
|
+
} | null;
|
|
234
|
+
cancelAtPeriodEnd: boolean;
|
|
235
|
+
scheduledPlanChange: {
|
|
236
|
+
changeType: "plan_downgrade" | "interval_change";
|
|
237
|
+
newPlanId: string | null;
|
|
238
|
+
newPlanName: string | null;
|
|
239
|
+
newBillingInterval: string | null;
|
|
240
|
+
/** @format date-time */
|
|
241
|
+
scheduledFor: string;
|
|
242
|
+
} | null;
|
|
243
|
+
discount: {
|
|
244
|
+
type: "percentage" | "amount";
|
|
245
|
+
value: number;
|
|
246
|
+
name: string | null;
|
|
247
|
+
endsAt: string | null;
|
|
248
|
+
} | null;
|
|
267
249
|
/** @format date-time */
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
250
|
+
startDate: string;
|
|
251
|
+
endDate: string | null;
|
|
252
|
+
billingDayOfMonth: number | null;
|
|
253
|
+
nextBillingDate: string | null;
|
|
254
|
+
checkoutUrl: string | null;
|
|
271
255
|
/** @format date-time */
|
|
272
256
|
createdAt: string;
|
|
273
257
|
/** @format date-time */
|
|
274
258
|
updatedAt: string;
|
|
275
|
-
|
|
259
|
+
/** Payment provider resolved for this checkout when the subscription response was created. This is an informational snapshot and may differ when the checkout is loaded if its country or the organization's routing changes. */
|
|
260
|
+
checkoutProvider: PaymentProvider | null;
|
|
261
|
+
priceId: string | null;
|
|
262
|
+
object: "subscription";
|
|
263
|
+
livemode: boolean;
|
|
264
|
+
}
|
|
265
|
+
interface CreatedWebhook {
|
|
266
|
+
id: string;
|
|
267
|
+
url: string;
|
|
268
|
+
events: Array<string>;
|
|
269
|
+
description: string | null;
|
|
270
|
+
isActive: boolean;
|
|
271
|
+
apiVersion: string | null;
|
|
272
|
+
/** @format date-time */
|
|
273
|
+
createdAt: string;
|
|
274
|
+
secretKey: string;
|
|
275
|
+
object: "webhook";
|
|
276
276
|
livemode: boolean;
|
|
277
277
|
}
|
|
278
278
|
interface CreditGrant {
|
|
279
279
|
credits: number;
|
|
280
|
-
object: "
|
|
280
|
+
object: "credit_grant";
|
|
281
281
|
livemode: boolean;
|
|
282
282
|
}
|
|
283
283
|
interface CreditPack {
|
|
@@ -286,12 +286,21 @@ interface CreditPack {
|
|
|
286
286
|
description: string | null;
|
|
287
287
|
credits: number;
|
|
288
288
|
price: number;
|
|
289
|
-
|
|
290
|
-
isActive?: boolean;
|
|
289
|
+
isActive: boolean;
|
|
291
290
|
/** @format date-time */
|
|
292
|
-
createdAt
|
|
291
|
+
createdAt: string;
|
|
293
292
|
/** @format date-time */
|
|
294
|
-
updatedAt
|
|
293
|
+
updatedAt: string;
|
|
294
|
+
object: "credit_pack";
|
|
295
|
+
livemode: boolean;
|
|
296
|
+
}
|
|
297
|
+
interface CreditPackListItem {
|
|
298
|
+
id: string;
|
|
299
|
+
name: string;
|
|
300
|
+
description: string | null;
|
|
301
|
+
credits: number;
|
|
302
|
+
price: number;
|
|
303
|
+
currency: string;
|
|
295
304
|
object: "credit_pack";
|
|
296
305
|
livemode: boolean;
|
|
297
306
|
}
|
|
@@ -339,13 +348,7 @@ interface CustomerBatch {
|
|
|
339
348
|
};
|
|
340
349
|
};
|
|
341
350
|
}>;
|
|
342
|
-
object: "
|
|
343
|
-
livemode: boolean;
|
|
344
|
-
}
|
|
345
|
-
interface DefaultPlanPrice {
|
|
346
|
-
id: string;
|
|
347
|
-
isDefault: true;
|
|
348
|
-
object: "plan";
|
|
351
|
+
object: "customer_batch";
|
|
349
352
|
livemode: boolean;
|
|
350
353
|
}
|
|
351
354
|
interface DeletedObject {
|
|
@@ -354,16 +357,21 @@ interface DeletedObject {
|
|
|
354
357
|
object: string;
|
|
355
358
|
livemode: boolean;
|
|
356
359
|
}
|
|
360
|
+
interface DeletedOffer {
|
|
361
|
+
deleted: true;
|
|
362
|
+
object: "offer";
|
|
363
|
+
livemode: boolean;
|
|
364
|
+
}
|
|
357
365
|
interface DeletedPlanRegionalPricing {
|
|
358
366
|
deleted: true;
|
|
359
|
-
object: "
|
|
367
|
+
object: "plan_regional_pricing";
|
|
360
368
|
livemode: boolean;
|
|
361
369
|
}
|
|
362
370
|
interface DeletedSubscriptionAddon {
|
|
363
371
|
id: string;
|
|
364
372
|
status: "inactive";
|
|
365
373
|
deactivatedAt: string | null;
|
|
366
|
-
object: "
|
|
374
|
+
object: "subscription_addon";
|
|
367
375
|
livemode: boolean;
|
|
368
376
|
}
|
|
369
377
|
interface Feature {
|
|
@@ -380,42 +388,235 @@ interface Feature {
|
|
|
380
388
|
object: "feature";
|
|
381
389
|
livemode: boolean;
|
|
382
390
|
}
|
|
383
|
-
|
|
391
|
+
type FeatureAccess = {
|
|
392
|
+
/** Unique feature code. */
|
|
384
393
|
code: string;
|
|
394
|
+
/** Display name of the feature. */
|
|
385
395
|
name: string;
|
|
386
|
-
|
|
396
|
+
/** Display name for one product unit, or null when not applicable. */
|
|
397
|
+
unitName: string | null;
|
|
398
|
+
/** Whether the customer can currently access or consume the feature. */
|
|
387
399
|
allowed: boolean;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
overageQuantity?: number;
|
|
393
|
-
overageUnitPrice?: number;
|
|
394
|
-
unlimited?: boolean;
|
|
395
|
-
overageEnabled?: boolean;
|
|
396
|
-
billedQuantity?: number;
|
|
397
|
-
object: "feature";
|
|
400
|
+
type: "boolean";
|
|
401
|
+
/** Whether the feature is enabled. */
|
|
402
|
+
enabled: boolean;
|
|
403
|
+
object: "feature_access";
|
|
398
404
|
livemode: boolean;
|
|
399
|
-
}
|
|
400
|
-
|
|
405
|
+
} | {
|
|
406
|
+
/** Unique feature code. */
|
|
407
|
+
code: string;
|
|
408
|
+
/** Display name of the feature. */
|
|
409
|
+
name: string;
|
|
410
|
+
/** Display name for one product unit, or null when not applicable. */
|
|
411
|
+
unitName: string | null;
|
|
412
|
+
/** Whether the customer can currently access or consume the feature. */
|
|
401
413
|
allowed: boolean;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
type: "usage";
|
|
415
|
+
consumption: {
|
|
416
|
+
/** Usage is measured against an included allowance and overage. */
|
|
417
|
+
model: "metered";
|
|
418
|
+
/** Time range used to calculate this feature's consumption. */
|
|
419
|
+
period: {
|
|
420
|
+
/**
|
|
421
|
+
* Inclusive usage period start.
|
|
422
|
+
* @format date-time
|
|
423
|
+
*/
|
|
424
|
+
start: string;
|
|
425
|
+
/**
|
|
426
|
+
* Exclusive usage period end.
|
|
427
|
+
* @format date-time
|
|
428
|
+
*/
|
|
429
|
+
end: string;
|
|
430
|
+
};
|
|
431
|
+
/** Product units recorded during the period. */
|
|
432
|
+
unitsUsed: number;
|
|
433
|
+
/** Product units included in the subscription for the period. */
|
|
434
|
+
includedUnits: number;
|
|
435
|
+
/** Included units not yet consumed. Absent when usage is unlimited. */
|
|
436
|
+
remainingUnits?: number;
|
|
437
|
+
/** Whether the feature has no usage limit. */
|
|
438
|
+
unlimited: boolean;
|
|
439
|
+
overage: {
|
|
440
|
+
/** Whether usage above the included amount is allowed and billed. */
|
|
441
|
+
enabled: boolean;
|
|
442
|
+
/** Units consumed above the included amount. */
|
|
443
|
+
units: number;
|
|
444
|
+
/** Price for one additional product unit. */
|
|
445
|
+
unitPrice?: {
|
|
446
|
+
/** Integer rate amount. Divide by scale to obtain the price. */
|
|
447
|
+
amount: number;
|
|
448
|
+
/** Lowercase ISO 4217 currency code. */
|
|
449
|
+
currency: string;
|
|
450
|
+
/** Divide amount by scale to obtain the major-unit price. */
|
|
451
|
+
scale: 10000;
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
} | {
|
|
455
|
+
/** Product usage consumes credits from a shared pool. */
|
|
456
|
+
model: "credits";
|
|
457
|
+
/** Time range used to calculate this feature's consumption. */
|
|
458
|
+
period: {
|
|
459
|
+
/**
|
|
460
|
+
* Inclusive usage period start.
|
|
461
|
+
* @format date-time
|
|
462
|
+
*/
|
|
463
|
+
start: string;
|
|
464
|
+
/**
|
|
465
|
+
* Exclusive usage period end.
|
|
466
|
+
* @format date-time
|
|
467
|
+
*/
|
|
468
|
+
end: string;
|
|
469
|
+
};
|
|
470
|
+
/** Product units recorded during the period. */
|
|
471
|
+
unitsUsed: number;
|
|
472
|
+
/** Credits deducted for each product unit. */
|
|
473
|
+
creditsPerUnit: number;
|
|
474
|
+
/** Actual credits deducted by this feature during the period. */
|
|
475
|
+
creditsConsumed: number;
|
|
476
|
+
/** Additional product units available from the current shared credit pool at this feature's conversion rate. */
|
|
477
|
+
availableUnits: number;
|
|
478
|
+
} | {
|
|
479
|
+
/** Product usage deducts money from a shared balance. */
|
|
480
|
+
model: "balance";
|
|
481
|
+
/** Time range used to calculate this feature's consumption. */
|
|
482
|
+
period: {
|
|
483
|
+
/**
|
|
484
|
+
* Inclusive usage period start.
|
|
485
|
+
* @format date-time
|
|
486
|
+
*/
|
|
487
|
+
start: string;
|
|
488
|
+
/**
|
|
489
|
+
* Exclusive usage period end.
|
|
490
|
+
* @format date-time
|
|
491
|
+
*/
|
|
492
|
+
end: string;
|
|
493
|
+
};
|
|
494
|
+
/** Product units recorded during the period. */
|
|
495
|
+
unitsUsed: number;
|
|
496
|
+
/** Actual money deducted for this feature during the period. */
|
|
497
|
+
spent: {
|
|
498
|
+
/** Amount in the currency's smallest unit. */
|
|
499
|
+
amount: number;
|
|
500
|
+
/** Lowercase ISO 4217 currency code. */
|
|
501
|
+
currency: string;
|
|
502
|
+
};
|
|
503
|
+
/** Estimated additional units available from the current shared balance at this feature's fixed price. Absent for dynamic pricing. */
|
|
504
|
+
availableUnits?: number;
|
|
505
|
+
/** Price for one additional product unit. */
|
|
506
|
+
unitPrice?: {
|
|
507
|
+
/** Integer rate amount. Divide by scale to obtain the price. */
|
|
508
|
+
amount: number;
|
|
509
|
+
/** Lowercase ISO 4217 currency code. */
|
|
510
|
+
currency: string;
|
|
511
|
+
/** Divide amount by scale to obtain the major-unit price. */
|
|
512
|
+
scale: 10000;
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
object: "feature_access";
|
|
417
516
|
livemode: boolean;
|
|
418
|
-
}
|
|
517
|
+
} | {
|
|
518
|
+
/** Unique feature code. */
|
|
519
|
+
code: string;
|
|
520
|
+
/** Display name of the feature. */
|
|
521
|
+
name: string;
|
|
522
|
+
/** Display name for one product unit, or null when not applicable. */
|
|
523
|
+
unitName: string | null;
|
|
524
|
+
/** Whether the customer can currently access or consume the feature. */
|
|
525
|
+
allowed: boolean;
|
|
526
|
+
type: "seats";
|
|
527
|
+
usage: {
|
|
528
|
+
/** Time range used to calculate this feature's consumption. */
|
|
529
|
+
period: {
|
|
530
|
+
/**
|
|
531
|
+
* Inclusive usage period start.
|
|
532
|
+
* @format date-time
|
|
533
|
+
*/
|
|
534
|
+
start: string;
|
|
535
|
+
/**
|
|
536
|
+
* Exclusive usage period end.
|
|
537
|
+
* @format date-time
|
|
538
|
+
*/
|
|
539
|
+
end: string;
|
|
540
|
+
};
|
|
541
|
+
/** Current units assigned or in use. */
|
|
542
|
+
unitsUsed: number;
|
|
543
|
+
/** Units included in the subscription for the period. */
|
|
544
|
+
includedUnits: number;
|
|
545
|
+
/** Included units still available. Absent when usage is unlimited. */
|
|
546
|
+
remainingUnits?: number;
|
|
547
|
+
/** Whether the feature has no usage limit. */
|
|
548
|
+
unlimited: boolean;
|
|
549
|
+
overage: {
|
|
550
|
+
/** Whether usage above the included amount is allowed and billed. */
|
|
551
|
+
enabled: boolean;
|
|
552
|
+
/** Units consumed above the included amount. */
|
|
553
|
+
units: number;
|
|
554
|
+
/** Price for one additional product unit. */
|
|
555
|
+
unitPrice?: {
|
|
556
|
+
/** Integer rate amount. Divide by scale to obtain the price. */
|
|
557
|
+
amount: number;
|
|
558
|
+
/** Lowercase ISO 4217 currency code. */
|
|
559
|
+
currency: string;
|
|
560
|
+
/** Divide amount by scale to obtain the major-unit price. */
|
|
561
|
+
scale: 10000;
|
|
562
|
+
};
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
object: "feature_access";
|
|
566
|
+
livemode: boolean;
|
|
567
|
+
} | {
|
|
568
|
+
/** Unique feature code. */
|
|
569
|
+
code: string;
|
|
570
|
+
/** Display name of the feature. */
|
|
571
|
+
name: string;
|
|
572
|
+
/** Display name for one product unit, or null when not applicable. */
|
|
573
|
+
unitName: string | null;
|
|
574
|
+
/** Whether the customer can currently access or consume the feature. */
|
|
575
|
+
allowed: boolean;
|
|
576
|
+
type: "quota";
|
|
577
|
+
usage: {
|
|
578
|
+
/** Time range used to calculate this feature's consumption. */
|
|
579
|
+
period: {
|
|
580
|
+
/**
|
|
581
|
+
* Inclusive usage period start.
|
|
582
|
+
* @format date-time
|
|
583
|
+
*/
|
|
584
|
+
start: string;
|
|
585
|
+
/**
|
|
586
|
+
* Exclusive usage period end.
|
|
587
|
+
* @format date-time
|
|
588
|
+
*/
|
|
589
|
+
end: string;
|
|
590
|
+
};
|
|
591
|
+
/** Current units assigned or in use. */
|
|
592
|
+
unitsUsed: number;
|
|
593
|
+
/** Units included in the subscription for the period. */
|
|
594
|
+
includedUnits: number;
|
|
595
|
+
/** Included units still available. Absent when usage is unlimited. */
|
|
596
|
+
remainingUnits?: number;
|
|
597
|
+
/** Whether the feature has no usage limit. */
|
|
598
|
+
unlimited: boolean;
|
|
599
|
+
overage: {
|
|
600
|
+
/** Whether usage above the included amount is allowed and billed. */
|
|
601
|
+
enabled: boolean;
|
|
602
|
+
/** Units consumed above the included amount. */
|
|
603
|
+
units: number;
|
|
604
|
+
/** Price for one additional product unit. */
|
|
605
|
+
unitPrice?: {
|
|
606
|
+
/** Integer rate amount. Divide by scale to obtain the price. */
|
|
607
|
+
amount: number;
|
|
608
|
+
/** Lowercase ISO 4217 currency code. */
|
|
609
|
+
currency: string;
|
|
610
|
+
/** Divide amount by scale to obtain the major-unit price. */
|
|
611
|
+
scale: 10000;
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
/** Highest quota reached during the period and used for billing. */
|
|
615
|
+
billedUnits: number;
|
|
616
|
+
};
|
|
617
|
+
object: "feature_access";
|
|
618
|
+
livemode: boolean;
|
|
619
|
+
};
|
|
419
620
|
interface Invoice {
|
|
420
621
|
id: string;
|
|
421
622
|
customerId: string;
|
|
@@ -426,7 +627,6 @@ interface Invoice {
|
|
|
426
627
|
currency: string;
|
|
427
628
|
subtotal: number;
|
|
428
629
|
discountAmount: number;
|
|
429
|
-
creditApplied?: number;
|
|
430
630
|
taxAmount: number;
|
|
431
631
|
total: number;
|
|
432
632
|
/** @format date-time */
|
|
@@ -437,16 +637,17 @@ interface Invoice {
|
|
|
437
637
|
issueDate: string;
|
|
438
638
|
/** @format date-time */
|
|
439
639
|
dueDate: string;
|
|
440
|
-
planName?: string | null;
|
|
441
640
|
memo: string | null;
|
|
442
|
-
poNumber?: string | null;
|
|
443
|
-
reference?: string | null;
|
|
444
641
|
metadata: Record<string, unknown>;
|
|
445
642
|
/** @format date-time */
|
|
446
643
|
createdAt: string;
|
|
447
644
|
/** @format date-time */
|
|
448
645
|
updatedAt: string;
|
|
449
|
-
|
|
646
|
+
creditApplied: number;
|
|
647
|
+
planName: string | null;
|
|
648
|
+
poNumber: string | null;
|
|
649
|
+
reference: string | null;
|
|
650
|
+
lineItems: Array<{
|
|
450
651
|
lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base" | "one_time";
|
|
451
652
|
featureName: string | null;
|
|
452
653
|
description: string;
|
|
@@ -468,23 +669,97 @@ interface InvoiceDownload {
|
|
|
468
669
|
url: string;
|
|
469
670
|
/** @format date-time */
|
|
470
671
|
expiresAt: string;
|
|
471
|
-
object: "
|
|
672
|
+
object: "invoice_download_link";
|
|
472
673
|
livemode: boolean;
|
|
473
674
|
}
|
|
474
|
-
interface
|
|
675
|
+
interface InvoiceListItem {
|
|
475
676
|
id: string;
|
|
677
|
+
customerId: string;
|
|
678
|
+
subscriptionId: string | null;
|
|
679
|
+
invoiceNumber: string;
|
|
476
680
|
status: "draft" | "outstanding" | "paid" | "void" | "uncollectible";
|
|
681
|
+
invoiceType: InvoiceType;
|
|
682
|
+
currency: string;
|
|
683
|
+
subtotal: number;
|
|
684
|
+
discountAmount: number;
|
|
685
|
+
taxAmount: number;
|
|
686
|
+
total: number;
|
|
687
|
+
/** @format date-time */
|
|
688
|
+
periodStart: string;
|
|
689
|
+
/** @format date-time */
|
|
690
|
+
periodEnd: string;
|
|
691
|
+
/** @format date-time */
|
|
692
|
+
issueDate: string;
|
|
693
|
+
/** @format date-time */
|
|
694
|
+
dueDate: string;
|
|
695
|
+
memo: string | null;
|
|
696
|
+
metadata: Record<string, unknown>;
|
|
697
|
+
/** @format date-time */
|
|
698
|
+
createdAt: string;
|
|
477
699
|
/** @format date-time */
|
|
478
700
|
updatedAt: string;
|
|
479
701
|
object: "invoice";
|
|
480
702
|
livemode: boolean;
|
|
481
703
|
}
|
|
704
|
+
interface MarketGroup {
|
|
705
|
+
id: string;
|
|
706
|
+
name: string;
|
|
707
|
+
countryCodes: Array<string>;
|
|
708
|
+
metadata: Record<string, unknown>;
|
|
709
|
+
/** @format date-time */
|
|
710
|
+
createdAt: string;
|
|
711
|
+
/** @format date-time */
|
|
712
|
+
updatedAt: string;
|
|
713
|
+
object: "market_group";
|
|
714
|
+
livemode: boolean;
|
|
715
|
+
}
|
|
716
|
+
interface Offer {
|
|
717
|
+
id: string;
|
|
718
|
+
name: string;
|
|
719
|
+
purpose: "introductory" | "promotional";
|
|
720
|
+
planPriceIds: Array<string>;
|
|
721
|
+
phases: Array<{
|
|
722
|
+
type: "free_trial";
|
|
723
|
+
durationDays: number;
|
|
724
|
+
} | {
|
|
725
|
+
type: "percentage";
|
|
726
|
+
durationCycles: number;
|
|
727
|
+
/** Discount in basis points. 5000 means 50%. */
|
|
728
|
+
percentage: number;
|
|
729
|
+
} | {
|
|
730
|
+
type: "amount_off";
|
|
731
|
+
durationCycles: number;
|
|
732
|
+
amounts: Array<{
|
|
733
|
+
currency: string;
|
|
734
|
+
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
735
|
+
amount: number;
|
|
736
|
+
}>;
|
|
737
|
+
} | {
|
|
738
|
+
type: "fixed_price";
|
|
739
|
+
durationCycles: number;
|
|
740
|
+
prices: Array<{
|
|
741
|
+
currency: string;
|
|
742
|
+
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
743
|
+
amount: number;
|
|
744
|
+
}>;
|
|
745
|
+
}>;
|
|
746
|
+
metadata: Record<string, unknown>;
|
|
747
|
+
startsAt: string | null;
|
|
748
|
+
endsAt: string | null;
|
|
749
|
+
active: boolean;
|
|
750
|
+
/** @format date-time */
|
|
751
|
+
createdAt: string;
|
|
752
|
+
/** @format date-time */
|
|
753
|
+
updatedAt: string;
|
|
754
|
+
object: "offer";
|
|
755
|
+
livemode: boolean;
|
|
756
|
+
}
|
|
482
757
|
interface Payment {
|
|
483
758
|
id: string;
|
|
484
759
|
customerId: string | null;
|
|
485
760
|
kind: "link" | "charge";
|
|
486
761
|
status: "pending" | "processing" | "succeeded" | "requires_action" | "failed" | "canceled";
|
|
487
|
-
provider:
|
|
762
|
+
provider: "stripe" | "commet" | "dlocal";
|
|
488
763
|
amountSubtotal: number;
|
|
489
764
|
taxAmount: number;
|
|
490
765
|
amountTotal: number;
|
|
@@ -502,7 +777,7 @@ interface Payment {
|
|
|
502
777
|
}
|
|
503
778
|
interface PaymentMethodUpdateCheckout {
|
|
504
779
|
checkoutUrl: string;
|
|
505
|
-
object: "
|
|
780
|
+
object: "checkout_session";
|
|
506
781
|
livemode: boolean;
|
|
507
782
|
}
|
|
508
783
|
interface Payout {
|
|
@@ -535,24 +810,31 @@ interface PayoutBankAccount {
|
|
|
535
810
|
object: "payout_bank_account";
|
|
536
811
|
livemode: boolean;
|
|
537
812
|
}
|
|
538
|
-
|
|
813
|
+
type PayoutVerification = {
|
|
539
814
|
providerAccountId: string;
|
|
540
815
|
status: "pending_verification" | "verified" | "restricted" | "disabled";
|
|
541
816
|
transfersEnabled: boolean;
|
|
542
|
-
|
|
543
|
-
businessType?: "individual" | "company";
|
|
544
|
-
country?: string;
|
|
817
|
+
outcome: "existing";
|
|
545
818
|
object: "payout_account";
|
|
546
819
|
livemode: boolean;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
820
|
+
} | {
|
|
821
|
+
providerAccountId: string;
|
|
822
|
+
status: "pending_verification" | "verified" | "restricted" | "disabled";
|
|
823
|
+
transfersEnabled: boolean;
|
|
824
|
+
outcome: "created";
|
|
825
|
+
businessType: "individual" | "company";
|
|
826
|
+
country: string;
|
|
827
|
+
object: "payout_account";
|
|
828
|
+
livemode: boolean;
|
|
829
|
+
};
|
|
830
|
+
interface Plan {
|
|
831
|
+
id: string;
|
|
832
|
+
name: string;
|
|
833
|
+
code: string;
|
|
834
|
+
description: string | null;
|
|
835
|
+
consumptionModel: ConsumptionModel | null;
|
|
836
|
+
isPublic: boolean;
|
|
837
|
+
isDefault: boolean;
|
|
556
838
|
isFree: boolean;
|
|
557
839
|
blockOnExhaustion: boolean | null;
|
|
558
840
|
sortOrder: number;
|
|
@@ -562,7 +844,7 @@ interface Plan {
|
|
|
562
844
|
createdAt: string;
|
|
563
845
|
/** @format date-time */
|
|
564
846
|
updatedAt: string;
|
|
565
|
-
features
|
|
847
|
+
features: Array<{
|
|
566
848
|
code: string;
|
|
567
849
|
name: string;
|
|
568
850
|
type: FeatureType;
|
|
@@ -575,62 +857,129 @@ interface Plan {
|
|
|
575
857
|
model: "per_unit" | null;
|
|
576
858
|
unitPrice: number | null;
|
|
577
859
|
} | null;
|
|
578
|
-
regionalPrices
|
|
860
|
+
regionalPrices: Array<{
|
|
579
861
|
currency: string;
|
|
580
862
|
overageUnitPrice: number | null;
|
|
581
863
|
autoSynced: boolean;
|
|
582
864
|
}>;
|
|
583
865
|
}>;
|
|
584
|
-
prices
|
|
866
|
+
prices: Array<{
|
|
867
|
+
/** Public plan price ID. */
|
|
868
|
+
id: string;
|
|
585
869
|
billingInterval: BillingInterval;
|
|
870
|
+
/** Price in the currency's minor unit (for example, cents for USD). */
|
|
586
871
|
price: number;
|
|
587
872
|
isDefault: boolean;
|
|
588
873
|
trialDays: number;
|
|
589
874
|
includedBalance: number | null;
|
|
590
875
|
includedCredits: number | null;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
876
|
+
/** Automatic introductory offer for this price. Pass a Promotional Offer ID when creating a subscription to override it. */
|
|
877
|
+
offerId: string | null;
|
|
878
|
+
/** Public base price ID for a market price variant, or null for a base price. */
|
|
879
|
+
inheritsFromPriceId: string | null;
|
|
880
|
+
/** Application metadata. Variant display names may use metadata.name. */
|
|
881
|
+
metadata: Record<string, unknown>;
|
|
882
|
+
/** Country-market overrides. An empty array means currency pricing and then the global USD price remain the fallback. */
|
|
883
|
+
marketPrices: Array<{
|
|
884
|
+
/** Public pricing market group ID. */
|
|
885
|
+
marketGroupId: string;
|
|
886
|
+
/** Presentment currency for this market. */
|
|
887
|
+
currency: string;
|
|
888
|
+
/** Market price in the currency's minor unit. */
|
|
889
|
+
price: number;
|
|
890
|
+
}>;
|
|
891
|
+
regionalPrices: Array<{
|
|
598
892
|
currency: string;
|
|
599
893
|
price: number;
|
|
600
894
|
includedBalance: number | null;
|
|
601
895
|
autoSynced: boolean;
|
|
602
896
|
}>;
|
|
603
897
|
}>;
|
|
604
|
-
exchangeRates
|
|
898
|
+
exchangeRates: Array<{
|
|
605
899
|
currency: string;
|
|
606
900
|
exchangeRate: number;
|
|
607
901
|
}>;
|
|
608
902
|
object: "plan";
|
|
609
903
|
livemode: boolean;
|
|
610
904
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
905
|
+
type PlanChange = {
|
|
906
|
+
outcome: "requires_checkout";
|
|
907
|
+
requiresCheckout: true;
|
|
908
|
+
checkoutUrl: string;
|
|
909
|
+
offerApplication?: {
|
|
910
|
+
id: string;
|
|
911
|
+
offerId: string;
|
|
912
|
+
name: string;
|
|
913
|
+
currency: string;
|
|
914
|
+
/** Subtotal in the currency's minor unit. */
|
|
915
|
+
subtotal: number;
|
|
916
|
+
/** Discount in the currency's minor unit. */
|
|
917
|
+
discountAmount: number;
|
|
918
|
+
/** Total in the currency's minor unit. */
|
|
919
|
+
total: number;
|
|
920
|
+
phases: Array<{
|
|
921
|
+
type: "percentage";
|
|
922
|
+
durationCycles: number;
|
|
923
|
+
startsAt: string | null;
|
|
924
|
+
endsAt: string | null;
|
|
925
|
+
/** Discount in basis points. 5000 means 50%. */
|
|
926
|
+
percentage: number;
|
|
927
|
+
} | {
|
|
928
|
+
type: "amount_off";
|
|
929
|
+
durationCycles: number;
|
|
930
|
+
startsAt: string | null;
|
|
931
|
+
endsAt: string | null;
|
|
932
|
+
/** Discount in the application currency's minor unit. */
|
|
933
|
+
amount: number;
|
|
934
|
+
} | {
|
|
935
|
+
type: "fixed_price";
|
|
936
|
+
durationCycles: number;
|
|
937
|
+
startsAt: string | null;
|
|
938
|
+
endsAt: string | null;
|
|
939
|
+
/** Fixed price in the application currency's minor unit. */
|
|
940
|
+
price: number;
|
|
941
|
+
}>;
|
|
942
|
+
};
|
|
943
|
+
object: "plan_change";
|
|
944
|
+
livemode: boolean;
|
|
945
|
+
} | {
|
|
946
|
+
outcome: "scheduled";
|
|
947
|
+
id: string;
|
|
948
|
+
scheduled: true;
|
|
616
949
|
/** @format date-time */
|
|
617
|
-
scheduledFor
|
|
618
|
-
changeType
|
|
619
|
-
customerId
|
|
950
|
+
scheduledFor: string;
|
|
951
|
+
changeType: "subscription.plan_downgrade" | "subscription.interval_change" | "subscription.cancel";
|
|
952
|
+
customerId: string;
|
|
620
953
|
newPlanId?: string;
|
|
621
954
|
newPlanName?: string;
|
|
622
955
|
newBillingInterval?: string;
|
|
623
|
-
|
|
956
|
+
seatLimitWarning?: {
|
|
957
|
+
featureCode: string;
|
|
958
|
+
featureName: string;
|
|
959
|
+
currentSeats: number;
|
|
960
|
+
included: number;
|
|
961
|
+
newPlanName: string;
|
|
962
|
+
/** @format date-time */
|
|
963
|
+
effectiveDate: string;
|
|
964
|
+
};
|
|
965
|
+
object: "plan_change";
|
|
966
|
+
livemode: boolean;
|
|
967
|
+
} | {
|
|
968
|
+
outcome: "completed";
|
|
969
|
+
id: string;
|
|
970
|
+
scheduled: false;
|
|
971
|
+
customerId: string;
|
|
972
|
+
previousPlan: {
|
|
624
973
|
id: string;
|
|
625
974
|
name: string;
|
|
626
975
|
};
|
|
627
|
-
currentPlan
|
|
976
|
+
currentPlan: {
|
|
628
977
|
id: string;
|
|
629
978
|
name: string;
|
|
630
979
|
price: number;
|
|
631
980
|
};
|
|
632
|
-
billingInterval
|
|
633
|
-
billing
|
|
981
|
+
billingInterval: string;
|
|
982
|
+
billing: {
|
|
634
983
|
credit: number;
|
|
635
984
|
creditsApplied: number;
|
|
636
985
|
charge: number;
|
|
@@ -640,18 +989,43 @@ interface PlanChange {
|
|
|
640
989
|
remainingCreditBalance: number;
|
|
641
990
|
};
|
|
642
991
|
invoiceId?: string;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
992
|
+
offerApplication?: {
|
|
993
|
+
id: string;
|
|
994
|
+
offerId: string;
|
|
995
|
+
name: string;
|
|
996
|
+
currency: string;
|
|
997
|
+
/** Subtotal in the currency's minor unit. */
|
|
998
|
+
subtotal: number;
|
|
999
|
+
/** Discount in the currency's minor unit. */
|
|
1000
|
+
discountAmount: number;
|
|
1001
|
+
/** Total in the currency's minor unit. */
|
|
1002
|
+
total: number;
|
|
1003
|
+
phases: Array<{
|
|
1004
|
+
type: "percentage";
|
|
1005
|
+
durationCycles: number;
|
|
1006
|
+
startsAt: string | null;
|
|
1007
|
+
endsAt: string | null;
|
|
1008
|
+
/** Discount in basis points. 5000 means 50%. */
|
|
1009
|
+
percentage: number;
|
|
1010
|
+
} | {
|
|
1011
|
+
type: "amount_off";
|
|
1012
|
+
durationCycles: number;
|
|
1013
|
+
startsAt: string | null;
|
|
1014
|
+
endsAt: string | null;
|
|
1015
|
+
/** Discount in the application currency's minor unit. */
|
|
1016
|
+
amount: number;
|
|
1017
|
+
} | {
|
|
1018
|
+
type: "fixed_price";
|
|
1019
|
+
durationCycles: number;
|
|
1020
|
+
startsAt: string | null;
|
|
1021
|
+
endsAt: string | null;
|
|
1022
|
+
/** Fixed price in the application currency's minor unit. */
|
|
1023
|
+
price: number;
|
|
1024
|
+
}>;
|
|
651
1025
|
};
|
|
652
|
-
object: "
|
|
1026
|
+
object: "plan_change";
|
|
653
1027
|
livemode: boolean;
|
|
654
|
-
}
|
|
1028
|
+
};
|
|
655
1029
|
interface PlanFeature {
|
|
656
1030
|
planId: string;
|
|
657
1031
|
featureId: string;
|
|
@@ -665,7 +1039,7 @@ interface PlanFeature {
|
|
|
665
1039
|
creditsPerUnit: number | null;
|
|
666
1040
|
pricingMode: "fixed" | "ai_model";
|
|
667
1041
|
margin: number | null;
|
|
668
|
-
object: "
|
|
1042
|
+
object: "plan_feature";
|
|
669
1043
|
livemode: boolean;
|
|
670
1044
|
}
|
|
671
1045
|
interface PlanGroup {
|
|
@@ -677,7 +1051,19 @@ interface PlanGroup {
|
|
|
677
1051
|
createdAt: string;
|
|
678
1052
|
/** @format date-time */
|
|
679
1053
|
updatedAt: string;
|
|
680
|
-
|
|
1054
|
+
object: "plan_group";
|
|
1055
|
+
livemode: boolean;
|
|
1056
|
+
}
|
|
1057
|
+
interface PlanGroupDetail {
|
|
1058
|
+
id: string;
|
|
1059
|
+
name: string;
|
|
1060
|
+
description: string | null;
|
|
1061
|
+
isPublic: boolean;
|
|
1062
|
+
/** @format date-time */
|
|
1063
|
+
createdAt: string;
|
|
1064
|
+
/** @format date-time */
|
|
1065
|
+
updatedAt: string;
|
|
1066
|
+
plans: Array<{
|
|
681
1067
|
id: string;
|
|
682
1068
|
name: string;
|
|
683
1069
|
sortOrder: number;
|
|
@@ -686,25 +1072,36 @@ interface PlanGroup {
|
|
|
686
1072
|
livemode: boolean;
|
|
687
1073
|
}
|
|
688
1074
|
interface PlanPrice {
|
|
1075
|
+
/** Public plan price ID. */
|
|
689
1076
|
id: string;
|
|
690
1077
|
planId: string;
|
|
691
1078
|
billingInterval: BillingInterval;
|
|
1079
|
+
/** Price in the currency's minor unit (for example, cents for USD). */
|
|
692
1080
|
price: number;
|
|
693
1081
|
isDefault: boolean;
|
|
694
1082
|
trialDays: number;
|
|
695
1083
|
includedBalance: number | null;
|
|
696
1084
|
includedCredits: number | null;
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
1085
|
+
/** Automatic introductory offer for this price. */
|
|
1086
|
+
offerId: string | null;
|
|
1087
|
+
/** Public base price ID for a market price variant, or null for a base price. */
|
|
1088
|
+
inheritsFromPriceId: string | null;
|
|
1089
|
+
/** Application metadata. Variant display names may use metadata.name. */
|
|
1090
|
+
metadata: Record<string, unknown>;
|
|
1091
|
+
/** Country-market overrides. Variants inherit their base price for every market not listed. */
|
|
1092
|
+
marketPrices: Array<{
|
|
1093
|
+
/** Public pricing market group ID. */
|
|
1094
|
+
marketGroupId: string;
|
|
1095
|
+
/** Presentment currency for this market. */
|
|
1096
|
+
currency: string;
|
|
1097
|
+
/** Market price in the currency's minor unit. */
|
|
1098
|
+
price: number;
|
|
1099
|
+
}>;
|
|
703
1100
|
/** @format date-time */
|
|
704
1101
|
createdAt: string;
|
|
705
1102
|
/** @format date-time */
|
|
706
1103
|
updatedAt: string;
|
|
707
|
-
object: "
|
|
1104
|
+
object: "plan_price";
|
|
708
1105
|
livemode: boolean;
|
|
709
1106
|
}
|
|
710
1107
|
interface PlanRegionalPricing {
|
|
@@ -714,7 +1111,7 @@ interface PlanRegionalPricing {
|
|
|
714
1111
|
price: number;
|
|
715
1112
|
includedBalance?: number;
|
|
716
1113
|
}>;
|
|
717
|
-
object: "
|
|
1114
|
+
object: "plan_regional_pricing";
|
|
718
1115
|
livemode: boolean;
|
|
719
1116
|
}
|
|
720
1117
|
interface PlanRegionalPricingResult {
|
|
@@ -723,13 +1120,7 @@ interface PlanRegionalPricingResult {
|
|
|
723
1120
|
exchangeRate: number;
|
|
724
1121
|
pricesConfigured: number;
|
|
725
1122
|
featuresConfigured: number;
|
|
726
|
-
object: "
|
|
727
|
-
livemode: boolean;
|
|
728
|
-
}
|
|
729
|
-
interface PlanVisibility {
|
|
730
|
-
id: string;
|
|
731
|
-
isPublic: boolean;
|
|
732
|
-
object: "plan";
|
|
1123
|
+
object: "plan_regional_pricing";
|
|
733
1124
|
livemode: boolean;
|
|
734
1125
|
}
|
|
735
1126
|
interface PortalAccess {
|
|
@@ -747,15 +1138,47 @@ interface PreviewChange {
|
|
|
747
1138
|
daysRemaining: number;
|
|
748
1139
|
totalDays: number;
|
|
749
1140
|
isUpgrade: boolean;
|
|
750
|
-
|
|
1141
|
+
offerApplication?: {
|
|
1142
|
+
id: string;
|
|
1143
|
+
offerId: string;
|
|
1144
|
+
name: string;
|
|
1145
|
+
currency: string;
|
|
1146
|
+
/** Subtotal in the currency's minor unit. */
|
|
1147
|
+
subtotal: number;
|
|
1148
|
+
/** Discount in the currency's minor unit. */
|
|
1149
|
+
discountAmount: number;
|
|
1150
|
+
/** Total in the currency's minor unit. */
|
|
1151
|
+
total: number;
|
|
1152
|
+
phases: Array<{
|
|
1153
|
+
type: "percentage";
|
|
1154
|
+
durationCycles: number;
|
|
1155
|
+
startsAt: string | null;
|
|
1156
|
+
endsAt: string | null;
|
|
1157
|
+
/** Discount in basis points. 5000 means 50%. */
|
|
1158
|
+
percentage: number;
|
|
1159
|
+
} | {
|
|
1160
|
+
type: "amount_off";
|
|
1161
|
+
durationCycles: number;
|
|
1162
|
+
startsAt: string | null;
|
|
1163
|
+
endsAt: string | null;
|
|
1164
|
+
/** Discount in the application currency's minor unit. */
|
|
1165
|
+
amount: number;
|
|
1166
|
+
} | {
|
|
1167
|
+
type: "fixed_price";
|
|
1168
|
+
durationCycles: number;
|
|
1169
|
+
startsAt: string | null;
|
|
1170
|
+
endsAt: string | null;
|
|
1171
|
+
/** Fixed price in the application currency's minor unit. */
|
|
1172
|
+
price: number;
|
|
1173
|
+
}>;
|
|
1174
|
+
};
|
|
1175
|
+
object: "plan_change_preview";
|
|
751
1176
|
livemode: boolean;
|
|
752
1177
|
}
|
|
753
1178
|
interface PromoCode {
|
|
754
1179
|
id: string;
|
|
755
1180
|
code: string;
|
|
756
|
-
|
|
757
|
-
discountValue: number;
|
|
758
|
-
durationCycles: number | null;
|
|
1181
|
+
offerId: string;
|
|
759
1182
|
billingInterval: BillingInterval | null;
|
|
760
1183
|
maxRedemptions: number | null;
|
|
761
1184
|
expiresAt: string | null;
|
|
@@ -769,43 +1192,94 @@ interface PromoCode {
|
|
|
769
1192
|
livemode: boolean;
|
|
770
1193
|
}
|
|
771
1194
|
interface ReactivatedSubscription {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
1195
|
+
subscriptionId: string;
|
|
1196
|
+
invoiceId: string;
|
|
1197
|
+
status: "processing" | "succeeded";
|
|
1198
|
+
offerApplication?: {
|
|
1199
|
+
id: string;
|
|
1200
|
+
offerId: string;
|
|
1201
|
+
name: string;
|
|
1202
|
+
currency: string;
|
|
1203
|
+
/** Subtotal in the currency's minor unit. */
|
|
1204
|
+
subtotal: number;
|
|
1205
|
+
/** Discount in the currency's minor unit. */
|
|
1206
|
+
discountAmount: number;
|
|
1207
|
+
/** Total in the currency's minor unit. */
|
|
1208
|
+
total: number;
|
|
1209
|
+
phases: Array<{
|
|
1210
|
+
type: "percentage";
|
|
1211
|
+
durationCycles: number;
|
|
1212
|
+
startsAt: string | null;
|
|
1213
|
+
endsAt: string | null;
|
|
1214
|
+
/** Discount in basis points. 5000 means 50%. */
|
|
1215
|
+
percentage: number;
|
|
1216
|
+
} | {
|
|
1217
|
+
type: "amount_off";
|
|
1218
|
+
durationCycles: number;
|
|
1219
|
+
startsAt: string | null;
|
|
1220
|
+
endsAt: string | null;
|
|
1221
|
+
/** Discount in the application currency's minor unit. */
|
|
1222
|
+
amount: number;
|
|
1223
|
+
} | {
|
|
1224
|
+
type: "fixed_price";
|
|
1225
|
+
durationCycles: number;
|
|
1226
|
+
startsAt: string | null;
|
|
1227
|
+
endsAt: string | null;
|
|
1228
|
+
/** Fixed price in the application currency's minor unit. */
|
|
1229
|
+
price: number;
|
|
1230
|
+
}>;
|
|
1231
|
+
};
|
|
1232
|
+
object: "subscription_reactivation";
|
|
775
1233
|
livemode: boolean;
|
|
776
1234
|
}
|
|
777
1235
|
interface RecoveryLink {
|
|
778
1236
|
url: string;
|
|
779
1237
|
token: string;
|
|
780
|
-
object: "
|
|
1238
|
+
object: "recovery_link";
|
|
1239
|
+
livemode: boolean;
|
|
1240
|
+
}
|
|
1241
|
+
interface Refund {
|
|
1242
|
+
id: string;
|
|
1243
|
+
transactionId: string;
|
|
1244
|
+
amount: number;
|
|
1245
|
+
currency: string;
|
|
1246
|
+
chargeId: string | null;
|
|
1247
|
+
status: "pending" | "requires_action" | "succeeded" | "failed" | "canceled";
|
|
1248
|
+
reason: "duplicate" | "fraudulent" | "requested_by_customer" | null;
|
|
1249
|
+
object: "refund";
|
|
781
1250
|
livemode: boolean;
|
|
782
1251
|
}
|
|
783
1252
|
interface RemovedPlanFeature {
|
|
784
1253
|
id: string;
|
|
785
1254
|
removed: true;
|
|
786
|
-
object: "
|
|
1255
|
+
object: "plan_feature";
|
|
787
1256
|
livemode: boolean;
|
|
788
1257
|
}
|
|
789
1258
|
interface RemovedPlanFromGroup {
|
|
790
1259
|
id: string;
|
|
791
1260
|
removed: boolean;
|
|
792
|
-
object: "
|
|
1261
|
+
object: "plan_group_membership";
|
|
793
1262
|
livemode: boolean;
|
|
794
1263
|
}
|
|
795
1264
|
interface ReorderedPlans {
|
|
796
1265
|
reordered: boolean;
|
|
797
|
-
object: "
|
|
1266
|
+
object: "plan_group_order";
|
|
798
1267
|
livemode: boolean;
|
|
799
1268
|
}
|
|
800
1269
|
interface SeatBalance {
|
|
801
1270
|
current: number;
|
|
802
1271
|
/** @format date-time */
|
|
803
1272
|
asOf: string;
|
|
804
|
-
object: "
|
|
1273
|
+
object: "seat_balance";
|
|
805
1274
|
livemode: boolean;
|
|
806
1275
|
}
|
|
807
|
-
interface
|
|
808
|
-
|
|
1276
|
+
interface SeatBalanceCollection {
|
|
1277
|
+
balances: Record<string, {
|
|
1278
|
+
current: number;
|
|
1279
|
+
/** @format date-time */
|
|
1280
|
+
asOf: string;
|
|
1281
|
+
}>;
|
|
1282
|
+
object: "seat_balance_collection";
|
|
809
1283
|
livemode: boolean;
|
|
810
1284
|
}
|
|
811
1285
|
interface SeatEvent {
|
|
@@ -818,14 +1292,14 @@ interface SeatEvent {
|
|
|
818
1292
|
ts: string;
|
|
819
1293
|
/** @format date-time */
|
|
820
1294
|
createdAt: string;
|
|
821
|
-
object: "
|
|
1295
|
+
object: "seat_event";
|
|
822
1296
|
livemode: boolean;
|
|
823
1297
|
}
|
|
824
1298
|
interface SentInvoice {
|
|
825
1299
|
sent: boolean;
|
|
826
1300
|
/** @format date-time */
|
|
827
1301
|
sentAt: string;
|
|
828
|
-
object: "
|
|
1302
|
+
object: "invoice_delivery";
|
|
829
1303
|
livemode: boolean;
|
|
830
1304
|
}
|
|
831
1305
|
interface Subscription {
|
|
@@ -834,13 +1308,12 @@ interface Subscription {
|
|
|
834
1308
|
plan: {
|
|
835
1309
|
id: string;
|
|
836
1310
|
name: string;
|
|
837
|
-
basePrice
|
|
1311
|
+
basePrice: number;
|
|
838
1312
|
};
|
|
839
1313
|
name: string;
|
|
840
1314
|
description: string | null;
|
|
841
1315
|
status: SubscriptionStatus;
|
|
842
1316
|
billingInterval: BillingInterval | null;
|
|
843
|
-
consumptionModel?: ConsumptionModel | null;
|
|
844
1317
|
trialEndsAt: string | null;
|
|
845
1318
|
currentPeriod: {
|
|
846
1319
|
/** @format date-time */
|
|
@@ -849,28 +1322,109 @@ interface Subscription {
|
|
|
849
1322
|
end: string;
|
|
850
1323
|
daysRemaining: number;
|
|
851
1324
|
} | null;
|
|
852
|
-
|
|
1325
|
+
cancellation: {
|
|
1326
|
+
/** @format date-time */
|
|
1327
|
+
scheduledAt: string;
|
|
1328
|
+
reason: string | null;
|
|
1329
|
+
/** @format date-time */
|
|
1330
|
+
effectiveAt: string;
|
|
1331
|
+
} | null;
|
|
1332
|
+
cancelAtPeriodEnd: boolean;
|
|
1333
|
+
scheduledPlanChange: {
|
|
1334
|
+
changeType: "plan_downgrade" | "interval_change";
|
|
1335
|
+
newPlanId: string | null;
|
|
1336
|
+
newPlanName: string | null;
|
|
1337
|
+
newBillingInterval: string | null;
|
|
1338
|
+
/** @format date-time */
|
|
1339
|
+
scheduledFor: string;
|
|
1340
|
+
} | null;
|
|
1341
|
+
discount: {
|
|
1342
|
+
type: "percentage" | "amount";
|
|
1343
|
+
value: number;
|
|
1344
|
+
name: string | null;
|
|
1345
|
+
endsAt: string | null;
|
|
1346
|
+
} | null;
|
|
1347
|
+
/** @format date-time */
|
|
1348
|
+
startDate: string;
|
|
1349
|
+
endDate: string | null;
|
|
1350
|
+
billingDayOfMonth: number | null;
|
|
1351
|
+
nextBillingDate: string | null;
|
|
1352
|
+
checkoutUrl: string | null;
|
|
1353
|
+
/** @format date-time */
|
|
1354
|
+
createdAt: string;
|
|
1355
|
+
/** @format date-time */
|
|
1356
|
+
updatedAt: string;
|
|
1357
|
+
consumptionModel: ConsumptionModel | null;
|
|
1358
|
+
features: Array<{
|
|
853
1359
|
code: string;
|
|
854
1360
|
name: string;
|
|
855
|
-
type:
|
|
856
|
-
enabled
|
|
1361
|
+
type: "boolean";
|
|
1362
|
+
enabled: boolean;
|
|
1363
|
+
} | {
|
|
1364
|
+
code: string;
|
|
1365
|
+
name: string;
|
|
1366
|
+
type: "usage";
|
|
857
1367
|
usage?: {
|
|
858
1368
|
current: number;
|
|
859
1369
|
included: number;
|
|
860
1370
|
overageQuantity: number;
|
|
861
1371
|
overageUnitPrice?: number;
|
|
862
1372
|
};
|
|
1373
|
+
} | {
|
|
1374
|
+
code: string;
|
|
1375
|
+
name: string;
|
|
1376
|
+
type: "seats";
|
|
1377
|
+
usage: {
|
|
1378
|
+
current: number;
|
|
1379
|
+
included: number;
|
|
1380
|
+
overageQuantity: number;
|
|
1381
|
+
overageUnitPrice?: number;
|
|
1382
|
+
};
|
|
1383
|
+
} | {
|
|
1384
|
+
code: string;
|
|
1385
|
+
name: string;
|
|
1386
|
+
type: "quota";
|
|
863
1387
|
}>;
|
|
864
|
-
credits
|
|
1388
|
+
credits: {
|
|
865
1389
|
remaining: number;
|
|
866
1390
|
included: number;
|
|
867
1391
|
purchased: number;
|
|
868
1392
|
} | null;
|
|
869
|
-
balance
|
|
1393
|
+
balance: {
|
|
870
1394
|
remaining: number;
|
|
871
1395
|
included: number;
|
|
872
1396
|
currency: string;
|
|
873
1397
|
} | null;
|
|
1398
|
+
priceId: string | null;
|
|
1399
|
+
object: "subscription";
|
|
1400
|
+
livemode: boolean;
|
|
1401
|
+
}
|
|
1402
|
+
interface SubscriptionAddon {
|
|
1403
|
+
addonId: string;
|
|
1404
|
+
status: "active";
|
|
1405
|
+
proratedCharge: number;
|
|
1406
|
+
object: "subscription_addon";
|
|
1407
|
+
livemode: boolean;
|
|
1408
|
+
}
|
|
1409
|
+
interface SubscriptionSummary {
|
|
1410
|
+
id: string;
|
|
1411
|
+
customerId: string;
|
|
1412
|
+
plan: {
|
|
1413
|
+
id: string;
|
|
1414
|
+
name: string;
|
|
1415
|
+
};
|
|
1416
|
+
name: string;
|
|
1417
|
+
description: string | null;
|
|
1418
|
+
status: SubscriptionStatus;
|
|
1419
|
+
billingInterval: BillingInterval | null;
|
|
1420
|
+
trialEndsAt: string | null;
|
|
1421
|
+
currentPeriod: {
|
|
1422
|
+
/** @format date-time */
|
|
1423
|
+
start: string;
|
|
1424
|
+
/** @format date-time */
|
|
1425
|
+
end: string;
|
|
1426
|
+
daysRemaining: number;
|
|
1427
|
+
} | null;
|
|
874
1428
|
cancellation: {
|
|
875
1429
|
/** @format date-time */
|
|
876
1430
|
scheduledAt: string;
|
|
@@ -888,7 +1442,7 @@ interface Subscription {
|
|
|
888
1442
|
scheduledFor: string;
|
|
889
1443
|
} | null;
|
|
890
1444
|
discount: {
|
|
891
|
-
type:
|
|
1445
|
+
type: "percentage" | "amount";
|
|
892
1446
|
value: number;
|
|
893
1447
|
name: string | null;
|
|
894
1448
|
endsAt: string | null;
|
|
@@ -899,19 +1453,11 @@ interface Subscription {
|
|
|
899
1453
|
billingDayOfMonth: number | null;
|
|
900
1454
|
nextBillingDate: string | null;
|
|
901
1455
|
checkoutUrl: string | null;
|
|
902
|
-
/** Payment provider resolved for this checkout when the subscription response was created. This is an informational snapshot and may differ when the checkout is loaded if its country or the organization's routing changes. */
|
|
903
|
-
checkoutProvider?: PaymentProvider | null;
|
|
904
1456
|
/** @format date-time */
|
|
905
1457
|
createdAt: string;
|
|
906
1458
|
/** @format date-time */
|
|
907
1459
|
updatedAt: string;
|
|
908
|
-
|
|
909
|
-
livemode: boolean;
|
|
910
|
-
}
|
|
911
|
-
interface SubscriptionAddon {
|
|
912
|
-
addonId: string;
|
|
913
|
-
status: "active";
|
|
914
|
-
proratedCharge: number;
|
|
1460
|
+
priceId: string | null;
|
|
915
1461
|
object: "subscription";
|
|
916
1462
|
livemode: boolean;
|
|
917
1463
|
}
|
|
@@ -929,13 +1475,13 @@ interface TestClockBilling {
|
|
|
929
1475
|
failed: number;
|
|
930
1476
|
dunningRetried: number;
|
|
931
1477
|
dunningFailed: number;
|
|
932
|
-
object: "
|
|
1478
|
+
object: "test_clock_run";
|
|
933
1479
|
livemode: boolean;
|
|
934
1480
|
}
|
|
935
1481
|
interface Transaction {
|
|
936
1482
|
id: string;
|
|
937
1483
|
invoiceId: string | null;
|
|
938
|
-
/** Gross amount in USD cents. Null when the
|
|
1484
|
+
/** Gross amount in USD cents. Null when the provider has not reported an honest USD figure; see presentmentAmount. */
|
|
939
1485
|
grossAmount: number | null;
|
|
940
1486
|
/** Subtotal in USD cents (gross minus tax). Null when grossAmount is null. */
|
|
941
1487
|
subtotal: number | null;
|
|
@@ -953,45 +1499,140 @@ interface Transaction {
|
|
|
953
1499
|
createdAt: string;
|
|
954
1500
|
/** @format date-time */
|
|
955
1501
|
updatedAt: string;
|
|
956
|
-
availableAt
|
|
1502
|
+
availableAt: string | null;
|
|
957
1503
|
object: "transaction";
|
|
958
1504
|
livemode: boolean;
|
|
959
1505
|
}
|
|
960
|
-
interface
|
|
1506
|
+
interface TransactionListItem {
|
|
961
1507
|
id: string;
|
|
962
|
-
|
|
1508
|
+
invoiceId: string | null;
|
|
1509
|
+
/** Gross amount in USD cents. Null when the provider has not reported an honest USD figure; see presentmentAmount. */
|
|
1510
|
+
grossAmount: number | null;
|
|
1511
|
+
/** Subtotal in USD cents (gross minus tax). Null when grossAmount is null. */
|
|
1512
|
+
subtotal: number | null;
|
|
1513
|
+
taxAmount: number | null;
|
|
1514
|
+
/** Amount in the charge currency's smallest unit, as presented to the customer. Set for non-USD charges; null when the charge was made in USD. */
|
|
1515
|
+
presentmentAmount: number | null;
|
|
1516
|
+
currency: string;
|
|
1517
|
+
/** The payment provider the charge was routed to: stripe, commet, or dlocal. */
|
|
1518
|
+
provider: PaymentProvider;
|
|
1519
|
+
status: TransactionStatus;
|
|
1520
|
+
customerEmail: string | null;
|
|
1521
|
+
customerName: string | null;
|
|
1522
|
+
paidAt: string | null;
|
|
1523
|
+
/** @format date-time */
|
|
1524
|
+
createdAt: string;
|
|
1525
|
+
/** @format date-time */
|
|
1526
|
+
updatedAt: string;
|
|
963
1527
|
object: "transaction";
|
|
964
1528
|
livemode: boolean;
|
|
965
1529
|
}
|
|
966
1530
|
interface TransactionRetry {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1531
|
+
originalTransactionId: string;
|
|
1532
|
+
invoiceId: string;
|
|
1533
|
+
status: "processing" | "succeeded";
|
|
1534
|
+
object: "transaction_retry";
|
|
970
1535
|
livemode: boolean;
|
|
971
1536
|
}
|
|
972
|
-
interface
|
|
1537
|
+
interface UsageAdjustment {
|
|
973
1538
|
id: string;
|
|
1539
|
+
value: number;
|
|
1540
|
+
previousValue: number;
|
|
1541
|
+
adjustment: number;
|
|
974
1542
|
customerId: string;
|
|
975
|
-
|
|
1543
|
+
reason: string | null;
|
|
976
1544
|
/** @format date-time */
|
|
977
|
-
|
|
978
|
-
|
|
1545
|
+
ts: string;
|
|
1546
|
+
/** @format date-time */
|
|
1547
|
+
createdAt: string;
|
|
1548
|
+
featureCode: string;
|
|
1549
|
+
object: "usage_adjustment";
|
|
979
1550
|
livemode: boolean;
|
|
980
1551
|
}
|
|
981
|
-
|
|
1552
|
+
type UsageCheck = {
|
|
1553
|
+
allowed: boolean;
|
|
1554
|
+
subscriptionStatus: string;
|
|
982
1555
|
featureCode: string;
|
|
1556
|
+
quantity: number;
|
|
1557
|
+
reason?: string;
|
|
1558
|
+
message?: string;
|
|
1559
|
+
consumptionModel: "metered";
|
|
983
1560
|
current: number;
|
|
984
|
-
|
|
985
|
-
remaining: number | null;
|
|
986
|
-
billedQuantity: number;
|
|
1561
|
+
remaining: number;
|
|
987
1562
|
unlimited: boolean;
|
|
1563
|
+
included: number;
|
|
988
1564
|
overageEnabled: boolean;
|
|
989
|
-
|
|
990
|
-
object: "
|
|
1565
|
+
overageUnitPrice: number | null;
|
|
1566
|
+
object: "usage_check";
|
|
991
1567
|
livemode: boolean;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
|
|
1568
|
+
} | {
|
|
1569
|
+
allowed: boolean;
|
|
1570
|
+
subscriptionStatus: string;
|
|
1571
|
+
featureCode: string;
|
|
1572
|
+
quantity: number;
|
|
1573
|
+
reason?: string;
|
|
1574
|
+
message?: string;
|
|
1575
|
+
consumptionModel: "credits";
|
|
1576
|
+
creditsPerUnit: number;
|
|
1577
|
+
estimatedCredits: number;
|
|
1578
|
+
planCredits: number;
|
|
1579
|
+
purchasedCredits: number;
|
|
1580
|
+
totalCredits: number;
|
|
1581
|
+
object: "usage_check";
|
|
1582
|
+
livemode: boolean;
|
|
1583
|
+
} | {
|
|
1584
|
+
allowed: boolean;
|
|
1585
|
+
subscriptionStatus: string;
|
|
1586
|
+
featureCode: string;
|
|
1587
|
+
quantity: number;
|
|
1588
|
+
reason?: string;
|
|
1589
|
+
message?: string;
|
|
1590
|
+
consumptionModel: "balance";
|
|
1591
|
+
unitPrice: number;
|
|
1592
|
+
estimatedAmount: number;
|
|
1593
|
+
currentBalance: number;
|
|
1594
|
+
blockOnExhaustion: boolean;
|
|
1595
|
+
currency: string;
|
|
1596
|
+
object: "usage_check";
|
|
1597
|
+
livemode: boolean;
|
|
1598
|
+
};
|
|
1599
|
+
interface UsageEvent {
|
|
1600
|
+
id: string;
|
|
1601
|
+
featureCode: string;
|
|
1602
|
+
value: number;
|
|
1603
|
+
customerId: string;
|
|
1604
|
+
eventId: string | null;
|
|
1605
|
+
/** @format date-time */
|
|
1606
|
+
ts: string;
|
|
1607
|
+
/** @format date-time */
|
|
1608
|
+
createdAt: string;
|
|
1609
|
+
properties: Array<{
|
|
1610
|
+
property: string;
|
|
1611
|
+
value: string;
|
|
1612
|
+
}>;
|
|
1613
|
+
consumption?: {
|
|
1614
|
+
model: "credits" | "balance";
|
|
1615
|
+
deducted: number;
|
|
1616
|
+
remaining: number;
|
|
1617
|
+
blocked: boolean;
|
|
1618
|
+
};
|
|
1619
|
+
object: "usage_event";
|
|
1620
|
+
livemode: boolean;
|
|
1621
|
+
}
|
|
1622
|
+
interface UsageQuota {
|
|
1623
|
+
featureCode: string;
|
|
1624
|
+
current: number;
|
|
1625
|
+
included: number;
|
|
1626
|
+
remaining: number | null;
|
|
1627
|
+
billedQuantity: number;
|
|
1628
|
+
unlimited: boolean;
|
|
1629
|
+
overageEnabled: boolean;
|
|
1630
|
+
asOf: string | null;
|
|
1631
|
+
object: "usage_quota";
|
|
1632
|
+
livemode: boolean;
|
|
1633
|
+
}
|
|
1634
|
+
interface UsageQuotaEvent {
|
|
1635
|
+
id: string;
|
|
995
1636
|
customerId: string;
|
|
996
1637
|
featureCode: string;
|
|
997
1638
|
previousBalance: number;
|
|
@@ -1000,7 +1641,19 @@ interface UsageQuotaEvent {
|
|
|
1000
1641
|
ts: string;
|
|
1001
1642
|
/** @format date-time */
|
|
1002
1643
|
createdAt: string;
|
|
1003
|
-
object: "
|
|
1644
|
+
object: "usage_quota_event";
|
|
1645
|
+
livemode: boolean;
|
|
1646
|
+
}
|
|
1647
|
+
interface Webhook {
|
|
1648
|
+
id: string;
|
|
1649
|
+
url: string;
|
|
1650
|
+
events: Array<string>;
|
|
1651
|
+
description: string | null;
|
|
1652
|
+
isActive: boolean;
|
|
1653
|
+
apiVersion: string | null;
|
|
1654
|
+
/** @format date-time */
|
|
1655
|
+
createdAt: string;
|
|
1656
|
+
object: "webhook";
|
|
1004
1657
|
livemode: boolean;
|
|
1005
1658
|
}
|
|
1006
1659
|
interface WebhookAddonRef {
|
|
@@ -1025,21 +1678,6 @@ interface WebhookCreditsBalance {
|
|
|
1025
1678
|
purchasedCredits: number;
|
|
1026
1679
|
totalCredits: number;
|
|
1027
1680
|
}
|
|
1028
|
-
interface WebhookFeatureAccess {
|
|
1029
|
-
code: string;
|
|
1030
|
-
name: string;
|
|
1031
|
-
type: string;
|
|
1032
|
-
allowed: boolean;
|
|
1033
|
-
enabled: boolean | null;
|
|
1034
|
-
current: number | null;
|
|
1035
|
-
included: number | null;
|
|
1036
|
-
remaining: number | null;
|
|
1037
|
-
overageQuantity: number | null;
|
|
1038
|
-
overageUnitPrice: number | null;
|
|
1039
|
-
unlimited: boolean | null;
|
|
1040
|
-
overageEnabled: boolean | null;
|
|
1041
|
-
billedQuantity: number | null;
|
|
1042
|
-
}
|
|
1043
1681
|
interface WebhookPlanRef {
|
|
1044
1682
|
id: string;
|
|
1045
1683
|
name: string;
|
|
@@ -1051,6 +1689,14 @@ interface WebhookSeatSummary {
|
|
|
1051
1689
|
remaining: number | null;
|
|
1052
1690
|
unlimited: boolean | null;
|
|
1053
1691
|
}
|
|
1692
|
+
interface WebhookTest {
|
|
1693
|
+
success: boolean;
|
|
1694
|
+
deliveryId: string;
|
|
1695
|
+
/** @format date-time */
|
|
1696
|
+
deliveredAt: string;
|
|
1697
|
+
object: "webhook_delivery";
|
|
1698
|
+
livemode: boolean;
|
|
1699
|
+
}
|
|
1054
1700
|
|
|
1055
1701
|
declare class CommetHTTPClient {
|
|
1056
1702
|
private config;
|
|
@@ -1058,10 +1704,11 @@ declare class CommetHTTPClient {
|
|
|
1058
1704
|
private telemetryEnabled;
|
|
1059
1705
|
private lastRequestMetrics;
|
|
1060
1706
|
constructor(config: CommetClientOptions);
|
|
1061
|
-
get<T = unknown>(endpoint: string, params?: Record<string, unknown> | object, options?: RequestOptions): Promise<
|
|
1062
|
-
post<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<
|
|
1063
|
-
put<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<
|
|
1064
|
-
|
|
1707
|
+
get<T = unknown>(endpoint: string, params?: Record<string, unknown> | object, options?: RequestOptions): Promise<T>;
|
|
1708
|
+
post<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<T>;
|
|
1709
|
+
put<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<T>;
|
|
1710
|
+
patch<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<T>;
|
|
1711
|
+
delete<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<T>;
|
|
1065
1712
|
private resolveApiVersion;
|
|
1066
1713
|
private static readonly BODY_METHODS;
|
|
1067
1714
|
private request;
|
|
@@ -1085,23 +1732,9 @@ declare class CommetHTTPClient {
|
|
|
1085
1732
|
interface ListActiveAddonsParams {
|
|
1086
1733
|
customerId: string;
|
|
1087
1734
|
}
|
|
1088
|
-
interface ListAddonsParams {
|
|
1089
|
-
limit?: number;
|
|
1090
|
-
cursor?: string;
|
|
1091
|
-
}
|
|
1092
1735
|
interface GetAddonParams {
|
|
1093
1736
|
id: string;
|
|
1094
1737
|
}
|
|
1095
|
-
interface CreateAddonParams {
|
|
1096
|
-
name: string;
|
|
1097
|
-
description?: string;
|
|
1098
|
-
basePrice: number;
|
|
1099
|
-
featureId: string;
|
|
1100
|
-
consumptionModel: "boolean" | "metered" | "credits" | "balance";
|
|
1101
|
-
includedUnits?: number;
|
|
1102
|
-
overageRate?: number;
|
|
1103
|
-
creditCost?: number;
|
|
1104
|
-
}
|
|
1105
1738
|
interface UpdateAddonParams {
|
|
1106
1739
|
id: string;
|
|
1107
1740
|
name?: string;
|
|
@@ -1113,25 +1746,70 @@ interface UpdateAddonParams {
|
|
|
1113
1746
|
interface DeleteAddonParams {
|
|
1114
1747
|
id: string;
|
|
1115
1748
|
}
|
|
1749
|
+
interface ListAddonsParams {
|
|
1750
|
+
cursor?: string;
|
|
1751
|
+
limit?: number;
|
|
1752
|
+
}
|
|
1753
|
+
type CreateAddonParams = {
|
|
1754
|
+
name: string;
|
|
1755
|
+
description?: string;
|
|
1756
|
+
basePrice: number;
|
|
1757
|
+
featureId: string;
|
|
1758
|
+
consumptionModel: "boolean";
|
|
1759
|
+
} | {
|
|
1760
|
+
name: string;
|
|
1761
|
+
description?: string;
|
|
1762
|
+
basePrice: number;
|
|
1763
|
+
featureId: string;
|
|
1764
|
+
consumptionModel: "metered";
|
|
1765
|
+
includedUnits: number;
|
|
1766
|
+
overageRate: number;
|
|
1767
|
+
} | {
|
|
1768
|
+
name: string;
|
|
1769
|
+
description?: string;
|
|
1770
|
+
basePrice: number;
|
|
1771
|
+
featureId: string;
|
|
1772
|
+
consumptionModel: "credits";
|
|
1773
|
+
creditCost: number;
|
|
1774
|
+
} | {
|
|
1775
|
+
name: string;
|
|
1776
|
+
description?: string;
|
|
1777
|
+
basePrice: number;
|
|
1778
|
+
featureId: string;
|
|
1779
|
+
consumptionModel: "balance";
|
|
1780
|
+
overageRate: number;
|
|
1781
|
+
};
|
|
1116
1782
|
declare class AddonsResource {
|
|
1117
1783
|
private httpClient;
|
|
1118
1784
|
constructor(httpClient: CommetHTTPClient);
|
|
1119
1785
|
/** List all active add-ons for a customer's subscription. */
|
|
1120
|
-
listActive(params: ListActiveAddonsParams, options?: RequestOptions): Promise<
|
|
1121
|
-
|
|
1122
|
-
|
|
1786
|
+
listActive(params: ListActiveAddonsParams, options?: RequestOptions): Promise<{
|
|
1787
|
+
object: "list";
|
|
1788
|
+
data: Array<ActiveAddon>;
|
|
1789
|
+
hasMore: boolean;
|
|
1790
|
+
nextCursor?: string;
|
|
1791
|
+
}>;
|
|
1123
1792
|
/** Retrieve an add-on by its public ID or slug. */
|
|
1124
|
-
get(params: GetAddonParams, options?: RequestOptions): Promise<
|
|
1125
|
-
/** Create a new add-on linked to a feature. Each feature can only be assigned to one add-on. */
|
|
1126
|
-
create(params: CreateAddonParams, options?: RequestOptions): Promise<ApiResponse<Addon>>;
|
|
1793
|
+
get(params: GetAddonParams, options?: RequestOptions): Promise<Addon>;
|
|
1127
1794
|
/** Update an add-on's name, description, or pricing. */
|
|
1128
|
-
update(params: UpdateAddonParams, options?: RequestOptions): Promise<
|
|
1795
|
+
update(params: UpdateAddonParams, options?: RequestOptions): Promise<Addon>;
|
|
1129
1796
|
/** Soft-delete an add-on. Fails if the add-on has active subscriptions. */
|
|
1130
|
-
delete(params: DeleteAddonParams, options?: RequestOptions): Promise<
|
|
1797
|
+
delete(params: DeleteAddonParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
1798
|
+
/** List all add-ons with cursor-based pagination. */
|
|
1799
|
+
list(params?: ListAddonsParams, options?: RequestOptions): Promise<{
|
|
1800
|
+
object: "list";
|
|
1801
|
+
data: Array<Addon>;
|
|
1802
|
+
hasMore: boolean;
|
|
1803
|
+
nextCursor?: string;
|
|
1804
|
+
}>;
|
|
1805
|
+
/** Create a new add-on linked to a feature. Each feature can only be assigned to one add-on. */
|
|
1806
|
+
create(params: CreateAddonParams, options?: RequestOptions): Promise<Addon>;
|
|
1131
1807
|
}
|
|
1132
1808
|
|
|
1809
|
+
interface DeleteApiKeyParams {
|
|
1810
|
+
id: string;
|
|
1811
|
+
}
|
|
1133
1812
|
interface ListApiKeysParams {
|
|
1134
|
-
/** @format date-time */
|
|
1135
1813
|
cursor?: string;
|
|
1136
1814
|
limit?: number;
|
|
1137
1815
|
}
|
|
@@ -1139,27 +1817,22 @@ interface CreateApiKeyParams {
|
|
|
1139
1817
|
name: string;
|
|
1140
1818
|
expiresInDays?: number;
|
|
1141
1819
|
}
|
|
1142
|
-
interface DeleteApiKeyParams {
|
|
1143
|
-
id: string;
|
|
1144
|
-
}
|
|
1145
1820
|
declare class ApiKeysResource {
|
|
1146
1821
|
private httpClient;
|
|
1147
1822
|
constructor(httpClient: CommetHTTPClient);
|
|
1823
|
+
/** Permanently revoke and delete an API key. */
|
|
1824
|
+
delete(params: DeleteApiKeyParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
1148
1825
|
/** List API keys with cursor-based pagination. Keys are returned without the full secret. */
|
|
1149
|
-
list(params?: ListApiKeysParams, options?: RequestOptions): Promise<
|
|
1826
|
+
list(params?: ListApiKeysParams, options?: RequestOptions): Promise<{
|
|
1827
|
+
object: "list";
|
|
1828
|
+
data: Array<ApiKey>;
|
|
1829
|
+
hasMore: boolean;
|
|
1830
|
+
nextCursor?: string;
|
|
1831
|
+
}>;
|
|
1150
1832
|
/** Create a new API key. The full key is only returned once in the response. */
|
|
1151
|
-
create(params: CreateApiKeyParams, options?: RequestOptions): Promise<
|
|
1152
|
-
/** Permanently revoke and delete an API key. */
|
|
1153
|
-
delete(params: DeleteApiKeyParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
|
|
1833
|
+
create(params: CreateApiKeyParams, options?: RequestOptions): Promise<CreatedApiKey>;
|
|
1154
1834
|
}
|
|
1155
1835
|
|
|
1156
|
-
interface CreateCreditPackParams {
|
|
1157
|
-
name: string;
|
|
1158
|
-
description?: string;
|
|
1159
|
-
credits: number;
|
|
1160
|
-
price: number;
|
|
1161
|
-
isActive?: boolean;
|
|
1162
|
-
}
|
|
1163
1836
|
interface UpdateCreditPackParams {
|
|
1164
1837
|
id: string;
|
|
1165
1838
|
name?: string;
|
|
@@ -1171,43 +1844,31 @@ interface UpdateCreditPackParams {
|
|
|
1171
1844
|
interface DeleteCreditPackParams {
|
|
1172
1845
|
id: string;
|
|
1173
1846
|
}
|
|
1847
|
+
interface CreateCreditPackParams {
|
|
1848
|
+
name: string;
|
|
1849
|
+
description?: string;
|
|
1850
|
+
credits: number;
|
|
1851
|
+
price: number;
|
|
1852
|
+
isActive?: boolean;
|
|
1853
|
+
}
|
|
1174
1854
|
declare class CreditPacksResource {
|
|
1175
1855
|
private httpClient;
|
|
1176
1856
|
constructor(httpClient: CommetHTTPClient);
|
|
1177
|
-
/** List all active credit packs. */
|
|
1178
|
-
list(): Promise<ApiResponse<Array<CreditPack>>>;
|
|
1179
|
-
/** Create a new credit pack. */
|
|
1180
|
-
create(params: CreateCreditPackParams, options?: RequestOptions): Promise<ApiResponse<CreditPack>>;
|
|
1181
1857
|
/** Update a credit pack's name, description, credits, price, or active status. */
|
|
1182
|
-
update(params: UpdateCreditPackParams, options?: RequestOptions): Promise<
|
|
1858
|
+
update(params: UpdateCreditPackParams, options?: RequestOptions): Promise<CreditPack>;
|
|
1183
1859
|
/** Soft-delete a credit pack. */
|
|
1184
|
-
delete(params: DeleteCreditPackParams, options?: RequestOptions): Promise<
|
|
1860
|
+
delete(params: DeleteCreditPackParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
1861
|
+
/** List all active credit packs. */
|
|
1862
|
+
list(): Promise<{
|
|
1863
|
+
object: "list";
|
|
1864
|
+
data: Array<CreditPackListItem>;
|
|
1865
|
+
hasMore: boolean;
|
|
1866
|
+
nextCursor?: string;
|
|
1867
|
+
}>;
|
|
1868
|
+
/** Create a new credit pack. */
|
|
1869
|
+
create(params: CreateCreditPackParams, options?: RequestOptions): Promise<CreditPack>;
|
|
1185
1870
|
}
|
|
1186
1871
|
|
|
1187
|
-
interface ListCustomersParams {
|
|
1188
|
-
externalId?: string;
|
|
1189
|
-
limit?: number;
|
|
1190
|
-
cursor?: string;
|
|
1191
|
-
}
|
|
1192
|
-
interface CreateCustomerParams {
|
|
1193
|
-
id?: string;
|
|
1194
|
-
externalId?: string;
|
|
1195
|
-
fullName?: string;
|
|
1196
|
-
taxDocument?: string;
|
|
1197
|
-
address?: {
|
|
1198
|
-
line1: string;
|
|
1199
|
-
line2?: string;
|
|
1200
|
-
city: string;
|
|
1201
|
-
state?: string;
|
|
1202
|
-
postalCode: string;
|
|
1203
|
-
country: string;
|
|
1204
|
-
region?: string;
|
|
1205
|
-
};
|
|
1206
|
-
addressId?: string;
|
|
1207
|
-
email: string;
|
|
1208
|
-
timezone?: Timezone;
|
|
1209
|
-
metadata?: Record<string, unknown>;
|
|
1210
|
-
}
|
|
1211
1872
|
interface GetCustomerParams {
|
|
1212
1873
|
id: string;
|
|
1213
1874
|
}
|
|
@@ -1249,54 +1910,74 @@ interface BatchCreateCustomersParams {
|
|
|
1249
1910
|
};
|
|
1250
1911
|
}>;
|
|
1251
1912
|
}
|
|
1913
|
+
interface ListCustomersParams {
|
|
1914
|
+
cursor?: string;
|
|
1915
|
+
limit?: number;
|
|
1916
|
+
externalId?: string;
|
|
1917
|
+
}
|
|
1918
|
+
interface CreateCustomerParams {
|
|
1919
|
+
id?: string;
|
|
1920
|
+
externalId?: string;
|
|
1921
|
+
fullName?: string;
|
|
1922
|
+
taxDocument?: string;
|
|
1923
|
+
address?: {
|
|
1924
|
+
line1: string;
|
|
1925
|
+
line2?: string;
|
|
1926
|
+
city: string;
|
|
1927
|
+
state?: string;
|
|
1928
|
+
postalCode: string;
|
|
1929
|
+
country: string;
|
|
1930
|
+
region?: string;
|
|
1931
|
+
};
|
|
1932
|
+
addressId?: string;
|
|
1933
|
+
email: string;
|
|
1934
|
+
timezone?: Timezone;
|
|
1935
|
+
metadata?: Record<string, unknown>;
|
|
1936
|
+
}
|
|
1252
1937
|
declare class CustomersResource {
|
|
1253
1938
|
private httpClient;
|
|
1254
1939
|
constructor(httpClient: CommetHTTPClient);
|
|
1255
|
-
/** List customers with cursor-based pagination. */
|
|
1256
|
-
list(params?: ListCustomersParams, options?: RequestOptions): Promise<ApiResponse<Array<Customer>>>;
|
|
1257
|
-
/** Create a new customer. Idempotent when customerId is provided. */
|
|
1258
|
-
create(params: CreateCustomerParams, options?: RequestOptions): Promise<ApiResponse<Customer>>;
|
|
1259
1940
|
/** Retrieve a customer by their public ID, including subscription status and metadata. */
|
|
1260
|
-
get(params: GetCustomerParams, options?: RequestOptions): Promise<
|
|
1941
|
+
get(params: GetCustomerParams, options?: RequestOptions): Promise<Customer>;
|
|
1261
1942
|
/** Update a customer's name, external ID, or metadata. */
|
|
1262
|
-
update(params: UpdateCustomerParams, options?: RequestOptions): Promise<
|
|
1943
|
+
update(params: UpdateCustomerParams, options?: RequestOptions): Promise<Customer>;
|
|
1263
1944
|
/** Create up to 100 customers in a single request. */
|
|
1264
|
-
createBatch(params: BatchCreateCustomersParams, options?: RequestOptions): Promise<
|
|
1945
|
+
createBatch(params: BatchCreateCustomersParams, options?: RequestOptions): Promise<CustomerBatch>;
|
|
1946
|
+
/** List customers with cursor-based pagination. */
|
|
1947
|
+
list(params?: ListCustomersParams, options?: RequestOptions): Promise<{
|
|
1948
|
+
object: "list";
|
|
1949
|
+
data: Array<Customer>;
|
|
1950
|
+
hasMore: boolean;
|
|
1951
|
+
nextCursor?: string;
|
|
1952
|
+
}>;
|
|
1953
|
+
/** Create a new customer. Idempotent when customerId is provided. */
|
|
1954
|
+
create(params: CreateCustomerParams, options?: RequestOptions): Promise<Customer>;
|
|
1265
1955
|
}
|
|
1266
1956
|
|
|
1267
|
-
interface ListFeatureAccessParams {
|
|
1268
|
-
customerId: string;
|
|
1269
|
-
}
|
|
1270
1957
|
interface GetFeatureAccessParams {
|
|
1271
1958
|
code: string;
|
|
1272
1959
|
customerId: string;
|
|
1273
|
-
action?: string;
|
|
1274
1960
|
}
|
|
1275
|
-
interface
|
|
1276
|
-
code: string;
|
|
1961
|
+
interface ListFeatureAccessParams {
|
|
1277
1962
|
customerId: string;
|
|
1278
1963
|
}
|
|
1279
1964
|
declare class FeatureAccessResource {
|
|
1280
1965
|
private httpClient;
|
|
1281
1966
|
constructor(httpClient: CommetHTTPClient);
|
|
1282
|
-
/**
|
|
1283
|
-
|
|
1284
|
-
/**
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1967
|
+
/** Get one feature's access and current usage for a customer. To evaluate a prospective consumption, use POST /usage/check. */
|
|
1968
|
+
get(params: GetFeatureAccessParams, options?: RequestOptions): Promise<FeatureAccess>;
|
|
1969
|
+
/** List a customer's feature access and current usage. */
|
|
1970
|
+
list(params: ListFeatureAccessParams, options?: RequestOptions): Promise<{
|
|
1971
|
+
object: "list";
|
|
1972
|
+
data: Array<FeatureAccess>;
|
|
1973
|
+
hasMore: boolean;
|
|
1974
|
+
nextCursor?: string;
|
|
1975
|
+
}>;
|
|
1288
1976
|
}
|
|
1289
1977
|
|
|
1290
1978
|
interface GetFeatureParams {
|
|
1291
1979
|
code: string;
|
|
1292
1980
|
}
|
|
1293
|
-
interface CreateFeatureParams {
|
|
1294
|
-
name: string;
|
|
1295
|
-
code: string;
|
|
1296
|
-
type: FeatureType;
|
|
1297
|
-
description?: string;
|
|
1298
|
-
unitName?: string;
|
|
1299
|
-
}
|
|
1300
1981
|
interface UpdateFeatureParams {
|
|
1301
1982
|
code: string;
|
|
1302
1983
|
name?: string;
|
|
@@ -1306,39 +1987,37 @@ interface UpdateFeatureParams {
|
|
|
1306
1987
|
interface DeleteFeatureParams {
|
|
1307
1988
|
code: string;
|
|
1308
1989
|
}
|
|
1990
|
+
interface CreateFeatureParams {
|
|
1991
|
+
name: string;
|
|
1992
|
+
code: string;
|
|
1993
|
+
type: "boolean" | "usage" | "seats" | "quota";
|
|
1994
|
+
description?: string;
|
|
1995
|
+
unitName?: string;
|
|
1996
|
+
}
|
|
1309
1997
|
declare class FeaturesResource {
|
|
1310
1998
|
private httpClient;
|
|
1311
1999
|
constructor(httpClient: CommetHTTPClient);
|
|
1312
|
-
/** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
|
|
1313
|
-
list(): Promise<ApiResponse<Array<Feature>>>;
|
|
1314
2000
|
/** Get a single feature definition by code from the organization's feature catalog. */
|
|
1315
|
-
get(params: GetFeatureParams, options?: RequestOptions): Promise<
|
|
1316
|
-
/** Create a new feature. Code must be lowercase alphanumeric with underscores. */
|
|
1317
|
-
create(params: CreateFeatureParams, options?: RequestOptions): Promise<ApiResponse<Feature>>;
|
|
2001
|
+
get(params: GetFeatureParams, options?: RequestOptions): Promise<Feature>;
|
|
1318
2002
|
/** Update a feature's name, description, or unit name. At least one field must be provided. */
|
|
1319
|
-
update(params: UpdateFeatureParams, options?: RequestOptions): Promise<
|
|
2003
|
+
update(params: UpdateFeatureParams, options?: RequestOptions): Promise<Feature>;
|
|
1320
2004
|
/** Delete a feature. Fails if the feature is attached to active plans or has an active add-on. */
|
|
1321
|
-
delete(params: DeleteFeatureParams, options?: RequestOptions): Promise<
|
|
2005
|
+
delete(params: DeleteFeatureParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
2006
|
+
/** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
|
|
2007
|
+
list(): Promise<{
|
|
2008
|
+
object: "list";
|
|
2009
|
+
data: Array<Feature>;
|
|
2010
|
+
hasMore: boolean;
|
|
2011
|
+
nextCursor?: string;
|
|
2012
|
+
}>;
|
|
2013
|
+
/** Create a new feature. Code must be lowercase alphanumeric with underscores. */
|
|
2014
|
+
create(params: CreateFeatureParams, options?: RequestOptions): Promise<Feature>;
|
|
1322
2015
|
}
|
|
1323
2016
|
|
|
1324
|
-
interface
|
|
1325
|
-
customerId?: string;
|
|
1326
|
-
status?: "draft" | "outstanding" | "paid" | "void" | "uncollectible";
|
|
1327
|
-
subscriptionId?: string;
|
|
1328
|
-
/** @format date-time */
|
|
1329
|
-
cursor?: string;
|
|
1330
|
-
limit?: number;
|
|
1331
|
-
}
|
|
1332
|
-
interface GetInvoiceParams {
|
|
2017
|
+
interface DownloadInvoiceParams {
|
|
1333
2018
|
id: string;
|
|
1334
2019
|
}
|
|
1335
|
-
interface
|
|
1336
|
-
customerId: string;
|
|
1337
|
-
amount: number;
|
|
1338
|
-
description: string;
|
|
1339
|
-
metadata?: Record<string, unknown>;
|
|
1340
|
-
}
|
|
1341
|
-
interface DownloadInvoiceParams {
|
|
2020
|
+
interface GetInvoiceParams {
|
|
1342
2021
|
id: string;
|
|
1343
2022
|
}
|
|
1344
2023
|
interface SendInvoiceParams {
|
|
@@ -1348,36 +2027,148 @@ interface UpdateInvoiceStatusParams {
|
|
|
1348
2027
|
id: string;
|
|
1349
2028
|
status: "paid" | "void";
|
|
1350
2029
|
}
|
|
2030
|
+
interface ListInvoicesParams {
|
|
2031
|
+
cursor?: string;
|
|
2032
|
+
limit?: number;
|
|
2033
|
+
customerId?: string;
|
|
2034
|
+
status?: "draft" | "outstanding" | "paid" | "void" | "uncollectible";
|
|
2035
|
+
subscriptionId?: string;
|
|
2036
|
+
}
|
|
2037
|
+
interface CreateAdjustmentInvoiceParams {
|
|
2038
|
+
customerId: string;
|
|
2039
|
+
amount: number;
|
|
2040
|
+
description: string;
|
|
2041
|
+
metadata?: Record<string, unknown>;
|
|
2042
|
+
}
|
|
1351
2043
|
declare class InvoicesResource {
|
|
1352
2044
|
private httpClient;
|
|
1353
2045
|
constructor(httpClient: CommetHTTPClient);
|
|
1354
|
-
/** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
|
|
1355
|
-
list(params?: ListInvoicesParams, options?: RequestOptions): Promise<ApiResponse<Array<Invoice>>>;
|
|
1356
|
-
/** Retrieve a single invoice by its public ID, including line items. */
|
|
1357
|
-
get(params: GetInvoiceParams, options?: RequestOptions): Promise<ApiResponse<Invoice>>;
|
|
1358
|
-
/** Create a one-off adjustment invoice. Use a negative amount for a credit. */
|
|
1359
|
-
createAdjustment(params: CreateAdjustmentInvoiceParams, options?: RequestOptions): Promise<ApiResponse<CreatedInvoice>>;
|
|
1360
2046
|
/** Generate a signed URL to download the invoice as a PDF. The URL expires after 7 days. */
|
|
1361
|
-
getDownloadUrl(params: DownloadInvoiceParams, options?: RequestOptions): Promise<
|
|
2047
|
+
getDownloadUrl(params: DownloadInvoiceParams, options?: RequestOptions): Promise<InvoiceDownload>;
|
|
2048
|
+
/** Retrieve a single invoice by its public ID, including line items. */
|
|
2049
|
+
get(params: GetInvoiceParams, options?: RequestOptions): Promise<Invoice>;
|
|
1362
2050
|
/** Send the invoice to the customer via email. */
|
|
1363
|
-
send(params: SendInvoiceParams, options?: RequestOptions): Promise<
|
|
1364
|
-
/** Mark an outstanding invoice as "paid" or "void". Cannot change the status of already paid or voided invoices. */
|
|
1365
|
-
updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<
|
|
2051
|
+
send(params: SendInvoiceParams, options?: RequestOptions): Promise<SentInvoice>;
|
|
2052
|
+
/** Mark an outstanding invoice as "paid" or "void" and return the updated invoice. Cannot change the status of already paid or voided invoices. */
|
|
2053
|
+
updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<Invoice>;
|
|
2054
|
+
/** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
|
|
2055
|
+
list(params?: ListInvoicesParams, options?: RequestOptions): Promise<{
|
|
2056
|
+
object: "list";
|
|
2057
|
+
data: Array<InvoiceListItem>;
|
|
2058
|
+
hasMore: boolean;
|
|
2059
|
+
nextCursor?: string;
|
|
2060
|
+
}>;
|
|
2061
|
+
/** Create a one-off adjustment invoice and return the created invoice. Use a negative amount for a credit. */
|
|
2062
|
+
createAdjustment(params: CreateAdjustmentInvoiceParams, options?: RequestOptions): Promise<Invoice>;
|
|
1366
2063
|
}
|
|
1367
2064
|
|
|
1368
|
-
interface
|
|
1369
|
-
|
|
1370
|
-
|
|
2065
|
+
interface GetOfferParams {
|
|
2066
|
+
id: string;
|
|
2067
|
+
}
|
|
2068
|
+
interface UpdateOfferParams {
|
|
2069
|
+
id: string;
|
|
2070
|
+
name: string;
|
|
2071
|
+
purpose: "introductory" | "promotional";
|
|
2072
|
+
planPriceIds: Array<string>;
|
|
2073
|
+
phases: Array<{
|
|
2074
|
+
type: "free_trial";
|
|
2075
|
+
durationDays: number;
|
|
2076
|
+
} | {
|
|
2077
|
+
type: "percentage";
|
|
2078
|
+
durationCycles: number;
|
|
2079
|
+
/** Discount in basis points. 5000 means 50%. */
|
|
2080
|
+
percentage: number;
|
|
2081
|
+
} | {
|
|
2082
|
+
type: "amount_off";
|
|
2083
|
+
durationCycles: number;
|
|
2084
|
+
amounts: Array<{
|
|
2085
|
+
currency: string;
|
|
2086
|
+
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
2087
|
+
amount: number;
|
|
2088
|
+
}>;
|
|
2089
|
+
} | {
|
|
2090
|
+
type: "fixed_price";
|
|
2091
|
+
durationCycles: number;
|
|
2092
|
+
prices: Array<{
|
|
2093
|
+
currency: string;
|
|
2094
|
+
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
2095
|
+
amount: number;
|
|
2096
|
+
}>;
|
|
2097
|
+
}>;
|
|
2098
|
+
metadata?: Record<string, unknown>;
|
|
2099
|
+
startsAt?: string | null;
|
|
2100
|
+
endsAt?: string | null;
|
|
2101
|
+
active?: boolean;
|
|
2102
|
+
}
|
|
2103
|
+
interface DeleteOfferParams {
|
|
2104
|
+
id: string;
|
|
2105
|
+
}
|
|
2106
|
+
interface ListOffersParams {
|
|
1371
2107
|
cursor?: string;
|
|
1372
2108
|
limit?: number;
|
|
2109
|
+
planPriceId?: string;
|
|
2110
|
+
purpose?: "introductory" | "promotional";
|
|
2111
|
+
active?: boolean;
|
|
1373
2112
|
}
|
|
1374
|
-
interface
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
2113
|
+
interface CreateOfferParams {
|
|
2114
|
+
name: string;
|
|
2115
|
+
purpose: "introductory" | "promotional";
|
|
2116
|
+
planPriceIds: Array<string>;
|
|
2117
|
+
phases: Array<{
|
|
2118
|
+
type: "free_trial";
|
|
2119
|
+
durationDays: number;
|
|
2120
|
+
} | {
|
|
2121
|
+
type: "percentage";
|
|
2122
|
+
durationCycles: number;
|
|
2123
|
+
/** Discount in basis points. 5000 means 50%. */
|
|
2124
|
+
percentage: number;
|
|
2125
|
+
} | {
|
|
2126
|
+
type: "amount_off";
|
|
2127
|
+
durationCycles: number;
|
|
2128
|
+
amounts: Array<{
|
|
2129
|
+
currency: string;
|
|
2130
|
+
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
2131
|
+
amount: number;
|
|
2132
|
+
}>;
|
|
2133
|
+
} | {
|
|
2134
|
+
type: "fixed_price";
|
|
2135
|
+
durationCycles: number;
|
|
2136
|
+
prices: Array<{
|
|
2137
|
+
currency: string;
|
|
2138
|
+
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
2139
|
+
amount: number;
|
|
2140
|
+
}>;
|
|
2141
|
+
}>;
|
|
2142
|
+
metadata?: Record<string, unknown>;
|
|
2143
|
+
startsAt?: string | null;
|
|
2144
|
+
endsAt?: string | null;
|
|
2145
|
+
active?: boolean;
|
|
2146
|
+
}
|
|
2147
|
+
declare class OffersResource {
|
|
2148
|
+
private httpClient;
|
|
2149
|
+
constructor(httpClient: CommetHTTPClient);
|
|
2150
|
+
/** Retrieve a canonical offer by its public ID. */
|
|
2151
|
+
get(params: GetOfferParams, options?: RequestOptions): Promise<Offer>;
|
|
2152
|
+
/** Replace an offer's catalog definition. Existing offer applications keep their immutable accepted terms. */
|
|
2153
|
+
update(params: UpdateOfferParams, options?: RequestOptions): Promise<Offer>;
|
|
2154
|
+
/** Soft-delete an offer. Existing applications and their accepted terms remain available for billing and audit. */
|
|
2155
|
+
delete(params: DeleteOfferParams, options?: RequestOptions): Promise<DeletedOffer>;
|
|
2156
|
+
/** List the organization's canonical introductory and promotional offers. */
|
|
2157
|
+
list(params?: ListOffersParams, options?: RequestOptions): Promise<{
|
|
2158
|
+
object: "list";
|
|
2159
|
+
data: Array<Offer>;
|
|
2160
|
+
hasMore: boolean;
|
|
2161
|
+
nextCursor?: string;
|
|
2162
|
+
}>;
|
|
2163
|
+
/** Create a canonical offer scoped to one or more plan prices. Currency-specific phases require an explicit USD value and never fall back across currencies. */
|
|
2164
|
+
create(params: CreateOfferParams, options?: RequestOptions): Promise<Offer>;
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
interface CancelPaymentParams {
|
|
2168
|
+
id: string;
|
|
2169
|
+
}
|
|
2170
|
+
interface GetPaymentParams {
|
|
2171
|
+
id: string;
|
|
1381
2172
|
}
|
|
1382
2173
|
interface ChargePaymentParams {
|
|
1383
2174
|
customerId: string;
|
|
@@ -1386,25 +2177,37 @@ interface ChargePaymentParams {
|
|
|
1386
2177
|
description: string;
|
|
1387
2178
|
metadata?: Record<string, string>;
|
|
1388
2179
|
}
|
|
1389
|
-
interface
|
|
1390
|
-
|
|
2180
|
+
interface ListPaymentsParams {
|
|
2181
|
+
cursor?: string;
|
|
2182
|
+
limit?: number;
|
|
2183
|
+
customerId?: string;
|
|
1391
2184
|
}
|
|
1392
|
-
interface
|
|
1393
|
-
|
|
2185
|
+
interface CreatePaymentParams {
|
|
2186
|
+
amount: number;
|
|
2187
|
+
currency: string;
|
|
2188
|
+
customerId?: string;
|
|
2189
|
+
description: string;
|
|
2190
|
+
successUrl?: string;
|
|
2191
|
+
metadata?: Record<string, string>;
|
|
1394
2192
|
}
|
|
1395
2193
|
declare class PaymentsResource {
|
|
1396
2194
|
private httpClient;
|
|
1397
2195
|
constructor(httpClient: CommetHTTPClient);
|
|
2196
|
+
/** Cancel a pending payment link so it can no longer be paid. Only a link that has not been paid or started processing can be canceled; canceling an already canceled link is a no-op. Charges cannot be canceled. */
|
|
2197
|
+
cancel(params: CancelPaymentParams, options?: RequestOptions): Promise<Payment>;
|
|
2198
|
+
/** Retrieve a payment by its public ID. */
|
|
2199
|
+
get(params: GetPaymentParams, options?: RequestOptions): Promise<Payment>;
|
|
2200
|
+
/** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. Requires the customer to have a subscription in active, trialing, or past_due state. */
|
|
2201
|
+
charge(params: ChargePaymentParams, options?: RequestOptions): Promise<Payment>;
|
|
1398
2202
|
/** List payments with cursor-based pagination. Filter by customer. */
|
|
1399
|
-
list(params?: ListPaymentsParams, options?: RequestOptions): Promise<
|
|
2203
|
+
list(params?: ListPaymentsParams, options?: RequestOptions): Promise<{
|
|
2204
|
+
object: "list";
|
|
2205
|
+
data: Array<Payment>;
|
|
2206
|
+
hasMore: boolean;
|
|
2207
|
+
nextCursor?: string;
|
|
2208
|
+
}>;
|
|
1400
2209
|
/** Create a hosted payment link. Returns a url the customer opens to pay with any card. Calculates tax, generates an invoice, and vaults the payment method on confirmation. No subscription or plan required. */
|
|
1401
|
-
create(params: CreatePaymentParams, options?: RequestOptions): Promise<
|
|
1402
|
-
/** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. Requires the customer to have a subscription in active, trialing, or past_due state. */
|
|
1403
|
-
charge(params: ChargePaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
|
|
1404
|
-
/** Retrieve a payment by its public ID. */
|
|
1405
|
-
get(params: GetPaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
|
|
1406
|
-
/** Cancel a pending payment link so it can no longer be paid. Only a link that has not been paid or started processing can be canceled; canceling an already canceled link is a no-op. Charges cannot be canceled. */
|
|
1407
|
-
cancel(params: CancelPaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
|
|
2210
|
+
create(params: CreatePaymentParams, options?: RequestOptions): Promise<Payment>;
|
|
1408
2211
|
}
|
|
1409
2212
|
|
|
1410
2213
|
interface AddPayoutBankAccountParams {
|
|
@@ -1418,9 +2221,8 @@ interface RequestPayoutParams {
|
|
|
1418
2221
|
amount: number;
|
|
1419
2222
|
description?: string;
|
|
1420
2223
|
}
|
|
1421
|
-
|
|
2224
|
+
type CompletePayoutVerificationParams = {
|
|
1422
2225
|
email: string;
|
|
1423
|
-
businessType: "individual" | "company";
|
|
1424
2226
|
businessUrl: string;
|
|
1425
2227
|
documentUrl: string;
|
|
1426
2228
|
bank: {
|
|
@@ -1429,7 +2231,8 @@ interface CompletePayoutVerificationParams {
|
|
|
1429
2231
|
routingNumber?: string;
|
|
1430
2232
|
accountType?: "checking" | "savings";
|
|
1431
2233
|
};
|
|
1432
|
-
individual
|
|
2234
|
+
businessType: "individual";
|
|
2235
|
+
individual: {
|
|
1433
2236
|
firstName: string;
|
|
1434
2237
|
lastName: string;
|
|
1435
2238
|
phone: string;
|
|
@@ -1445,7 +2248,18 @@ interface CompletePayoutVerificationParams {
|
|
|
1445
2248
|
country: string;
|
|
1446
2249
|
};
|
|
1447
2250
|
};
|
|
1448
|
-
|
|
2251
|
+
} | {
|
|
2252
|
+
email: string;
|
|
2253
|
+
businessUrl: string;
|
|
2254
|
+
documentUrl: string;
|
|
2255
|
+
bank: {
|
|
2256
|
+
accountNumber: string;
|
|
2257
|
+
accountHolderName: string;
|
|
2258
|
+
routingNumber?: string;
|
|
2259
|
+
accountType?: "checking" | "savings";
|
|
2260
|
+
};
|
|
2261
|
+
businessType: "company";
|
|
2262
|
+
company: {
|
|
1449
2263
|
name: string;
|
|
1450
2264
|
taxId: string;
|
|
1451
2265
|
address: {
|
|
@@ -1463,29 +2277,33 @@ interface CompletePayoutVerificationParams {
|
|
|
1463
2277
|
email?: string;
|
|
1464
2278
|
};
|
|
1465
2279
|
};
|
|
1466
|
-
}
|
|
2280
|
+
};
|
|
1467
2281
|
declare class PayoutsResource {
|
|
1468
2282
|
private httpClient;
|
|
1469
2283
|
constructor(httpClient: CommetHTTPClient);
|
|
1470
2284
|
/** Add an additional destination bank account to the organization's existing payout account. Country and currency are resolved from the organization. The full account number is never returned — only `last4`. */
|
|
1471
|
-
addBankAccount(params: AddPayoutBankAccountParams, options?: RequestOptions): Promise<
|
|
2285
|
+
addBankAccount(params: AddPayoutBankAccountParams, options?: RequestOptions): Promise<PayoutBankAccount>;
|
|
1472
2286
|
/** Withdraw available balance to the organization's verified payout account. `amount` is in cents (USD, minimum 1000 = $10). The payout is created in `pending` and settles to `paid` asynchronously as provider webhooks arrive. */
|
|
1473
|
-
request(params: RequestPayoutParams, options?: RequestOptions): Promise<
|
|
2287
|
+
request(params: RequestPayoutParams, options?: RequestOptions): Promise<Payout>;
|
|
1474
2288
|
/** Provision the organization's payout account in a single call with the full KYC + bank payload. Uploads the identity document, persists the destination bank, and creates the connected account through the org's payout provider. The account starts `pending_verification` and flips to `verified` via the provider's webhook. Idempotent: returns the existing account if the org already has one. */
|
|
1475
|
-
completeVerification(params: CompletePayoutVerificationParams, options?: RequestOptions): Promise<
|
|
2289
|
+
completeVerification(params: CompletePayoutVerificationParams, options?: RequestOptions): Promise<PayoutVerification>;
|
|
1476
2290
|
}
|
|
1477
2291
|
|
|
1478
|
-
interface
|
|
1479
|
-
|
|
1480
|
-
|
|
2292
|
+
interface RemovePlanFromGroupParams {
|
|
2293
|
+
id: string;
|
|
2294
|
+
planId: string;
|
|
1481
2295
|
}
|
|
1482
|
-
interface
|
|
2296
|
+
interface ReorderPlansInGroupParams {
|
|
1483
2297
|
id: string;
|
|
2298
|
+
planIds: Array<string>;
|
|
1484
2299
|
}
|
|
1485
|
-
interface
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
2300
|
+
interface AddPlanToGroupParams {
|
|
2301
|
+
id: string;
|
|
2302
|
+
planId: string;
|
|
2303
|
+
sortOrder?: number;
|
|
2304
|
+
}
|
|
2305
|
+
interface GetPlanGroupParams {
|
|
2306
|
+
id: string;
|
|
1489
2307
|
}
|
|
1490
2308
|
interface UpdatePlanGroupParams {
|
|
1491
2309
|
id: string;
|
|
@@ -1496,86 +2314,58 @@ interface UpdatePlanGroupParams {
|
|
|
1496
2314
|
interface DeletePlanGroupParams {
|
|
1497
2315
|
id: string;
|
|
1498
2316
|
}
|
|
1499
|
-
interface
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
sortOrder?: number;
|
|
1503
|
-
}
|
|
1504
|
-
interface RemovePlanFromGroupParams {
|
|
1505
|
-
id: string;
|
|
1506
|
-
planId: string;
|
|
2317
|
+
interface ListPlanGroupsParams {
|
|
2318
|
+
cursor?: string;
|
|
2319
|
+
limit?: number;
|
|
1507
2320
|
}
|
|
1508
|
-
interface
|
|
1509
|
-
|
|
1510
|
-
|
|
2321
|
+
interface CreatePlanGroupParams {
|
|
2322
|
+
name: string;
|
|
2323
|
+
description?: string;
|
|
2324
|
+
isPublic?: boolean;
|
|
1511
2325
|
}
|
|
1512
2326
|
declare class PlanGroupsResource {
|
|
1513
2327
|
private httpClient;
|
|
1514
2328
|
constructor(httpClient: CommetHTTPClient);
|
|
1515
|
-
/**
|
|
1516
|
-
|
|
2329
|
+
/** Remove a plan from a plan group. */
|
|
2330
|
+
removePlan(params: RemovePlanFromGroupParams, options?: RequestOptions): Promise<RemovedPlanFromGroup>;
|
|
2331
|
+
/** Set the display order of plans within a group. All plan IDs in the group must be provided. */
|
|
2332
|
+
reorderPlans(params: ReorderPlansInGroupParams, options?: RequestOptions): Promise<ReorderedPlans>;
|
|
2333
|
+
/** Add an existing plan to a plan group with optional sort order. */
|
|
2334
|
+
addPlan(params: AddPlanToGroupParams, options?: RequestOptions): Promise<AddedPlanToGroup>;
|
|
1517
2335
|
/** Retrieve a plan group by ID, including its plans ordered by sortOrder. */
|
|
1518
|
-
get(params: GetPlanGroupParams, options?: RequestOptions): Promise<
|
|
1519
|
-
/** Create a new plan group for organizing plans. */
|
|
1520
|
-
create(params: CreatePlanGroupParams, options?: RequestOptions): Promise<ApiResponse<PlanGroup>>;
|
|
2336
|
+
get(params: GetPlanGroupParams, options?: RequestOptions): Promise<PlanGroupDetail>;
|
|
1521
2337
|
/** Update a plan group's name, description, or visibility. */
|
|
1522
|
-
update(params: UpdatePlanGroupParams, options?: RequestOptions): Promise<
|
|
2338
|
+
update(params: UpdatePlanGroupParams, options?: RequestOptions): Promise<PlanGroup>;
|
|
1523
2339
|
/** Delete a plan group. Plans in the group are unlinked, not deleted. */
|
|
1524
|
-
delete(params: DeletePlanGroupParams, options?: RequestOptions): Promise<
|
|
1525
|
-
/**
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
2340
|
+
delete(params: DeletePlanGroupParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
2341
|
+
/** List plan groups with cursor-based pagination. */
|
|
2342
|
+
list(params?: ListPlanGroupsParams, options?: RequestOptions): Promise<{
|
|
2343
|
+
object: "list";
|
|
2344
|
+
data: Array<PlanGroup>;
|
|
2345
|
+
hasMore: boolean;
|
|
2346
|
+
nextCursor?: string;
|
|
2347
|
+
}>;
|
|
2348
|
+
/** Create a new plan group for organizing plans. */
|
|
2349
|
+
create(params: CreatePlanGroupParams, options?: RequestOptions): Promise<PlanGroup>;
|
|
1531
2350
|
}
|
|
1532
2351
|
|
|
1533
|
-
interface
|
|
1534
|
-
includePrivate?: "true" | "false";
|
|
1535
|
-
}
|
|
1536
|
-
interface GetPlanParams {
|
|
1537
|
-
id: string;
|
|
1538
|
-
}
|
|
1539
|
-
interface CreatePlanParams {
|
|
1540
|
-
name: string;
|
|
1541
|
-
code: string;
|
|
1542
|
-
description?: string;
|
|
1543
|
-
consumptionModel?: ConsumptionModel;
|
|
1544
|
-
isPublic?: boolean;
|
|
1545
|
-
isFree?: boolean;
|
|
1546
|
-
blockOnExhaustion?: boolean;
|
|
1547
|
-
planGroupId?: string;
|
|
1548
|
-
metadata?: Record<string, unknown>;
|
|
1549
|
-
}
|
|
1550
|
-
interface UpdatePlanParams {
|
|
1551
|
-
id: string;
|
|
1552
|
-
name?: string;
|
|
1553
|
-
description?: string | null;
|
|
1554
|
-
metadata?: Record<string, unknown>;
|
|
1555
|
-
isPublic?: boolean;
|
|
1556
|
-
}
|
|
1557
|
-
interface DeletePlanParams {
|
|
1558
|
-
id: string;
|
|
1559
|
-
}
|
|
1560
|
-
interface SetPlanVisibilityParams {
|
|
1561
|
-
id: string;
|
|
1562
|
-
isPublic: boolean;
|
|
1563
|
-
}
|
|
1564
|
-
interface AddPlanFeatureParams {
|
|
2352
|
+
interface UpdatePlanFeatureParams {
|
|
1565
2353
|
id: string;
|
|
1566
2354
|
featureId: string;
|
|
1567
2355
|
enabled?: boolean;
|
|
1568
2356
|
includedAmount?: number;
|
|
1569
2357
|
unlimited?: boolean;
|
|
1570
2358
|
overage?: {
|
|
1571
|
-
enabled
|
|
1572
|
-
unitPrice
|
|
2359
|
+
enabled?: boolean;
|
|
2360
|
+
unitPrice?: number;
|
|
1573
2361
|
};
|
|
1574
2362
|
creditsPerUnit?: number | null;
|
|
1575
|
-
pricingMode?: "fixed" | "ai_model";
|
|
1576
|
-
margin?: number | null;
|
|
1577
2363
|
}
|
|
1578
|
-
interface
|
|
2364
|
+
interface RemovePlanFeatureParams {
|
|
2365
|
+
id: string;
|
|
2366
|
+
featureId: string;
|
|
2367
|
+
}
|
|
2368
|
+
interface AddPlanFeatureParams {
|
|
1579
2369
|
id: string;
|
|
1580
2370
|
featureId: string;
|
|
1581
2371
|
enabled?: boolean;
|
|
@@ -1586,25 +2376,25 @@ interface UpdatePlanFeatureParams {
|
|
|
1586
2376
|
unitPrice?: number;
|
|
1587
2377
|
};
|
|
1588
2378
|
creditsPerUnit?: number | null;
|
|
2379
|
+
pricingMode?: "fixed" | "ai_model";
|
|
2380
|
+
margin?: number | null;
|
|
1589
2381
|
}
|
|
1590
|
-
interface
|
|
2382
|
+
interface SetDefaultPlanPriceParams {
|
|
1591
2383
|
id: string;
|
|
1592
|
-
|
|
2384
|
+
priceId: string;
|
|
1593
2385
|
}
|
|
1594
|
-
interface
|
|
2386
|
+
interface UpsertRegionalPricesParams {
|
|
1595
2387
|
id: string;
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
durationCycles?: number | null;
|
|
1607
|
-
};
|
|
2388
|
+
priceId: string;
|
|
2389
|
+
overrides: Array<{
|
|
2390
|
+
currency: string;
|
|
2391
|
+
price: number;
|
|
2392
|
+
includedBalance?: number;
|
|
2393
|
+
}>;
|
|
2394
|
+
}
|
|
2395
|
+
interface DeleteRegionalPricesParams {
|
|
2396
|
+
id: string;
|
|
2397
|
+
priceId: string;
|
|
1608
2398
|
}
|
|
1609
2399
|
interface UpdatePlanPriceParams {
|
|
1610
2400
|
id: string;
|
|
@@ -1614,30 +2404,49 @@ interface UpdatePlanPriceParams {
|
|
|
1614
2404
|
trialDays?: number;
|
|
1615
2405
|
includedBalance?: number | null;
|
|
1616
2406
|
includedCredits?: number | null;
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
2407
|
+
/** Metadata keys to merge into the existing price metadata. */
|
|
2408
|
+
metadata?: Record<string, unknown>;
|
|
2409
|
+
marketPrices?: Array<{
|
|
2410
|
+
marketGroupId: string;
|
|
2411
|
+
currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb";
|
|
2412
|
+
price: number;
|
|
2413
|
+
}>;
|
|
1623
2414
|
}
|
|
1624
2415
|
interface DeletePlanPriceParams {
|
|
1625
2416
|
id: string;
|
|
1626
2417
|
priceId: string;
|
|
1627
2418
|
}
|
|
1628
|
-
|
|
2419
|
+
type AddPlanPriceParams = {
|
|
1629
2420
|
id: string;
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
2421
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
|
|
2422
|
+
metadata?: Record<string, unknown>;
|
|
2423
|
+
price: number;
|
|
2424
|
+
trialDays?: number;
|
|
2425
|
+
isDefault?: boolean;
|
|
2426
|
+
includedBalance?: number | null;
|
|
2427
|
+
includedCredits?: number | null;
|
|
2428
|
+
marketPrices?: Array<{
|
|
2429
|
+
/** Public ID of a reusable pricing market group. */
|
|
2430
|
+
marketGroupId: string;
|
|
2431
|
+
/** Presentment currency configured for this plan and market. */
|
|
2432
|
+
currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb";
|
|
2433
|
+
/** Market price in the currency's minor unit. */
|
|
2434
|
+
price: number;
|
|
2435
|
+
}>;
|
|
2436
|
+
} | {
|
|
1633
2437
|
id: string;
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
2438
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
|
|
2439
|
+
metadata?: Record<string, unknown>;
|
|
2440
|
+
inheritsFromPriceId: string;
|
|
2441
|
+
marketPrices: Array<{
|
|
2442
|
+
/** Public ID of a reusable pricing market group. */
|
|
2443
|
+
marketGroupId: string;
|
|
2444
|
+
/** Presentment currency configured for this plan and market. */
|
|
2445
|
+
currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb";
|
|
2446
|
+
/** Market price in the currency's minor unit. */
|
|
1637
2447
|
price: number;
|
|
1638
|
-
includedBalance?: number;
|
|
1639
2448
|
}>;
|
|
1640
|
-
}
|
|
2449
|
+
};
|
|
1641
2450
|
interface SetPlanRegionalPricingParams {
|
|
1642
2451
|
id: string;
|
|
1643
2452
|
currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb";
|
|
@@ -1651,363 +2460,560 @@ interface SetPlanRegionalPricingParams {
|
|
|
1651
2460
|
featureId: string;
|
|
1652
2461
|
overageUnitPrice: number;
|
|
1653
2462
|
}>;
|
|
1654
|
-
introOffers?: Array<{
|
|
1655
|
-
priceId: string;
|
|
1656
|
-
discountType: DiscountType;
|
|
1657
|
-
discountValue: number;
|
|
1658
|
-
durationCycles: number;
|
|
1659
|
-
}>;
|
|
1660
2463
|
}
|
|
1661
|
-
interface
|
|
2464
|
+
interface GetPlanParams {
|
|
1662
2465
|
id: string;
|
|
1663
|
-
|
|
2466
|
+
}
|
|
2467
|
+
interface UpdatePlanParams {
|
|
2468
|
+
id: string;
|
|
2469
|
+
name?: string;
|
|
2470
|
+
description?: string | null;
|
|
2471
|
+
metadata?: Record<string, unknown>;
|
|
2472
|
+
isPublic?: boolean;
|
|
2473
|
+
}
|
|
2474
|
+
interface DeletePlanParams {
|
|
2475
|
+
id: string;
|
|
2476
|
+
}
|
|
2477
|
+
interface SetPlanVisibilityParams {
|
|
2478
|
+
id: string;
|
|
2479
|
+
isPublic: boolean;
|
|
2480
|
+
}
|
|
2481
|
+
interface ListPlansParams {
|
|
2482
|
+
includePrivate?: boolean;
|
|
2483
|
+
}
|
|
2484
|
+
interface CreatePlanParams {
|
|
2485
|
+
name: string;
|
|
2486
|
+
code: string;
|
|
2487
|
+
description?: string;
|
|
2488
|
+
consumptionModel?: "metered" | "credits" | "balance";
|
|
2489
|
+
isPublic?: boolean;
|
|
2490
|
+
isFree?: boolean;
|
|
2491
|
+
blockOnExhaustion?: boolean;
|
|
2492
|
+
planGroupId?: string;
|
|
2493
|
+
metadata?: Record<string, unknown>;
|
|
1664
2494
|
}
|
|
1665
2495
|
declare class PlansResource {
|
|
1666
2496
|
private httpClient;
|
|
1667
2497
|
constructor(httpClient: CommetHTTPClient);
|
|
1668
|
-
/** List all plans with their prices and features. Optionally include private plans. */
|
|
1669
|
-
list(params?: ListPlansParams, options?: RequestOptions): Promise<ApiResponse<Array<Plan>>>;
|
|
1670
|
-
/** Get detailed plan information by code or ID. */
|
|
1671
|
-
get(params: GetPlanParams, options?: RequestOptions): Promise<ApiResponse<Plan>>;
|
|
1672
|
-
/** Create a new plan with optional consumption model, visibility, and plan group assignment. */
|
|
1673
|
-
create(params: CreatePlanParams, options?: RequestOptions): Promise<ApiResponse<Plan>>;
|
|
1674
|
-
/** Update a plan's name, description, visibility, or metadata. */
|
|
1675
|
-
update(params: UpdatePlanParams, options?: RequestOptions): Promise<ApiResponse<Plan>>;
|
|
1676
|
-
/** Soft-delete a plan. */
|
|
1677
|
-
delete(params: DeletePlanParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
|
|
1678
|
-
/** Toggle a plan between public and private. */
|
|
1679
|
-
setVisibility(params: SetPlanVisibilityParams, options?: RequestOptions): Promise<ApiResponse<PlanVisibility>>;
|
|
1680
|
-
/** Attach a feature to a plan with limits, overage, and credits configuration. */
|
|
1681
|
-
addFeature(params: AddPlanFeatureParams, options?: RequestOptions): Promise<ApiResponse<PlanFeature>>;
|
|
1682
2498
|
/** Update limits, overage, or enabled status of a feature on a plan. */
|
|
1683
|
-
updateFeature(params: UpdatePlanFeatureParams, options?: RequestOptions): Promise<
|
|
2499
|
+
updateFeature(params: UpdatePlanFeatureParams, options?: RequestOptions): Promise<PlanFeature>;
|
|
1684
2500
|
/** Detach a feature from a plan. */
|
|
1685
|
-
removeFeature(params: RemovePlanFeatureParams, options?: RequestOptions): Promise<
|
|
1686
|
-
/**
|
|
1687
|
-
|
|
1688
|
-
/**
|
|
1689
|
-
|
|
1690
|
-
/** Remove a price from a plan. */
|
|
1691
|
-
deletePrice(params: DeletePlanPriceParams, options?: RequestOptions): Promise<ApiResponse<DeletedObject>>;
|
|
1692
|
-
/** Set a specific price as the default for its plan. Unsets previous default. */
|
|
1693
|
-
setDefaultPrice(params: SetDefaultPlanPriceParams, options?: RequestOptions): Promise<ApiResponse<DefaultPlanPrice>>;
|
|
2501
|
+
removeFeature(params: RemovePlanFeatureParams, options?: RequestOptions): Promise<RemovedPlanFeature>;
|
|
2502
|
+
/** Attach a feature to a plan with limits, overage, and credits configuration. */
|
|
2503
|
+
addFeature(params: AddPlanFeatureParams, options?: RequestOptions): Promise<PlanFeature>;
|
|
2504
|
+
/** Set a specific price as the default and return the updated plan price. */
|
|
2505
|
+
setDefaultPrice(params: SetDefaultPlanPriceParams, options?: RequestOptions): Promise<PlanPrice>;
|
|
1694
2506
|
/** Create or update regional currency price overrides for a plan price. */
|
|
1695
|
-
setRegionalPrices(params: UpsertRegionalPricesParams, options?: RequestOptions): Promise<
|
|
1696
|
-
/**
|
|
1697
|
-
|
|
1698
|
-
/**
|
|
1699
|
-
|
|
2507
|
+
setRegionalPrices(params: UpsertRegionalPricesParams, options?: RequestOptions): Promise<PlanRegionalPricing>;
|
|
2508
|
+
/** Remove all regional currency overrides for a plan price. The request is rejected while billable subscriptions depend on an override. */
|
|
2509
|
+
deleteRegionalPrices(params: DeleteRegionalPricesParams, options?: RequestOptions): Promise<DeletedPlanRegionalPricing>;
|
|
2510
|
+
/** Update a base price or market price variant. Removing a base market override is rejected while a variant depends on it. Offer terms are managed through Offers. */
|
|
2511
|
+
updatePrice(params: UpdatePlanPriceParams, options?: RequestOptions): Promise<PlanPrice>;
|
|
2512
|
+
/** Archive a price for new subscriptions. Existing subscriptions that selected it continue using its current catalog value. */
|
|
2513
|
+
deletePrice(params: DeletePlanPriceParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
2514
|
+
/** Add a base price or a selectable market price variant. Variants inherit their base price outside the markets they override. Configure introductory and promotional benefits through Offers. */
|
|
2515
|
+
addPrice(params: AddPlanPriceParams, options?: RequestOptions): Promise<PlanPrice>;
|
|
2516
|
+
/** Configure regional prices and feature overage values for one currency. Currency-specific offer terms are managed through Offers. */
|
|
2517
|
+
setRegionalPricing(params: SetPlanRegionalPricingParams, options?: RequestOptions): Promise<PlanRegionalPricingResult>;
|
|
2518
|
+
/** Get a plan with public price IDs and their automatic introductory offer IDs. */
|
|
2519
|
+
get(params: GetPlanParams, options?: RequestOptions): Promise<Plan>;
|
|
2520
|
+
/** Update a plan's name, description, visibility, or metadata. */
|
|
2521
|
+
update(params: UpdatePlanParams, options?: RequestOptions): Promise<Plan>;
|
|
2522
|
+
/** Soft-delete a plan. */
|
|
2523
|
+
delete(params: DeletePlanParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
2524
|
+
/** Set a plan's public visibility and return the updated plan. */
|
|
2525
|
+
setVisibility(params: SetPlanVisibilityParams, options?: RequestOptions): Promise<Plan>;
|
|
2526
|
+
/** List plans with public price IDs and their automatic introductory offer IDs. */
|
|
2527
|
+
list(params?: ListPlansParams, options?: RequestOptions): Promise<{
|
|
2528
|
+
object: "list";
|
|
2529
|
+
data: Array<Plan>;
|
|
2530
|
+
hasMore: boolean;
|
|
2531
|
+
nextCursor?: string;
|
|
2532
|
+
}>;
|
|
2533
|
+
/** Create a new plan with optional consumption model, visibility, and plan group assignment. */
|
|
2534
|
+
create(params: CreatePlanParams, options?: RequestOptions): Promise<Plan>;
|
|
1700
2535
|
}
|
|
1701
2536
|
|
|
1702
|
-
|
|
1703
|
-
email
|
|
1704
|
-
customerId?: string;
|
|
2537
|
+
type RequestPortalAccessParams = {
|
|
2538
|
+
email: string;
|
|
1705
2539
|
returnUrl?: string;
|
|
1706
|
-
}
|
|
2540
|
+
} | {
|
|
2541
|
+
customerId: string;
|
|
2542
|
+
returnUrl?: string;
|
|
2543
|
+
};
|
|
1707
2544
|
declare class PortalResource {
|
|
1708
2545
|
private httpClient;
|
|
1709
2546
|
constructor(httpClient: CommetHTTPClient);
|
|
1710
2547
|
/** Generate a customer portal URL. Exactly one identifier (email or customerId) is required. */
|
|
1711
|
-
getUrl(params?: RequestPortalAccessParams, options?: RequestOptions): Promise<
|
|
2548
|
+
getUrl(params?: RequestPortalAccessParams, options?: RequestOptions): Promise<PortalAccess>;
|
|
1712
2549
|
}
|
|
1713
2550
|
|
|
1714
|
-
interface
|
|
1715
|
-
|
|
1716
|
-
cursor?: string;
|
|
2551
|
+
interface GetMarketGroupParams {
|
|
2552
|
+
id: string;
|
|
1717
2553
|
}
|
|
1718
|
-
interface
|
|
2554
|
+
interface UpdateMarketGroupParams {
|
|
1719
2555
|
id: string;
|
|
2556
|
+
name: string;
|
|
2557
|
+
countryCodes: Array<string>;
|
|
2558
|
+
metadata?: Record<string, unknown>;
|
|
1720
2559
|
}
|
|
1721
|
-
interface
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
2560
|
+
interface DeleteMarketGroupParams {
|
|
2561
|
+
id: string;
|
|
2562
|
+
}
|
|
2563
|
+
interface CreateMarketGroupParams {
|
|
2564
|
+
name: string;
|
|
2565
|
+
countryCodes: Array<string>;
|
|
2566
|
+
metadata?: Record<string, unknown>;
|
|
2567
|
+
}
|
|
2568
|
+
declare class PricingResource {
|
|
2569
|
+
private httpClient;
|
|
2570
|
+
constructor(httpClient: CommetHTTPClient);
|
|
2571
|
+
/** Get one reusable pricing market group. */
|
|
2572
|
+
getMarketGroup(params: GetMarketGroupParams, options?: RequestOptions): Promise<MarketGroup>;
|
|
2573
|
+
/** Replace the name, countries, and metadata of a pricing market group. */
|
|
2574
|
+
updateMarketGroup(params: UpdateMarketGroupParams, options?: RequestOptions): Promise<MarketGroup>;
|
|
2575
|
+
/** Delete an unused pricing market group. Groups referenced by prices or subscriptions cannot be deleted. */
|
|
2576
|
+
deleteMarketGroup(params: DeleteMarketGroupParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
2577
|
+
/** List reusable country groups used to resolve market-specific prices independently from currency. */
|
|
2578
|
+
listMarketGroups(): Promise<{
|
|
2579
|
+
object: "list";
|
|
2580
|
+
data: Array<MarketGroup>;
|
|
2581
|
+
hasMore: boolean;
|
|
2582
|
+
nextCursor?: string;
|
|
2583
|
+
}>;
|
|
2584
|
+
/** Create a reusable country group. Countries can belong to only one active group; each price chooses its currency independently. */
|
|
2585
|
+
createMarketGroup(params: CreateMarketGroupParams, options?: RequestOptions): Promise<MarketGroup>;
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
interface GetPromoCodeParams {
|
|
2589
|
+
id: string;
|
|
1731
2590
|
}
|
|
1732
2591
|
interface UpdatePromoCodeParams {
|
|
1733
2592
|
id: string;
|
|
1734
|
-
billingInterval?:
|
|
2593
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time" | null;
|
|
1735
2594
|
maxRedemptions?: number | null;
|
|
1736
2595
|
expiresAt?: string | null;
|
|
1737
2596
|
active?: boolean;
|
|
1738
2597
|
planIds?: Array<string>;
|
|
1739
2598
|
}
|
|
2599
|
+
interface ListPromoCodesParams {
|
|
2600
|
+
cursor?: string;
|
|
2601
|
+
limit?: number;
|
|
2602
|
+
}
|
|
2603
|
+
interface CreatePromoCodeParams {
|
|
2604
|
+
code: string;
|
|
2605
|
+
offerId: string;
|
|
2606
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time" | null;
|
|
2607
|
+
maxRedemptions?: number;
|
|
2608
|
+
/** @format date-time */
|
|
2609
|
+
expiresAt?: string;
|
|
2610
|
+
planIds?: Array<string>;
|
|
2611
|
+
}
|
|
1740
2612
|
declare class PromoCodesResource {
|
|
1741
2613
|
private httpClient;
|
|
1742
2614
|
constructor(httpClient: CommetHTTPClient);
|
|
1743
|
-
/** List promo codes with cursor-based pagination. */
|
|
1744
|
-
list(params?: ListPromoCodesParams, options?: RequestOptions): Promise<ApiResponse<Array<PromoCode>>>;
|
|
1745
2615
|
/** Retrieve a promo code by its public ID. */
|
|
1746
|
-
get(params: GetPromoCodeParams, options?: RequestOptions): Promise<
|
|
1747
|
-
/**
|
|
1748
|
-
* Create a new promo code. Optionally restrict it to specific plans and a billing interval.
|
|
1749
|
-
*
|
|
1750
|
-
* **100% discounts are not supported.** Percentage codes must be strictly less than 100% (`discountValue` < 10000 basis points). For full waivers, use an introductory offer on the plan instead. At checkout, any code — percentage or fixed amount — that would reduce the total below the currency's minimum charge ($0.50 USD equivalent) is silently dropped.
|
|
1751
|
-
*/
|
|
1752
|
-
create(params: CreatePromoCodeParams, options?: RequestOptions): Promise<ApiResponse<PromoCode>>;
|
|
2616
|
+
get(params: GetPromoCodeParams, options?: RequestOptions): Promise<PromoCode>;
|
|
1753
2617
|
/** Update a promo code's billing interval, redemption limits, expiration, active status, or plan restrictions. */
|
|
1754
|
-
update(params: UpdatePromoCodeParams, options?: RequestOptions): Promise<
|
|
2618
|
+
update(params: UpdatePromoCodeParams, options?: RequestOptions): Promise<PromoCode>;
|
|
2619
|
+
/** List promo codes with cursor-based pagination. */
|
|
2620
|
+
list(params?: ListPromoCodesParams, options?: RequestOptions): Promise<{
|
|
2621
|
+
object: "list";
|
|
2622
|
+
data: Array<PromoCode>;
|
|
2623
|
+
hasMore: boolean;
|
|
2624
|
+
nextCursor?: string;
|
|
2625
|
+
}>;
|
|
2626
|
+
/** Create a distribution code for an existing promotional offer. Offer economics remain owned by the referenced Offer. */
|
|
2627
|
+
create(params: CreatePromoCodeParams, options?: RequestOptions): Promise<PromoCode>;
|
|
1755
2628
|
}
|
|
1756
2629
|
|
|
1757
2630
|
declare class ProvisioningResource {
|
|
1758
2631
|
private httpClient;
|
|
1759
2632
|
constructor(httpClient: CommetHTTPClient);
|
|
1760
2633
|
/** Issue a fresh claim link for an organization that was provisioned headlessly and has not been claimed yet. Any previously issued link stops working. */
|
|
1761
|
-
createClaimLink(options?: RequestOptions): Promise<
|
|
2634
|
+
createClaimLink(options?: RequestOptions): Promise<ClaimLink>;
|
|
1762
2635
|
}
|
|
1763
2636
|
|
|
1764
|
-
interface
|
|
1765
|
-
customerId
|
|
1766
|
-
externalId?: string;
|
|
1767
|
-
featureCode: string;
|
|
1768
|
-
count?: number;
|
|
1769
|
-
idempotencyKey?: string;
|
|
2637
|
+
interface GetAllQuotaAllowancesParams {
|
|
2638
|
+
customerId: string;
|
|
1770
2639
|
}
|
|
1771
|
-
|
|
1772
|
-
customerId?: string;
|
|
1773
|
-
externalId?: string;
|
|
2640
|
+
type RemoveQuotaParams = {
|
|
1774
2641
|
featureCode: string;
|
|
1775
|
-
count
|
|
1776
|
-
|
|
1777
|
-
}
|
|
1778
|
-
interface RemoveQuotaParams {
|
|
1779
|
-
customerId?: string;
|
|
1780
|
-
externalId?: string;
|
|
2642
|
+
count?: number;
|
|
2643
|
+
customerId: string;
|
|
2644
|
+
} | {
|
|
1781
2645
|
featureCode: string;
|
|
1782
2646
|
count?: number;
|
|
1783
|
-
|
|
1784
|
-
}
|
|
2647
|
+
externalId: string;
|
|
2648
|
+
};
|
|
1785
2649
|
interface GetQuotaAllowanceParams {
|
|
1786
2650
|
customerId: string;
|
|
1787
2651
|
featureCode: string;
|
|
1788
2652
|
}
|
|
1789
|
-
|
|
2653
|
+
type AddQuotaParams = {
|
|
2654
|
+
featureCode: string;
|
|
2655
|
+
count?: number;
|
|
1790
2656
|
customerId: string;
|
|
1791
|
-
}
|
|
2657
|
+
} | {
|
|
2658
|
+
featureCode: string;
|
|
2659
|
+
count?: number;
|
|
2660
|
+
externalId: string;
|
|
2661
|
+
};
|
|
2662
|
+
type SetQuotaParams = {
|
|
2663
|
+
featureCode: string;
|
|
2664
|
+
count: number;
|
|
2665
|
+
customerId: string;
|
|
2666
|
+
} | {
|
|
2667
|
+
featureCode: string;
|
|
2668
|
+
count: number;
|
|
2669
|
+
externalId: string;
|
|
2670
|
+
};
|
|
1792
2671
|
declare class QuotaResource {
|
|
1793
2672
|
private httpClient;
|
|
1794
2673
|
constructor(httpClient: CommetHTTPClient);
|
|
1795
|
-
/**
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
2674
|
+
/** Get all quota allowances for a customer across every quota feature in their plan. */
|
|
2675
|
+
getAll(params: GetAllQuotaAllowancesParams, options?: RequestOptions): Promise<{
|
|
2676
|
+
object: "list";
|
|
2677
|
+
data: Array<UsageQuota>;
|
|
2678
|
+
hasMore: boolean;
|
|
2679
|
+
nextCursor?: string;
|
|
2680
|
+
}>;
|
|
1799
2681
|
/** Remove from a customer's quota allowance for a feature. Defaults to 1 if count is omitted. Returns 400 insufficient_balance if the balance would go negative. */
|
|
1800
|
-
remove(params: RemoveQuotaParams, options?: RequestOptions): Promise<
|
|
2682
|
+
remove(params: RemoveQuotaParams, options?: RequestOptions): Promise<UsageQuotaEvent>;
|
|
1801
2683
|
/** Get the current quota allowance (used vs included) for a specific feature. */
|
|
1802
|
-
get(params: GetQuotaAllowanceParams, options?: RequestOptions): Promise<
|
|
1803
|
-
/**
|
|
1804
|
-
|
|
2684
|
+
get(params: GetQuotaAllowanceParams, options?: RequestOptions): Promise<UsageQuota>;
|
|
2685
|
+
/** Add to a customer's quota allowance for a feature. Defaults to 1 if count is omitted. */
|
|
2686
|
+
add(params: AddQuotaParams, options?: RequestOptions): Promise<UsageQuotaEvent>;
|
|
2687
|
+
/** Set a customer's quota allowance for a feature to an exact value. */
|
|
2688
|
+
set(params: SetQuotaParams, options?: RequestOptions): Promise<UsageQuotaEvent>;
|
|
1805
2689
|
}
|
|
1806
2690
|
|
|
1807
|
-
interface
|
|
2691
|
+
interface GetSeatBalanceParams {
|
|
1808
2692
|
customerId: string;
|
|
1809
2693
|
featureCode: string;
|
|
1810
|
-
count: number;
|
|
1811
2694
|
}
|
|
1812
|
-
interface
|
|
2695
|
+
interface GetAllSeatBalancesParams {
|
|
1813
2696
|
customerId: string;
|
|
1814
|
-
|
|
1815
|
-
|
|
2697
|
+
}
|
|
2698
|
+
interface BulkSetSeatsParams {
|
|
2699
|
+
customerId: string;
|
|
2700
|
+
seats: Record<string, number>;
|
|
1816
2701
|
}
|
|
1817
2702
|
interface RemoveSeatsParams {
|
|
1818
2703
|
customerId: string;
|
|
1819
2704
|
featureCode: string;
|
|
1820
2705
|
count: number;
|
|
1821
2706
|
}
|
|
1822
|
-
interface
|
|
1823
|
-
customerId: string;
|
|
1824
|
-
seats: Record<string, number>;
|
|
1825
|
-
}
|
|
1826
|
-
interface GetSeatBalanceParams {
|
|
2707
|
+
interface AddSeatsParams {
|
|
1827
2708
|
customerId: string;
|
|
1828
2709
|
featureCode: string;
|
|
2710
|
+
count: number;
|
|
1829
2711
|
}
|
|
1830
|
-
interface
|
|
2712
|
+
interface SetSeatsParams {
|
|
1831
2713
|
customerId: string;
|
|
2714
|
+
featureCode: string;
|
|
2715
|
+
count: number;
|
|
1832
2716
|
}
|
|
1833
2717
|
declare class SeatsResource {
|
|
1834
2718
|
private httpClient;
|
|
1835
2719
|
constructor(httpClient: CommetHTTPClient);
|
|
1836
|
-
/** Add seats to a customer's subscription. Prorates charges for the current billing period. */
|
|
1837
|
-
add(params: AddSeatsParams, options?: RequestOptions): Promise<ApiResponse<SeatEvent>>;
|
|
1838
|
-
/** Set seats to an exact count. */
|
|
1839
|
-
set(params: SetSeatsParams, options?: RequestOptions): Promise<ApiResponse<SeatEvent>>;
|
|
1840
|
-
/** Remove seats from a customer's subscription. Takes effect at the end of the billing period. */
|
|
1841
|
-
remove(params: RemoveSeatsParams, options?: RequestOptions): Promise<ApiResponse<SeatEvent>>;
|
|
1842
|
-
/** Set all seat types at once. */
|
|
1843
|
-
setAll(params: BulkSetSeatsParams, options?: RequestOptions): Promise<ApiResponse<Array<BulkSeatUpdate>>>;
|
|
1844
2720
|
/** Get current balance for a specific seat type. */
|
|
1845
|
-
getBalance(params: GetSeatBalanceParams, options?: RequestOptions): Promise<
|
|
2721
|
+
getBalance(params: GetSeatBalanceParams, options?: RequestOptions): Promise<SeatBalance>;
|
|
1846
2722
|
/** Get the current balance for all seat types in a customer's subscription. */
|
|
1847
|
-
getAllBalances(params: GetAllSeatBalancesParams, options?: RequestOptions): Promise<
|
|
2723
|
+
getAllBalances(params: GetAllSeatBalancesParams, options?: RequestOptions): Promise<SeatBalanceCollection>;
|
|
2724
|
+
/** Set all seat types at once. */
|
|
2725
|
+
setAll(params: BulkSetSeatsParams, options?: RequestOptions): Promise<{
|
|
2726
|
+
object: "list";
|
|
2727
|
+
data: Array<SeatEvent>;
|
|
2728
|
+
hasMore: boolean;
|
|
2729
|
+
nextCursor?: string;
|
|
2730
|
+
}>;
|
|
2731
|
+
/** Remove seats from a customer's subscription. Takes effect at the end of the billing period. */
|
|
2732
|
+
remove(params: RemoveSeatsParams, options?: RequestOptions): Promise<SeatEvent>;
|
|
2733
|
+
/** Add seats to a customer's subscription. Prorates charges for the current billing period. */
|
|
2734
|
+
add(params: AddSeatsParams, options?: RequestOptions): Promise<SeatEvent>;
|
|
2735
|
+
/** Set seats to an exact count. */
|
|
2736
|
+
set(params: SetSeatsParams, options?: RequestOptions): Promise<SeatEvent>;
|
|
1848
2737
|
}
|
|
1849
2738
|
|
|
1850
|
-
interface
|
|
1851
|
-
|
|
1852
|
-
|
|
2739
|
+
interface DeactivateAddonParams {
|
|
2740
|
+
id: string;
|
|
2741
|
+
addonId: string;
|
|
1853
2742
|
}
|
|
1854
|
-
interface
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
customerId: string;
|
|
1858
|
-
billingInterval?: BillingInterval | null;
|
|
1859
|
-
initialSeats?: Record<string, number>;
|
|
1860
|
-
skipTrial?: boolean;
|
|
1861
|
-
customTrialDays?: number;
|
|
1862
|
-
introOffer?: {
|
|
1863
|
-
discountType: DiscountType;
|
|
1864
|
-
discountValue: number;
|
|
1865
|
-
durationCycles: number;
|
|
1866
|
-
};
|
|
1867
|
-
promoCode?: string;
|
|
1868
|
-
/** Payment provider for the initial checkout. Overrides country routing when present. */
|
|
1869
|
-
provider?: PaymentProvider;
|
|
1870
|
-
name?: string;
|
|
1871
|
-
/** @format date-time */
|
|
1872
|
-
startDate?: string;
|
|
1873
|
-
successUrl?: string;
|
|
2743
|
+
interface ActivateAddonParams {
|
|
2744
|
+
id: string;
|
|
2745
|
+
addonId: string;
|
|
1874
2746
|
}
|
|
1875
|
-
interface
|
|
2747
|
+
interface AdjustBalanceParams {
|
|
1876
2748
|
id: string;
|
|
2749
|
+
amount: number;
|
|
2750
|
+
reason?: string;
|
|
2751
|
+
type?: "credits" | "balance";
|
|
1877
2752
|
}
|
|
1878
|
-
interface
|
|
1879
|
-
|
|
2753
|
+
interface TopupBalanceParams {
|
|
2754
|
+
id: string;
|
|
2755
|
+
amount: number;
|
|
1880
2756
|
}
|
|
1881
2757
|
interface CancelSubscriptionParams {
|
|
1882
2758
|
id: string;
|
|
1883
2759
|
reason?: string;
|
|
1884
2760
|
immediate?: boolean;
|
|
1885
2761
|
}
|
|
1886
|
-
interface
|
|
2762
|
+
interface ChangePlanParams {
|
|
2763
|
+
id: string;
|
|
2764
|
+
newPlanId?: string;
|
|
2765
|
+
newBillingInterval?: "weekly" | "monthly" | "quarterly" | "yearly";
|
|
2766
|
+
successUrl?: string;
|
|
2767
|
+
offerId?: string;
|
|
2768
|
+
}
|
|
2769
|
+
interface PurchaseCreditsParams {
|
|
2770
|
+
id: string;
|
|
2771
|
+
creditPackId: string;
|
|
2772
|
+
}
|
|
2773
|
+
interface UpdatePaymentMethodParams {
|
|
2774
|
+
id: string;
|
|
2775
|
+
successUrl?: string;
|
|
2776
|
+
}
|
|
2777
|
+
interface PreviewChangePlanParams {
|
|
1887
2778
|
id: string;
|
|
2779
|
+
planId: string;
|
|
2780
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time";
|
|
2781
|
+
offerId?: string;
|
|
1888
2782
|
}
|
|
1889
2783
|
interface ReactivateSubscriptionParams {
|
|
1890
2784
|
id: string;
|
|
2785
|
+
offerId?: string;
|
|
1891
2786
|
}
|
|
1892
2787
|
interface CreateSubscriptionRecoveryLinkParams {
|
|
1893
2788
|
id: string;
|
|
1894
2789
|
}
|
|
1895
|
-
interface
|
|
2790
|
+
interface GetSubscriptionParams {
|
|
1896
2791
|
id: string;
|
|
1897
|
-
successUrl?: string;
|
|
1898
2792
|
}
|
|
1899
|
-
interface
|
|
2793
|
+
interface UncancelSubscriptionParams {
|
|
1900
2794
|
id: string;
|
|
1901
|
-
|
|
1902
|
-
|
|
2795
|
+
}
|
|
2796
|
+
interface GetActiveSubscriptionParams {
|
|
2797
|
+
customerId: string;
|
|
2798
|
+
}
|
|
2799
|
+
interface ListSubscriptionsParams {
|
|
2800
|
+
customerId?: string;
|
|
2801
|
+
status?: SubscriptionStatus;
|
|
2802
|
+
}
|
|
2803
|
+
type CreateSubscriptionParams = {
|
|
2804
|
+
customerId: string;
|
|
2805
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time" | null;
|
|
2806
|
+
/** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
|
|
2807
|
+
priceId?: string;
|
|
2808
|
+
initialSeats?: Record<string, number>;
|
|
2809
|
+
/** Payment provider for the initial checkout. Overrides country routing when present. */
|
|
2810
|
+
provider?: "stripe" | "commet" | "dlocal";
|
|
2811
|
+
name?: string;
|
|
2812
|
+
/** @format date-time */
|
|
2813
|
+
startDate?: string;
|
|
2814
|
+
successUrl?: string;
|
|
2815
|
+
offerId?: never;
|
|
2816
|
+
promoCode?: string;
|
|
2817
|
+
customTrialDays?: number;
|
|
2818
|
+
skipTrial?: boolean;
|
|
2819
|
+
planId: string;
|
|
2820
|
+
} | {
|
|
2821
|
+
customerId: string;
|
|
2822
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time" | null;
|
|
2823
|
+
/** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
|
|
2824
|
+
priceId?: string;
|
|
2825
|
+
initialSeats?: Record<string, number>;
|
|
2826
|
+
/** Payment provider for the initial checkout. Overrides country routing when present. */
|
|
2827
|
+
provider?: "stripe" | "commet" | "dlocal";
|
|
2828
|
+
name?: string;
|
|
2829
|
+
/** @format date-time */
|
|
2830
|
+
startDate?: string;
|
|
2831
|
+
successUrl?: string;
|
|
2832
|
+
offerId?: never;
|
|
2833
|
+
promoCode?: string;
|
|
2834
|
+
customTrialDays?: number;
|
|
2835
|
+
skipTrial?: boolean;
|
|
2836
|
+
planCode: string;
|
|
2837
|
+
} | {
|
|
2838
|
+
customerId: string;
|
|
2839
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time" | null;
|
|
2840
|
+
/** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
|
|
2841
|
+
priceId?: string;
|
|
2842
|
+
initialSeats?: Record<string, number>;
|
|
2843
|
+
/** Payment provider for the initial checkout. Overrides country routing when present. */
|
|
2844
|
+
provider?: "stripe" | "commet" | "dlocal";
|
|
2845
|
+
name?: string;
|
|
2846
|
+
/** @format date-time */
|
|
2847
|
+
startDate?: string;
|
|
1903
2848
|
successUrl?: string;
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
2849
|
+
offerId: string;
|
|
2850
|
+
promoCode?: never;
|
|
2851
|
+
customTrialDays?: never;
|
|
2852
|
+
skipTrial?: false;
|
|
1907
2853
|
planId: string;
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
amount: number;
|
|
1927
|
-
}
|
|
1928
|
-
interface PurchaseCreditsParams {
|
|
1929
|
-
id: string;
|
|
1930
|
-
creditPackId: string;
|
|
1931
|
-
}
|
|
2854
|
+
} | {
|
|
2855
|
+
customerId: string;
|
|
2856
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time" | null;
|
|
2857
|
+
/** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
|
|
2858
|
+
priceId?: string;
|
|
2859
|
+
initialSeats?: Record<string, number>;
|
|
2860
|
+
/** Payment provider for the initial checkout. Overrides country routing when present. */
|
|
2861
|
+
provider?: "stripe" | "commet" | "dlocal";
|
|
2862
|
+
name?: string;
|
|
2863
|
+
/** @format date-time */
|
|
2864
|
+
startDate?: string;
|
|
2865
|
+
successUrl?: string;
|
|
2866
|
+
offerId: string;
|
|
2867
|
+
promoCode?: never;
|
|
2868
|
+
customTrialDays?: never;
|
|
2869
|
+
skipTrial?: false;
|
|
2870
|
+
planCode: string;
|
|
2871
|
+
};
|
|
1932
2872
|
declare class SubscriptionsResource {
|
|
1933
2873
|
private httpClient;
|
|
1934
2874
|
constructor(httpClient: CommetHTTPClient);
|
|
1935
|
-
/** List all subscriptions. Filter by customer ID or status. */
|
|
1936
|
-
list(params?: ListSubscriptionsParams, options?: RequestOptions): Promise<ApiResponse<Array<Subscription>>>;
|
|
1937
|
-
/** Create a subscription for a customer. Requires planId or planCode plus customerId. */
|
|
1938
|
-
create(params: CreateSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<Subscription>>;
|
|
1939
|
-
/** Get a subscription by its public ID, regardless of status (including pending_payment and past_due). */
|
|
1940
|
-
get(params: GetSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<Subscription>>;
|
|
1941
|
-
/** Get the active subscription for a customer. Returns null if none. */
|
|
1942
|
-
getActive(params: GetActiveSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<Subscription | null>>;
|
|
1943
|
-
/** Cancel immediately or at period end. */
|
|
1944
|
-
cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<CanceledSubscription>>;
|
|
1945
|
-
/** Revert a scheduled cancellation. Only works when canceledAt is set but status is not yet 'canceled'. */
|
|
1946
|
-
uncancel(params: UncancelSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<UncanceledSubscription>>;
|
|
1947
|
-
/** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. */
|
|
1948
|
-
reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<ReactivatedSubscription>>;
|
|
1949
|
-
/** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
|
|
1950
|
-
createRecoveryLink(params: CreateSubscriptionRecoveryLinkParams, options?: RequestOptions): Promise<ApiResponse<RecoveryLink>>;
|
|
1951
|
-
/** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
|
|
1952
|
-
updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<ApiResponse<PaymentMethodUpdateCheckout>>;
|
|
1953
|
-
/** Upgrade, downgrade, or change billing interval. */
|
|
1954
|
-
changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanChange>>;
|
|
1955
|
-
/** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Downgrades — a cheaper plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. */
|
|
1956
|
-
previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PreviewChange>>;
|
|
1957
|
-
/** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
|
|
1958
|
-
activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<ApiResponse<SubscriptionAddon>>;
|
|
1959
2875
|
/** Deactivate an add-on from a subscription. */
|
|
1960
|
-
deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<
|
|
2876
|
+
deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<DeletedSubscriptionAddon>;
|
|
2877
|
+
/** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
|
|
2878
|
+
activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<SubscriptionAddon>;
|
|
1961
2879
|
/** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
|
|
1962
|
-
adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<
|
|
2880
|
+
adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<BalanceAdjustment>;
|
|
1963
2881
|
/** Top up a subscription's balance. Charges the customer's payment method for the specified amount. */
|
|
1964
|
-
topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<
|
|
2882
|
+
topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<BalanceTopup>;
|
|
2883
|
+
/** Cancel immediately or at period end and return the updated subscription. */
|
|
2884
|
+
cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
2885
|
+
/** Upgrade or change billing interval immediately, optionally applying a quoted Promotional Offer. Scheduled changes do not accept offers. */
|
|
2886
|
+
changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<PlanChange>;
|
|
1965
2887
|
/** Purchase a credit pack for a subscription. Charges the customer and adds credits to their balance. */
|
|
1966
|
-
purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<
|
|
2888
|
+
purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
|
|
2889
|
+
/** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
|
|
2890
|
+
updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<PaymentMethodUpdateCheckout>;
|
|
2891
|
+
/** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Downgrades — a cheaper plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with a Promotional Offer. */
|
|
2892
|
+
previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<PreviewChange>;
|
|
2893
|
+
/** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply a Promotional Offer by offerId; past-due recovery cannot. */
|
|
2894
|
+
reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ReactivatedSubscription>;
|
|
2895
|
+
/** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
|
|
2896
|
+
createRecoveryLink(params: CreateSubscriptionRecoveryLinkParams, options?: RequestOptions): Promise<RecoveryLink>;
|
|
2897
|
+
/** Get a subscription by its public ID, regardless of status (including pending_payment and past_due). */
|
|
2898
|
+
get(params: GetSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
2899
|
+
/** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. */
|
|
2900
|
+
uncancel(params: UncancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
2901
|
+
/** Get the active subscription for a customer. Returns null if none. */
|
|
2902
|
+
getActive(params: GetActiveSubscriptionParams, options?: RequestOptions): Promise<Subscription | null>;
|
|
2903
|
+
/** List all subscriptions. Filter by customer ID or status. */
|
|
2904
|
+
list(params?: ListSubscriptionsParams, options?: RequestOptions): Promise<{
|
|
2905
|
+
object: "list";
|
|
2906
|
+
data: Array<SubscriptionSummary>;
|
|
2907
|
+
hasMore: boolean;
|
|
2908
|
+
nextCursor?: string;
|
|
2909
|
+
}>;
|
|
2910
|
+
/** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. Without an offer override, Commet applies the price's automatic introductory offer. Pass one Promotional Offer through offerId to override it. Experiment assignment remains external. */
|
|
2911
|
+
create(params: CreateSubscriptionParams, options?: RequestOptions): Promise<CreatedSubscription>;
|
|
1967
2912
|
}
|
|
1968
2913
|
|
|
1969
|
-
|
|
1970
|
-
advanceDays
|
|
2914
|
+
type AdvanceTestClockParams = {
|
|
2915
|
+
advanceDays: number;
|
|
2916
|
+
} | {
|
|
1971
2917
|
/** @format date-time */
|
|
1972
|
-
frozenTime
|
|
1973
|
-
}
|
|
2918
|
+
frozenTime: string;
|
|
2919
|
+
};
|
|
1974
2920
|
declare class TestClockResource {
|
|
1975
2921
|
private httpClient;
|
|
1976
2922
|
constructor(httpClient: CommetHTTPClient);
|
|
2923
|
+
/** Discovers customers due for billing at the org's current (simulated) time and enqueues a billing cycle for each — renewals, expired trials, pending cancellations. Also fires any dunning retry whose scheduled time has passed. Enqueueing is asynchronous. Sandbox only. */
|
|
2924
|
+
processBilling(options?: RequestOptions): Promise<TestClockBilling>;
|
|
1977
2925
|
/** Returns the organization's current test clock state. Sandbox only. */
|
|
1978
|
-
get(): Promise<
|
|
2926
|
+
get(): Promise<TestClock>;
|
|
1979
2927
|
/** Moves the test clock forward, by a number of days (advanceDays) or to an absolute instant (frozenTime). The clock can only move forward. Sandbox only. */
|
|
1980
|
-
advance(params?: AdvanceTestClockParams, options?: RequestOptions): Promise<
|
|
1981
|
-
/** Discovers customers due for billing at the org's current (simulated) time and enqueues a billing cycle for each — renewals, expired trials, pending cancellations. Also fires any dunning retry whose scheduled time has passed. Enqueueing is asynchronous. Sandbox only. */
|
|
1982
|
-
processBilling(options?: RequestOptions): Promise<ApiResponse<TestClockBilling>>;
|
|
2928
|
+
advance(params?: AdvanceTestClockParams, options?: RequestOptions): Promise<TestClock>;
|
|
1983
2929
|
}
|
|
1984
2930
|
|
|
1985
|
-
interface ListTransactionsParams {
|
|
1986
|
-
status?: TransactionStatus;
|
|
1987
|
-
customerEmail?: string;
|
|
1988
|
-
limit?: number;
|
|
1989
|
-
cursor?: string;
|
|
1990
|
-
}
|
|
1991
|
-
interface GetTransactionParams {
|
|
1992
|
-
id: string;
|
|
1993
|
-
}
|
|
1994
2931
|
interface RefundTransactionParams {
|
|
1995
2932
|
id: string;
|
|
1996
2933
|
}
|
|
1997
2934
|
interface RetryTransactionParams {
|
|
1998
2935
|
id: string;
|
|
1999
2936
|
}
|
|
2937
|
+
interface GetTransactionParams {
|
|
2938
|
+
id: string;
|
|
2939
|
+
}
|
|
2940
|
+
interface ListTransactionsParams {
|
|
2941
|
+
cursor?: string;
|
|
2942
|
+
limit?: number;
|
|
2943
|
+
status?: TransactionStatus;
|
|
2944
|
+
customerEmail?: string;
|
|
2945
|
+
}
|
|
2000
2946
|
declare class TransactionsResource {
|
|
2001
2947
|
private httpClient;
|
|
2002
2948
|
constructor(httpClient: CommetHTTPClient);
|
|
2003
|
-
/**
|
|
2004
|
-
|
|
2949
|
+
/** Issue a full refund and return the provider-neutral refund resource with its actual status. */
|
|
2950
|
+
refund(params: RefundTransactionParams, options?: RequestOptions): Promise<Refund>;
|
|
2951
|
+
/** Retry a failed subscription renewal and return an honest retry result. The original failed transaction remains immutable. */
|
|
2952
|
+
retry(params: RetryTransactionParams, options?: RequestOptions): Promise<TransactionRetry>;
|
|
2005
2953
|
/** Retrieve a single payment transaction by its public ID, including provider details. */
|
|
2006
|
-
get(params: GetTransactionParams, options?: RequestOptions): Promise<
|
|
2007
|
-
/**
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2954
|
+
get(params: GetTransactionParams, options?: RequestOptions): Promise<Transaction>;
|
|
2955
|
+
/** List payment transactions with cursor-based pagination. Filter by status or customer email. */
|
|
2956
|
+
list(params?: ListTransactionsParams, options?: RequestOptions): Promise<{
|
|
2957
|
+
object: "list";
|
|
2958
|
+
data: Array<TransactionListItem>;
|
|
2959
|
+
hasMore: boolean;
|
|
2960
|
+
nextCursor?: string;
|
|
2961
|
+
}>;
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
interface CheckUsageAvailabilityParams {
|
|
2965
|
+
customerId: string;
|
|
2966
|
+
featureCode: string;
|
|
2967
|
+
quantity?: number;
|
|
2968
|
+
}
|
|
2969
|
+
type TrackUsageParams = {
|
|
2970
|
+
featureCode: string;
|
|
2971
|
+
customerId: string;
|
|
2972
|
+
eventId?: string;
|
|
2973
|
+
/** @format date-time */
|
|
2974
|
+
timestamp?: string;
|
|
2975
|
+
properties?: Array<{
|
|
2976
|
+
property: string;
|
|
2977
|
+
value: string;
|
|
2978
|
+
}>;
|
|
2979
|
+
model: string;
|
|
2980
|
+
inputTokens: number;
|
|
2981
|
+
outputTokens: number;
|
|
2982
|
+
value?: never;
|
|
2983
|
+
cacheReadTokens?: number;
|
|
2984
|
+
cacheWriteTokens?: number;
|
|
2985
|
+
} | {
|
|
2986
|
+
featureCode: string;
|
|
2987
|
+
customerId: string;
|
|
2988
|
+
eventId?: string;
|
|
2989
|
+
/** @format date-time */
|
|
2990
|
+
timestamp?: string;
|
|
2991
|
+
properties?: Array<{
|
|
2992
|
+
property: string;
|
|
2993
|
+
value: string;
|
|
2994
|
+
}>;
|
|
2995
|
+
value?: number;
|
|
2996
|
+
model?: never;
|
|
2997
|
+
inputTokens?: never;
|
|
2998
|
+
outputTokens?: never;
|
|
2999
|
+
cacheReadTokens?: never;
|
|
3000
|
+
cacheWriteTokens?: never;
|
|
3001
|
+
};
|
|
3002
|
+
interface SetUsageParams {
|
|
3003
|
+
customerId: string;
|
|
3004
|
+
featureCode: string;
|
|
3005
|
+
value: number;
|
|
3006
|
+
reason?: string;
|
|
3007
|
+
}
|
|
3008
|
+
declare class UsageResource {
|
|
3009
|
+
private httpClient;
|
|
3010
|
+
constructor(httpClient: CommetHTTPClient);
|
|
3011
|
+
/** Check if a customer can consume a feature before actual consumption. Returns availability and cost estimates based on the plan's consumption model. */
|
|
3012
|
+
check(params: CheckUsageAvailabilityParams, options?: RequestOptions): Promise<UsageCheck>;
|
|
3013
|
+
/** Track a usage event for a metered feature. Deducts from balance/credits if applicable. */
|
|
3014
|
+
track(params: TrackUsageParams, options?: RequestOptions): Promise<UsageEvent>;
|
|
3015
|
+
/** Set a metered feature's usage to an exact value for the current period. Use the Idempotency-Key header to make retries safe. */
|
|
3016
|
+
set(params: SetUsageParams, options?: RequestOptions): Promise<UsageAdjustment>;
|
|
2011
3017
|
}
|
|
2012
3018
|
|
|
2013
3019
|
declare class GeneratedResources {
|
|
@@ -2018,11 +3024,13 @@ declare class GeneratedResources {
|
|
|
2018
3024
|
featureAccess: FeatureAccessResource;
|
|
2019
3025
|
features: FeaturesResource;
|
|
2020
3026
|
invoices: InvoicesResource;
|
|
3027
|
+
offers: OffersResource;
|
|
2021
3028
|
payments: PaymentsResource;
|
|
2022
3029
|
payouts: PayoutsResource;
|
|
2023
3030
|
planGroups: PlanGroupsResource;
|
|
2024
3031
|
plans: PlansResource;
|
|
2025
3032
|
portal: PortalResource;
|
|
3033
|
+
pricing: PricingResource;
|
|
2026
3034
|
promoCodes: PromoCodesResource;
|
|
2027
3035
|
provisioning: ProvisioningResource;
|
|
2028
3036
|
quota: QuotaResource;
|
|
@@ -2030,110 +3038,10 @@ declare class GeneratedResources {
|
|
|
2030
3038
|
subscriptions: SubscriptionsResource;
|
|
2031
3039
|
testClock: TestClockResource;
|
|
2032
3040
|
transactions: TransactionsResource;
|
|
3041
|
+
usage: UsageResource;
|
|
2033
3042
|
protected initResources(http: CommetHTTPClient): void;
|
|
2034
3043
|
}
|
|
2035
3044
|
|
|
2036
|
-
type UsageCheckDenialReason = "included_limit_reached" | "insufficient_credits" | "insufficient_balance";
|
|
2037
|
-
interface UsageEvent {
|
|
2038
|
-
id: EventID;
|
|
2039
|
-
object: "usage_event";
|
|
2040
|
-
livemode: boolean;
|
|
2041
|
-
organizationId: string;
|
|
2042
|
-
customerId: CustomerID;
|
|
2043
|
-
feature: string;
|
|
2044
|
-
idempotencyKey?: string;
|
|
2045
|
-
ts: string;
|
|
2046
|
-
properties?: UsageEventProperty[];
|
|
2047
|
-
createdAt: string;
|
|
2048
|
-
}
|
|
2049
|
-
interface UsageEventProperty {
|
|
2050
|
-
id: string;
|
|
2051
|
-
usageEventId: EventID;
|
|
2052
|
-
property: string;
|
|
2053
|
-
value: string;
|
|
2054
|
-
createdAt: string;
|
|
2055
|
-
}
|
|
2056
|
-
interface TrackBaseParams {
|
|
2057
|
-
feature: string;
|
|
2058
|
-
customerId: CustomerID;
|
|
2059
|
-
idempotencyKey?: string;
|
|
2060
|
-
timestamp?: string;
|
|
2061
|
-
properties?: Record<string, string>;
|
|
2062
|
-
}
|
|
2063
|
-
interface TrackUsageParams extends TrackBaseParams {
|
|
2064
|
-
value?: number;
|
|
2065
|
-
model?: never;
|
|
2066
|
-
}
|
|
2067
|
-
interface TrackModelTokensParams extends TrackBaseParams {
|
|
2068
|
-
model: string;
|
|
2069
|
-
inputTokens: number;
|
|
2070
|
-
outputTokens: number;
|
|
2071
|
-
cacheReadTokens?: number;
|
|
2072
|
-
cacheWriteTokens?: number;
|
|
2073
|
-
value?: never;
|
|
2074
|
-
}
|
|
2075
|
-
type TrackParams = TrackUsageParams | TrackModelTokensParams;
|
|
2076
|
-
interface CheckUsageParams {
|
|
2077
|
-
customerId: CustomerID;
|
|
2078
|
-
featureCode: string;
|
|
2079
|
-
quantity: number;
|
|
2080
|
-
}
|
|
2081
|
-
interface SetUsageParams {
|
|
2082
|
-
customerId: CustomerID;
|
|
2083
|
-
feature: string;
|
|
2084
|
-
value: number;
|
|
2085
|
-
idempotencyKey?: string;
|
|
2086
|
-
reason?: string;
|
|
2087
|
-
}
|
|
2088
|
-
interface UsageAdjustment {
|
|
2089
|
-
id: EventID;
|
|
2090
|
-
feature: string;
|
|
2091
|
-
value: number;
|
|
2092
|
-
previousValue: number;
|
|
2093
|
-
adjustment: number;
|
|
2094
|
-
customerId: CustomerID;
|
|
2095
|
-
idempotencyKey: string | null;
|
|
2096
|
-
reason: string | null;
|
|
2097
|
-
ts: string;
|
|
2098
|
-
createdAt: string;
|
|
2099
|
-
object: "usage_event";
|
|
2100
|
-
livemode: boolean;
|
|
2101
|
-
}
|
|
2102
|
-
interface UsageCheckResult {
|
|
2103
|
-
allowed: boolean;
|
|
2104
|
-
consumptionModel: ConsumptionModel;
|
|
2105
|
-
feature: string;
|
|
2106
|
-
quantity: number;
|
|
2107
|
-
current?: number;
|
|
2108
|
-
remaining?: number;
|
|
2109
|
-
unlimited?: boolean;
|
|
2110
|
-
included?: number;
|
|
2111
|
-
overageEnabled?: boolean;
|
|
2112
|
-
overageUnitPrice?: number | null;
|
|
2113
|
-
creditsPerUnit?: number;
|
|
2114
|
-
estimatedCredits?: number;
|
|
2115
|
-
planCredits?: number;
|
|
2116
|
-
purchasedCredits?: number;
|
|
2117
|
-
totalCredits?: number;
|
|
2118
|
-
unitPrice?: number;
|
|
2119
|
-
estimatedAmount?: number;
|
|
2120
|
-
currentBalance?: number;
|
|
2121
|
-
blockOnExhaustion?: boolean;
|
|
2122
|
-
currency?: string;
|
|
2123
|
-
reason?: UsageCheckDenialReason;
|
|
2124
|
-
message?: string;
|
|
2125
|
-
}
|
|
2126
|
-
declare class UsageResource {
|
|
2127
|
-
private httpClient;
|
|
2128
|
-
constructor(httpClient: CommetHTTPClient);
|
|
2129
|
-
/** Deducts from balance/credits if the plan uses consumption. Duplicate `idempotencyKey` is rejected. */
|
|
2130
|
-
track(params: TrackParams, options?: RequestOptions): Promise<ApiResponse<UsageEvent>>;
|
|
2131
|
-
/** Dry-run: checks if a usage event would be allowed without actually tracking it. */
|
|
2132
|
-
check(params: CheckUsageParams, options?: RequestOptions): Promise<ApiResponse<UsageCheckResult>>;
|
|
2133
|
-
/** Set a metered feature's usage to an exact value for the current period. */
|
|
2134
|
-
set(params: SetUsageParams, options?: RequestOptions): Promise<ApiResponse<UsageAdjustment>>;
|
|
2135
|
-
}
|
|
2136
|
-
|
|
2137
3045
|
type WebhookEvent = "subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed";
|
|
2138
3046
|
/** Fired when a subscription record is created with status pending_payment. The first charge has not been confirmed yet — do NOT grant access here. Wait for subscription.activated. */
|
|
2139
3047
|
interface SubscriptionCreatedData {
|
|
@@ -2175,7 +3083,7 @@ interface SubscriptionActivatedData {
|
|
|
2175
3083
|
/** The invoice currency code. */
|
|
2176
3084
|
invoiceCurrency: string;
|
|
2177
3085
|
/** The payment provider that processed the activating charge: stripe, commet, or dlocal. Null when the subscription activated without a charge (zero-total or setup-based activation). */
|
|
2178
|
-
provider:
|
|
3086
|
+
provider: "stripe" | "commet" | "dlocal" | null;
|
|
2179
3087
|
}
|
|
2180
3088
|
/** Fired when a canceled subscription is reactivated and its reactivation charge succeeds. The subscription returns to active with a fresh invoice and a billing period anchored to the reactivation date. Distinct from subscription.activated (first activation) and payment.recovered (past_due recovery, which keeps the original anchor). */
|
|
2181
3089
|
interface SubscriptionReactivatedData {
|
|
@@ -2200,7 +3108,7 @@ interface SubscriptionReactivatedData {
|
|
|
2200
3108
|
/** The invoice currency code. */
|
|
2201
3109
|
invoiceCurrency: string;
|
|
2202
3110
|
/** The payment provider that processed the reactivation charge: stripe, commet, or dlocal. */
|
|
2203
|
-
provider:
|
|
3111
|
+
provider: "stripe" | "commet" | "dlocal";
|
|
2204
3112
|
}
|
|
2205
3113
|
/** Fired when a subscription is actually terminated. A scheduled cancellation fires it at the end of the billing period; immediate cancellations, full refunds (cancelReason refund), and exhausted dunning retries (cancelReason dunning_exhausted) fire it right away. The status is now canceled and access should be revoked. This event is NOT fired when cancellation is scheduled — that triggers subscription.updated instead. See the cancellation lifecycle below. */
|
|
2206
3114
|
interface SubscriptionCanceledData {
|
|
@@ -2429,7 +3337,7 @@ interface PaymentReceivedData {
|
|
|
2429
3337
|
/** The payment transaction ID. */
|
|
2430
3338
|
paymentTransactionId: string | null;
|
|
2431
3339
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. Null for billing-only charges with no Commet ledger row. */
|
|
2432
|
-
provider:
|
|
3340
|
+
provider: "stripe" | "commet" | "dlocal" | null;
|
|
2433
3341
|
/** Gross amount in cents before fees. */
|
|
2434
3342
|
grossAmount: number | null;
|
|
2435
3343
|
/** The payment currency code. */
|
|
@@ -2489,7 +3397,7 @@ interface PaymentRefundedData {
|
|
|
2489
3397
|
/** The refunded payment transaction ID. */
|
|
2490
3398
|
paymentTransactionId: string;
|
|
2491
3399
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. */
|
|
2492
|
-
provider:
|
|
3400
|
+
provider: "stripe" | "commet" | "dlocal";
|
|
2493
3401
|
/** The payment link the payment originated from, or null when the payment did not come from a payment link. */
|
|
2494
3402
|
paymentLinkId: string | null;
|
|
2495
3403
|
/** The invoice the payment collected, or null for payments without an invoice. */
|
|
@@ -2510,7 +3418,7 @@ interface PaymentDisputedData {
|
|
|
2510
3418
|
/** The disputed payment transaction ID. */
|
|
2511
3419
|
paymentTransactionId: string;
|
|
2512
3420
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. */
|
|
2513
|
-
provider:
|
|
3421
|
+
provider: "stripe" | "commet" | "dlocal";
|
|
2514
3422
|
/** The payment link the payment originated from, or null when the payment did not come from a payment link. */
|
|
2515
3423
|
paymentLinkId: string | null;
|
|
2516
3424
|
/** The invoice the payment collected, or null for payments without an invoice. */
|
|
@@ -2533,7 +3441,7 @@ interface PaymentDisputeResolvedData {
|
|
|
2533
3441
|
/** The disputed payment transaction ID. */
|
|
2534
3442
|
paymentTransactionId: string;
|
|
2535
3443
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. */
|
|
2536
|
-
provider:
|
|
3444
|
+
provider: "stripe" | "commet" | "dlocal";
|
|
2537
3445
|
/** The payment link the payment originated from, or null when the payment did not come from a payment link. */
|
|
2538
3446
|
paymentLinkId: string | null;
|
|
2539
3447
|
/** The invoice the payment collected, or null for payments without an invoice. */
|
|
@@ -2799,8 +3707,228 @@ interface CustomerStateChangedData {
|
|
|
2799
3707
|
billingInterval: string | null;
|
|
2800
3708
|
/** The plan's consumption model: metered, credits, or balance. */
|
|
2801
3709
|
consumptionModel: string | null;
|
|
2802
|
-
/** Current feature access,
|
|
2803
|
-
features: Array<
|
|
3710
|
+
/** Current feature access, discriminated by type. Boolean features expose enabled; usage features expose model-specific consumption; seats and quota expose usage allowances. */
|
|
3711
|
+
features: Array<{
|
|
3712
|
+
/** Unique feature code. */
|
|
3713
|
+
code: string;
|
|
3714
|
+
/** Display name of the feature. */
|
|
3715
|
+
name: string;
|
|
3716
|
+
/** Display name for one product unit, or null when not applicable. */
|
|
3717
|
+
unitName: string | null;
|
|
3718
|
+
/** Whether the customer can currently access or consume the feature. */
|
|
3719
|
+
allowed: boolean;
|
|
3720
|
+
type: "boolean";
|
|
3721
|
+
/** Whether the feature is enabled. */
|
|
3722
|
+
enabled: boolean;
|
|
3723
|
+
} | {
|
|
3724
|
+
/** Unique feature code. */
|
|
3725
|
+
code: string;
|
|
3726
|
+
/** Display name of the feature. */
|
|
3727
|
+
name: string;
|
|
3728
|
+
/** Display name for one product unit, or null when not applicable. */
|
|
3729
|
+
unitName: string | null;
|
|
3730
|
+
/** Whether the customer can currently access or consume the feature. */
|
|
3731
|
+
allowed: boolean;
|
|
3732
|
+
type: "usage";
|
|
3733
|
+
consumption: {
|
|
3734
|
+
/** Usage is measured against an included allowance and overage. */
|
|
3735
|
+
model: "metered";
|
|
3736
|
+
/** Time range used to calculate this feature's consumption. */
|
|
3737
|
+
period: {
|
|
3738
|
+
/**
|
|
3739
|
+
* Inclusive usage period start.
|
|
3740
|
+
* @format date-time
|
|
3741
|
+
*/
|
|
3742
|
+
start: string;
|
|
3743
|
+
/**
|
|
3744
|
+
* Exclusive usage period end.
|
|
3745
|
+
* @format date-time
|
|
3746
|
+
*/
|
|
3747
|
+
end: string;
|
|
3748
|
+
};
|
|
3749
|
+
/** Product units recorded during the period. */
|
|
3750
|
+
unitsUsed: number;
|
|
3751
|
+
/** Product units included in the subscription for the period. */
|
|
3752
|
+
includedUnits: number;
|
|
3753
|
+
/** Included units not yet consumed. Absent when usage is unlimited. */
|
|
3754
|
+
remainingUnits?: number;
|
|
3755
|
+
/** Whether the feature has no usage limit. */
|
|
3756
|
+
unlimited: boolean;
|
|
3757
|
+
overage: {
|
|
3758
|
+
/** Whether usage above the included amount is allowed and billed. */
|
|
3759
|
+
enabled: boolean;
|
|
3760
|
+
/** Units consumed above the included amount. */
|
|
3761
|
+
units: number;
|
|
3762
|
+
/** Price for one additional product unit. */
|
|
3763
|
+
unitPrice?: {
|
|
3764
|
+
/** Integer rate amount. Divide by scale to obtain the price. */
|
|
3765
|
+
amount: number;
|
|
3766
|
+
/** Lowercase ISO 4217 currency code. */
|
|
3767
|
+
currency: string;
|
|
3768
|
+
/** Divide amount by scale to obtain the major-unit price. */
|
|
3769
|
+
scale: 10000;
|
|
3770
|
+
};
|
|
3771
|
+
};
|
|
3772
|
+
} | {
|
|
3773
|
+
/** Product usage consumes credits from a shared pool. */
|
|
3774
|
+
model: "credits";
|
|
3775
|
+
/** Time range used to calculate this feature's consumption. */
|
|
3776
|
+
period: {
|
|
3777
|
+
/**
|
|
3778
|
+
* Inclusive usage period start.
|
|
3779
|
+
* @format date-time
|
|
3780
|
+
*/
|
|
3781
|
+
start: string;
|
|
3782
|
+
/**
|
|
3783
|
+
* Exclusive usage period end.
|
|
3784
|
+
* @format date-time
|
|
3785
|
+
*/
|
|
3786
|
+
end: string;
|
|
3787
|
+
};
|
|
3788
|
+
/** Product units recorded during the period. */
|
|
3789
|
+
unitsUsed: number;
|
|
3790
|
+
/** Credits deducted for each product unit. */
|
|
3791
|
+
creditsPerUnit: number;
|
|
3792
|
+
/** Actual credits deducted by this feature during the period. */
|
|
3793
|
+
creditsConsumed: number;
|
|
3794
|
+
/** Additional product units available from the current shared credit pool at this feature's conversion rate. */
|
|
3795
|
+
availableUnits: number;
|
|
3796
|
+
} | {
|
|
3797
|
+
/** Product usage deducts money from a shared balance. */
|
|
3798
|
+
model: "balance";
|
|
3799
|
+
/** Time range used to calculate this feature's consumption. */
|
|
3800
|
+
period: {
|
|
3801
|
+
/**
|
|
3802
|
+
* Inclusive usage period start.
|
|
3803
|
+
* @format date-time
|
|
3804
|
+
*/
|
|
3805
|
+
start: string;
|
|
3806
|
+
/**
|
|
3807
|
+
* Exclusive usage period end.
|
|
3808
|
+
* @format date-time
|
|
3809
|
+
*/
|
|
3810
|
+
end: string;
|
|
3811
|
+
};
|
|
3812
|
+
/** Product units recorded during the period. */
|
|
3813
|
+
unitsUsed: number;
|
|
3814
|
+
/** Actual money deducted for this feature during the period. */
|
|
3815
|
+
spent: {
|
|
3816
|
+
/** Amount in the currency's smallest unit. */
|
|
3817
|
+
amount: number;
|
|
3818
|
+
/** Lowercase ISO 4217 currency code. */
|
|
3819
|
+
currency: string;
|
|
3820
|
+
};
|
|
3821
|
+
/** Estimated additional units available from the current shared balance at this feature's fixed price. Absent for dynamic pricing. */
|
|
3822
|
+
availableUnits?: number;
|
|
3823
|
+
/** Price for one additional product unit. */
|
|
3824
|
+
unitPrice?: {
|
|
3825
|
+
/** Integer rate amount. Divide by scale to obtain the price. */
|
|
3826
|
+
amount: number;
|
|
3827
|
+
/** Lowercase ISO 4217 currency code. */
|
|
3828
|
+
currency: string;
|
|
3829
|
+
/** Divide amount by scale to obtain the major-unit price. */
|
|
3830
|
+
scale: 10000;
|
|
3831
|
+
};
|
|
3832
|
+
};
|
|
3833
|
+
} | {
|
|
3834
|
+
/** Unique feature code. */
|
|
3835
|
+
code: string;
|
|
3836
|
+
/** Display name of the feature. */
|
|
3837
|
+
name: string;
|
|
3838
|
+
/** Display name for one product unit, or null when not applicable. */
|
|
3839
|
+
unitName: string | null;
|
|
3840
|
+
/** Whether the customer can currently access or consume the feature. */
|
|
3841
|
+
allowed: boolean;
|
|
3842
|
+
type: "seats";
|
|
3843
|
+
usage: {
|
|
3844
|
+
/** Time range used to calculate this feature's consumption. */
|
|
3845
|
+
period: {
|
|
3846
|
+
/**
|
|
3847
|
+
* Inclusive usage period start.
|
|
3848
|
+
* @format date-time
|
|
3849
|
+
*/
|
|
3850
|
+
start: string;
|
|
3851
|
+
/**
|
|
3852
|
+
* Exclusive usage period end.
|
|
3853
|
+
* @format date-time
|
|
3854
|
+
*/
|
|
3855
|
+
end: string;
|
|
3856
|
+
};
|
|
3857
|
+
/** Current units assigned or in use. */
|
|
3858
|
+
unitsUsed: number;
|
|
3859
|
+
/** Units included in the subscription for the period. */
|
|
3860
|
+
includedUnits: number;
|
|
3861
|
+
/** Included units still available. Absent when usage is unlimited. */
|
|
3862
|
+
remainingUnits?: number;
|
|
3863
|
+
/** Whether the feature has no usage limit. */
|
|
3864
|
+
unlimited: boolean;
|
|
3865
|
+
overage: {
|
|
3866
|
+
/** Whether usage above the included amount is allowed and billed. */
|
|
3867
|
+
enabled: boolean;
|
|
3868
|
+
/** Units consumed above the included amount. */
|
|
3869
|
+
units: number;
|
|
3870
|
+
/** Price for one additional product unit. */
|
|
3871
|
+
unitPrice?: {
|
|
3872
|
+
/** Integer rate amount. Divide by scale to obtain the price. */
|
|
3873
|
+
amount: number;
|
|
3874
|
+
/** Lowercase ISO 4217 currency code. */
|
|
3875
|
+
currency: string;
|
|
3876
|
+
/** Divide amount by scale to obtain the major-unit price. */
|
|
3877
|
+
scale: 10000;
|
|
3878
|
+
};
|
|
3879
|
+
};
|
|
3880
|
+
};
|
|
3881
|
+
} | {
|
|
3882
|
+
/** Unique feature code. */
|
|
3883
|
+
code: string;
|
|
3884
|
+
/** Display name of the feature. */
|
|
3885
|
+
name: string;
|
|
3886
|
+
/** Display name for one product unit, or null when not applicable. */
|
|
3887
|
+
unitName: string | null;
|
|
3888
|
+
/** Whether the customer can currently access or consume the feature. */
|
|
3889
|
+
allowed: boolean;
|
|
3890
|
+
type: "quota";
|
|
3891
|
+
usage: {
|
|
3892
|
+
/** Time range used to calculate this feature's consumption. */
|
|
3893
|
+
period: {
|
|
3894
|
+
/**
|
|
3895
|
+
* Inclusive usage period start.
|
|
3896
|
+
* @format date-time
|
|
3897
|
+
*/
|
|
3898
|
+
start: string;
|
|
3899
|
+
/**
|
|
3900
|
+
* Exclusive usage period end.
|
|
3901
|
+
* @format date-time
|
|
3902
|
+
*/
|
|
3903
|
+
end: string;
|
|
3904
|
+
};
|
|
3905
|
+
/** Current units assigned or in use. */
|
|
3906
|
+
unitsUsed: number;
|
|
3907
|
+
/** Units included in the subscription for the period. */
|
|
3908
|
+
includedUnits: number;
|
|
3909
|
+
/** Included units still available. Absent when usage is unlimited. */
|
|
3910
|
+
remainingUnits?: number;
|
|
3911
|
+
/** Whether the feature has no usage limit. */
|
|
3912
|
+
unlimited: boolean;
|
|
3913
|
+
overage: {
|
|
3914
|
+
/** Whether usage above the included amount is allowed and billed. */
|
|
3915
|
+
enabled: boolean;
|
|
3916
|
+
/** Units consumed above the included amount. */
|
|
3917
|
+
units: number;
|
|
3918
|
+
/** Price for one additional product unit. */
|
|
3919
|
+
unitPrice?: {
|
|
3920
|
+
/** Integer rate amount. Divide by scale to obtain the price. */
|
|
3921
|
+
amount: number;
|
|
3922
|
+
/** Lowercase ISO 4217 currency code. */
|
|
3923
|
+
currency: string;
|
|
3924
|
+
/** Divide amount by scale to obtain the major-unit price. */
|
|
3925
|
+
scale: 10000;
|
|
3926
|
+
};
|
|
3927
|
+
};
|
|
3928
|
+
/** Highest quota reached during the period and used for billing. */
|
|
3929
|
+
billedUnits: number;
|
|
3930
|
+
};
|
|
3931
|
+
}>;
|
|
2804
3932
|
/** Summary of seats-type features: code, current, included, remaining, unlimited. */
|
|
2805
3933
|
seats: Array<WebhookSeatSummary>;
|
|
2806
3934
|
/** For credits plans: planCredits, purchasedCredits, totalCredits. Null otherwise. */
|
|
@@ -3140,38 +4268,8 @@ interface WebhookEventDataMap {
|
|
|
3140
4268
|
"payout.failed": PayoutFailedData;
|
|
3141
4269
|
}
|
|
3142
4270
|
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
*/
|
|
3146
|
-
interface WebhookPayload {
|
|
3147
|
-
event: WebhookEvent;
|
|
3148
|
-
timestamp: string;
|
|
3149
|
-
organizationId: string;
|
|
3150
|
-
mode: "live" | "sandbox";
|
|
3151
|
-
apiVersion: string;
|
|
3152
|
-
data: WebhookData;
|
|
3153
|
-
}
|
|
3154
|
-
/**
|
|
3155
|
-
* Webhook data structure (subscription-related fields).
|
|
3156
|
-
*
|
|
3157
|
-
* The `status` field is present on `subscription.*` events. Grant access only
|
|
3158
|
-
* when it is `"active"` or `"trialing"`. `"pending_payment"` means the first
|
|
3159
|
-
* charge has not been confirmed yet — wait for `subscription.activated` before
|
|
3160
|
-
* granting access.
|
|
3161
|
-
*/
|
|
3162
|
-
interface WebhookData {
|
|
3163
|
-
publicId?: string;
|
|
3164
|
-
subscriptionId?: string;
|
|
3165
|
-
customerId?: string;
|
|
3166
|
-
/**
|
|
3167
|
-
* Subscription status. Present on `subscription.*` events.
|
|
3168
|
-
* Grant access when this is `"active"` or `"trialing"`.
|
|
3169
|
-
*/
|
|
3170
|
-
status?: SubscriptionStatus;
|
|
3171
|
-
name?: string;
|
|
3172
|
-
canceledAt?: string;
|
|
3173
|
-
[key: string]: unknown;
|
|
3174
|
-
}
|
|
4271
|
+
type WebhookPayload = WebhookEventPayload;
|
|
4272
|
+
type WebhookData = WebhookPayload["data"];
|
|
3175
4273
|
type WebhookEventHandler<E extends WebhookEvent> = (data: WebhookEventDataMap[E], payload: Extract<WebhookEventPayload, {
|
|
3176
4274
|
event: E;
|
|
3177
4275
|
}>) => void | Promise<void>;
|
|
@@ -3185,83 +4283,74 @@ interface VerifyAndParseParams {
|
|
|
3185
4283
|
signature: string | null;
|
|
3186
4284
|
secret: string;
|
|
3187
4285
|
}
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
isActive: boolean;
|
|
3196
|
-
apiVersion: string | null;
|
|
3197
|
-
createdAt: string;
|
|
3198
|
-
}
|
|
3199
|
-
interface WebhookEndpointCreated extends WebhookEndpoint {
|
|
3200
|
-
secretKey: string;
|
|
3201
|
-
}
|
|
3202
|
-
interface WebhookTestResult {
|
|
3203
|
-
success: boolean;
|
|
3204
|
-
deliveryId: string;
|
|
3205
|
-
deliveredAt: string;
|
|
3206
|
-
}
|
|
3207
|
-
interface ListWebhooksParams {
|
|
3208
|
-
limit?: number;
|
|
3209
|
-
cursor?: string;
|
|
3210
|
-
}
|
|
3211
|
-
interface CreateWebhookParams {
|
|
3212
|
-
url: string;
|
|
3213
|
-
events: string[];
|
|
3214
|
-
description?: string;
|
|
3215
|
-
apiVersion?: string;
|
|
4286
|
+
declare class Webhooks {
|
|
4287
|
+
private readonly eventHandlers;
|
|
4288
|
+
verify(params: VerifyParams): boolean;
|
|
4289
|
+
private generateSignature;
|
|
4290
|
+
verifyAndParse(params: VerifyAndParseParams): WebhookPayload | null;
|
|
4291
|
+
on<E extends WebhookEvent>(event: E, handler: WebhookEventHandler<E>): this;
|
|
4292
|
+
process(params: VerifyAndParseParams): Promise<WebhookPayload | null>;
|
|
3216
4293
|
}
|
|
3217
|
-
|
|
4294
|
+
|
|
4295
|
+
interface GetWebhookEndpointParams {
|
|
3218
4296
|
id: string;
|
|
3219
4297
|
}
|
|
3220
|
-
interface
|
|
4298
|
+
interface UpdateWebhookEndpointParams {
|
|
3221
4299
|
id: string;
|
|
3222
4300
|
url?: string;
|
|
3223
|
-
events?:
|
|
4301
|
+
events?: Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">;
|
|
3224
4302
|
description?: string | null;
|
|
3225
4303
|
isActive?: boolean;
|
|
3226
4304
|
apiVersion?: string;
|
|
3227
4305
|
}
|
|
3228
|
-
interface
|
|
4306
|
+
interface DeleteWebhookEndpointParams {
|
|
3229
4307
|
id: string;
|
|
3230
4308
|
}
|
|
3231
|
-
interface
|
|
4309
|
+
interface TestWebhookEndpointParams {
|
|
3232
4310
|
id: string;
|
|
3233
4311
|
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
4312
|
+
interface ListWebhookEndpointsParams {
|
|
4313
|
+
cursor?: string;
|
|
4314
|
+
limit?: number;
|
|
4315
|
+
}
|
|
4316
|
+
interface CreateWebhookEndpointParams {
|
|
4317
|
+
url: string;
|
|
4318
|
+
events: Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">;
|
|
4319
|
+
description?: string;
|
|
4320
|
+
apiVersion?: string;
|
|
4321
|
+
}
|
|
4322
|
+
declare class GeneratedWebhooksResource extends Webhooks {
|
|
4323
|
+
private httpClient;
|
|
4324
|
+
constructor(httpClient: CommetHTTPClient);
|
|
4325
|
+
/** Retrieve a webhook endpoint by its public ID. */
|
|
4326
|
+
get(params: GetWebhookEndpointParams, options?: RequestOptions): Promise<Webhook>;
|
|
4327
|
+
/** Update a webhook endpoint. Only the provided fields change. */
|
|
4328
|
+
update(params: UpdateWebhookEndpointParams, options?: RequestOptions): Promise<Webhook>;
|
|
4329
|
+
/** Permanently delete a webhook endpoint. */
|
|
4330
|
+
delete(params: DeleteWebhookEndpointParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
4331
|
+
/** Send a test event to a webhook endpoint to verify connectivity. */
|
|
4332
|
+
test(params: TestWebhookEndpointParams, options?: RequestOptions): Promise<WebhookTest>;
|
|
4333
|
+
/** List webhook endpoints with cursor-based pagination. */
|
|
4334
|
+
list(params?: ListWebhookEndpointsParams, options?: RequestOptions): Promise<{
|
|
4335
|
+
object: "list";
|
|
4336
|
+
data: Array<Webhook>;
|
|
4337
|
+
hasMore: boolean;
|
|
4338
|
+
nextCursor?: string;
|
|
4339
|
+
}>;
|
|
4340
|
+
/** Create a new webhook endpoint. The response includes the signing secret which is only returned once. */
|
|
4341
|
+
create(params: CreateWebhookEndpointParams, options?: RequestOptions): Promise<CreatedWebhook>;
|
|
3252
4342
|
}
|
|
3253
4343
|
|
|
3254
4344
|
declare class Commet<_TConfig = unknown> extends GeneratedResources {
|
|
3255
4345
|
private httpClient;
|
|
3256
|
-
readonly
|
|
3257
|
-
readonly webhooks: Webhooks;
|
|
4346
|
+
readonly webhooks: GeneratedWebhooksResource;
|
|
3258
4347
|
constructor(config: CommetClientOptions);
|
|
3259
4348
|
}
|
|
3260
4349
|
declare function createCommet<const TConfig extends BillingConfig>(_billingConfig: TConfig, options: CommetClientOptions): Commet<TConfig>;
|
|
3261
4350
|
|
|
3262
4351
|
declare function registerIntegration(name: string, version: string): void;
|
|
3263
4352
|
|
|
3264
|
-
declare const API_VERSION = "2026-07-
|
|
4353
|
+
declare const API_VERSION = "2026-07-24";
|
|
3265
4354
|
declare const SDK_VERSION: string;
|
|
3266
4355
|
|
|
3267
|
-
export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type
|
|
4356
|
+
export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type BalanceAdjustment, type BalanceDepletedData, type BalanceLowData, type BalanceToppedUpData, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSetSeatsParams, type CancelPaymentParams, type CancelSubscriptionParams, type ChangePlanParams, type ChargePaymentParams, type CheckUsageAvailabilityParams, type CheckoutReadyData, type ClaimLink, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreateMarketGroupParams, type CreateOfferParams, type CreatePaymentParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, type CreateWebhookEndpointParams, type CreatedApiKey, type CreatedSubscription, type CreatedWebhook, type CreditGrant, type CreditPack, type CreditPackListItem, type CreditsDepletedData, type CreditsExpiredData, type CreditsGrantedData, type CreditsLowData, type CreditsPurchasedData, type Customer, type CustomerBatch, type CustomerCreatedData, type CustomerStateChangedData, type CustomerUpdatedData, type DeactivateAddonParams, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeleteMarketGroupParams, type DeleteOfferParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookEndpointParams, type DeletedObject, type DeletedOffer, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DownloadInvoiceParams, type Feature, type FeatureAccess, type FeatureDef, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetFeatureParams, type GetInvoiceParams, type GetMarketGroupParams, type GetOfferParams, type GetPaymentParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookEndpointParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceCreatedData, type InvoiceDownload, type InvoiceListItem, type InvoiceOverdueData, type InvoiceType, type InvoiceUpcomingData, type InvoiceVoidedData, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListOffersParams, type ListPaymentsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhookEndpointsParams, type MarketGroup, type Offer, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethodAttachedData, type PaymentMethodUpdateCheckout, type PaymentMethodUpdatedData, type PaymentProvider, type PaymentReceivedData, type PaymentRecoveredData, type PaymentRefundedData, type PaymentRetryFailedData, type Payout, type PayoutAvailableData, type PayoutBankAccount, type PayoutCreatedData, type PayoutFailedData, type PayoutPaidData, type PayoutVerification, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGroup, type PlanGroupDetail, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PortalAccess, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type QuotaExceededData, type QuotaThresholdReachedData, type ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, type Refund, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatBalanceCollection, type SeatEvent, type SeatsLimitReachedData, type SeatsUpdatedData, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type SetUsageParams, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionPastDueData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionStatus, type SubscriptionSummary, type SubscriptionUpdatedData, type TestClock, type TestClockBilling, type TestWebhookEndpointParams, type Timezone, type TopupBalanceParams, type TrackUsageParams, type Transaction, type TransactionListItem, type TransactionRetry, type TransactionStatus, type TrialCheckoutReadyData, type TrialConvertedData, type TrialExpiredData, type TrialStartedData, type TrialWillEndData, type UncancelSubscriptionParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdateMarketGroupParams, type UpdateOfferParams, type UpdatePaymentMethodParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookEndpointParams, type UpsertRegionalPricesParams, type UsageAdjustment, type UsageCheck, type UsageEvent, type UsageQuota, type UsageQuotaEvent, type UsageRecordedData, type Webhook, type WebhookAddonRef, type WebhookBalance, type WebhookBankRef, type WebhookCardInfo, type WebhookCreditsBalance, type WebhookData, type WebhookEvent, type WebhookEventDataMap, type WebhookEventEnvelope, type WebhookEventHandler, type WebhookEventPayload, type WebhookPayload, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTest, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
|