@commet/node 9.10.0 → 9.11.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/dist/index.d.mts +123 -48
- package/dist/index.d.ts +123 -48
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -11
- package/dist/index.mjs.map +1 -1
- package/docs/api-reference/customers.md +3 -3
- package/docs/api-reference/index.md +1 -1
- package/docs/api-reference/invoices.md +4 -3
- package/docs/api-reference/plans.md +8 -4
- package/docs/api-reference/subscriptions.md +5 -4
- package/docs/api-reference/transactions.md +2 -1
- package/docs/documentation/invoicing/manage-invoices.md +1 -1
- package/docs/documentation/plans/add-ons.md +2 -2
- package/docs/documentation/plans/balance-and-top-ups.md +1 -1
- package/docs/documentation/plans/consumption-models.md +20 -0
- package/docs/documentation/plans/credit-packs.md +4 -2
- package/docs/documentation/plans/plan-versions.md +9 -7
- package/docs/documentation/sales/regional-prices.md +1 -1
- package/docs/documentation/subscriptions/manage-subscriptions.md +1 -1
- package/docs/errors/currency_held_by_balance_plan.md +22 -0
- package/docs/errors/currency_held_by_customer_credit.md +22 -0
- package/docs/errors/currency_held_by_fixed_amount_discount.md +22 -0
- package/docs/errors/currency_held_by_payment_method.md +22 -0
- package/docs/errors/currency_held_by_prepaid_period.md +22 -0
- package/docs/errors/currency_held_by_scheduled_pause.md +22 -0
- package/docs/errors/index.md +7 -1
- package/docs/errors/missing_regional_price.md +3 -3
- package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +1 -1
- package/docs/manifest.json +37 -1
- package/docs/schemas.md +22 -14
- package/docs/webhooks.md +4 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -193,6 +193,8 @@ interface BalanceAdjustment {
|
|
|
193
193
|
}
|
|
194
194
|
interface BalanceTopup {
|
|
195
195
|
amount: number;
|
|
196
|
+
/** `succeeded` when the payment was confirmed and the balance was added. `processing` when the payment method confirms later: the balance is added once the payment is confirmed, and nothing is added if it is declined. */
|
|
197
|
+
status: "succeeded" | "processing";
|
|
196
198
|
object: "balance_topup";
|
|
197
199
|
livemode: boolean;
|
|
198
200
|
}
|
|
@@ -313,6 +315,8 @@ interface CreatedWebhook {
|
|
|
313
315
|
}
|
|
314
316
|
interface CreditGrant {
|
|
315
317
|
credits: number;
|
|
318
|
+
/** `succeeded` when the payment was confirmed and the credits were added. `processing` when the payment method confirms later: the credits are added once the payment is confirmed, and nothing is added if it is declined. */
|
|
319
|
+
status: "succeeded" | "processing";
|
|
316
320
|
object: "credit_grant";
|
|
317
321
|
livemode: boolean;
|
|
318
322
|
}
|
|
@@ -376,6 +380,7 @@ interface CustomerBatch {
|
|
|
376
380
|
email: string;
|
|
377
381
|
fullName?: string | null;
|
|
378
382
|
taxDocument?: string | null;
|
|
383
|
+
businessTaxId?: string;
|
|
379
384
|
timezone?: string;
|
|
380
385
|
metadata?: Record<string, unknown> | null;
|
|
381
386
|
address?: {
|
|
@@ -542,8 +547,10 @@ type FeatureAccess = {
|
|
|
542
547
|
creditsPerUnit: number;
|
|
543
548
|
/** Actual credits deducted by this feature during the period. */
|
|
544
549
|
creditsConsumed: number;
|
|
545
|
-
/**
|
|
546
|
-
|
|
550
|
+
/** Whether the plan credits are unlimited: usage never spends them and only the plan credit limit caps it. */
|
|
551
|
+
unlimited: boolean;
|
|
552
|
+
/** Additional product units available from the current shared credit pool at this feature's conversion rate. Absent when unlimited is true. */
|
|
553
|
+
availableUnits?: number;
|
|
547
554
|
} | {
|
|
548
555
|
/** Product usage deducts money from a shared balance. */
|
|
549
556
|
model: "balance";
|
|
@@ -569,7 +576,9 @@ type FeatureAccess = {
|
|
|
569
576
|
/** Lowercase ISO 4217 currency code. */
|
|
570
577
|
currency: string;
|
|
571
578
|
};
|
|
572
|
-
/**
|
|
579
|
+
/** Whether the plan balance is unlimited: usage never spends it and only the plan balance limit caps it. */
|
|
580
|
+
unlimited: boolean;
|
|
581
|
+
/** Estimated additional units available from the current shared balance at this feature's fixed price. Absent for dynamic pricing and when unlimited is true. */
|
|
573
582
|
availableUnits?: number;
|
|
574
583
|
/** Price for one additional product unit. */
|
|
575
584
|
unitPrice?: {
|
|
@@ -936,6 +945,8 @@ interface Plan {
|
|
|
936
945
|
/** The most plan credits a subscription holds after a reset, including the credits that reset grants; credits above it expire. At least the included credits of every price. null means no limit other than the largest storable balance, 2,147,483,647 plan credits. */
|
|
937
946
|
maxPlanCredits: number | null;
|
|
938
947
|
} | null;
|
|
948
|
+
/** Credits plans only; null for other consumption models. true when the plan credits are unlimited: usage never spends them and only planCreditLimit caps it. */
|
|
949
|
+
unlimitedPlanCredits: boolean | null;
|
|
939
950
|
/** Credits plans only. The most plan credits a subscription spends per day or per week; null means no limit. */
|
|
940
951
|
planCreditLimit: {
|
|
941
952
|
/** The most plan credits a subscription spends in one window. */
|
|
@@ -951,6 +962,8 @@ interface Plan {
|
|
|
951
962
|
/** The most plan balance a subscription holds after a reset, in USD cents, including the balance that reset grants; balance above it expires. At least the included balance of every price. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. null means no limit other than the largest storable amount, 2,147,483,647 cents. */
|
|
952
963
|
maxPlanBalance: number | null;
|
|
953
964
|
} | null;
|
|
965
|
+
/** Balance plans only; null for other consumption models. true when the plan balance is unlimited: usage never spends it and only planBalanceLimit caps it. */
|
|
966
|
+
unlimitedPlanBalance: boolean | null;
|
|
954
967
|
/** Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; null means no limit. */
|
|
955
968
|
planBalanceLimit: {
|
|
956
969
|
/** The most plan balance a subscription spends in one window, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. */
|
|
@@ -1896,6 +1909,8 @@ interface Subscription {
|
|
|
1896
1909
|
label: string;
|
|
1897
1910
|
/** @format date-time */
|
|
1898
1911
|
effectiveAt: string;
|
|
1912
|
+
/** The currency the subscription pays from the move on: its own, or usd when the move charges it in USD. */
|
|
1913
|
+
currency: string;
|
|
1899
1914
|
} | null;
|
|
1900
1915
|
planGrant?: {
|
|
1901
1916
|
/** The active Plan Grant ID. */
|
|
@@ -1964,27 +1979,31 @@ interface Subscription {
|
|
|
1964
1979
|
} | null;
|
|
1965
1980
|
}>;
|
|
1966
1981
|
credits: {
|
|
1967
|
-
/**
|
|
1968
|
-
|
|
1982
|
+
/** true when the plan credits are unlimited: usage never spends them and only the plan credit limit caps it. */
|
|
1983
|
+
unlimited: boolean;
|
|
1984
|
+
/** Plan credits left. Kept for compatibility; equal to `plan`. Omitted when `unlimited` is true. */
|
|
1985
|
+
remaining?: number;
|
|
1969
1986
|
included: number;
|
|
1970
1987
|
/** Purchased credits: purchases and manual adjustments. Spent after plan credits and kept until the subscription ends. */
|
|
1971
1988
|
purchased: number;
|
|
1972
|
-
/** Plan credits left this period. Spent first and replaced or rolled over at each reset; negative while overage is owed. */
|
|
1973
|
-
plan
|
|
1974
|
-
/** Credits available: `plan` plus `purchased`. */
|
|
1975
|
-
total
|
|
1989
|
+
/** Plan credits left this period. Spent first and replaced or rolled over at each reset; negative while overage is owed. Omitted when `unlimited` is true. */
|
|
1990
|
+
plan?: number;
|
|
1991
|
+
/** Credits available: `plan` plus `purchased`. Omitted when `unlimited` is true. */
|
|
1992
|
+
total?: number;
|
|
1976
1993
|
} | null;
|
|
1977
1994
|
balance: {
|
|
1978
|
-
/**
|
|
1979
|
-
|
|
1995
|
+
/** true when the plan balance is unlimited: usage never spends it and only the plan balance limit caps it. */
|
|
1996
|
+
unlimited: boolean;
|
|
1997
|
+
/** Balance available in minor units of the subscription currency. Kept for compatibility; equal to `total`. Omitted when `unlimited` is true. */
|
|
1998
|
+
remaining?: number;
|
|
1980
1999
|
included: number;
|
|
1981
2000
|
currency: string;
|
|
1982
|
-
/** Plan balance left this period, in minor units. Spent first and replaced or rolled over at each reset; negative while overage is owed. */
|
|
1983
|
-
plan
|
|
2001
|
+
/** Plan balance left this period, in minor units. Spent first and replaced or rolled over at each reset; negative while overage is owed. Omitted when `unlimited` is true. */
|
|
2002
|
+
plan?: number;
|
|
1984
2003
|
/** Purchased balance in minor units: top-ups and manual adjustments. Spent after the plan balance and kept until the subscription ends. */
|
|
1985
2004
|
purchased: number;
|
|
1986
|
-
/** Balance available in minor units: `plan` plus `purchased`. */
|
|
1987
|
-
total
|
|
2005
|
+
/** Balance available in minor units: `plan` plus `purchased`. Omitted when `unlimited` is true. */
|
|
2006
|
+
total?: number;
|
|
1988
2007
|
} | null;
|
|
1989
2008
|
priceId: string | null;
|
|
1990
2009
|
object: "subscription";
|
|
@@ -1992,7 +2011,8 @@ interface Subscription {
|
|
|
1992
2011
|
}
|
|
1993
2012
|
interface SubscriptionAddon {
|
|
1994
2013
|
addonId: string;
|
|
1995
|
-
|
|
2014
|
+
/** `active` when the add-on is active. `processing` when the payment method confirms later: the add-on is activated once the payment is confirmed, and stays inactive if it is declined. */
|
|
2015
|
+
status: "active" | "processing";
|
|
1996
2016
|
proratedCharge: number;
|
|
1997
2017
|
object: "subscription_addon";
|
|
1998
2018
|
livemode: boolean;
|
|
@@ -2246,6 +2266,8 @@ interface Transaction {
|
|
|
2246
2266
|
taxAmount: number | null;
|
|
2247
2267
|
/** 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. */
|
|
2248
2268
|
presentmentAmount: number | null;
|
|
2269
|
+
/** Cumulative confirmed refunds in the payment currency’s smallest unit. */
|
|
2270
|
+
amountRefunded: number;
|
|
2249
2271
|
currency: string;
|
|
2250
2272
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. */
|
|
2251
2273
|
provider: PaymentProvider;
|
|
@@ -2291,6 +2313,8 @@ interface TransactionListItem {
|
|
|
2291
2313
|
taxAmount: number | null;
|
|
2292
2314
|
/** 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. */
|
|
2293
2315
|
presentmentAmount: number | null;
|
|
2316
|
+
/** Cumulative confirmed refunds in the payment currency’s smallest unit. */
|
|
2317
|
+
amountRefunded: number;
|
|
2294
2318
|
currency: string;
|
|
2295
2319
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. */
|
|
2296
2320
|
provider: PaymentProvider;
|
|
@@ -2357,9 +2381,13 @@ type UsageCheck = {
|
|
|
2357
2381
|
consumptionModel: "credits";
|
|
2358
2382
|
creditsPerUnit: number;
|
|
2359
2383
|
estimatedCredits: number;
|
|
2360
|
-
|
|
2384
|
+
/** true when the plan credits are unlimited: usage never spends them and only planCreditLimit caps it. */
|
|
2385
|
+
unlimited: boolean;
|
|
2386
|
+
/** Plan credits left. Omitted when unlimited is true. */
|
|
2387
|
+
planCredits?: number;
|
|
2361
2388
|
purchasedCredits: number;
|
|
2362
|
-
|
|
2389
|
+
/** planCredits plus purchasedCredits. Omitted when unlimited is true. */
|
|
2390
|
+
totalCredits?: number;
|
|
2363
2391
|
planCreditLimit: {
|
|
2364
2392
|
/** The most plan credits the subscription spends per window. */
|
|
2365
2393
|
credits: number;
|
|
@@ -2389,14 +2417,16 @@ type UsageCheck = {
|
|
|
2389
2417
|
consumptionModel: "balance";
|
|
2390
2418
|
unitPrice: number;
|
|
2391
2419
|
estimatedAmount: number;
|
|
2392
|
-
/**
|
|
2393
|
-
|
|
2394
|
-
/** The
|
|
2395
|
-
|
|
2420
|
+
/** true when the plan balance is unlimited: usage never spends it and only planBalanceLimit caps it. */
|
|
2421
|
+
unlimited: boolean;
|
|
2422
|
+
/** The available balance, plan plus purchased, in rate scale (10000 = 1.00 of the subscription currency). Equal to totalBalance. Omitted when unlimited is true. */
|
|
2423
|
+
currentBalance?: number;
|
|
2424
|
+
/** The plan part of the balance in rate scale. Consumed first, replaced or rolled over at each reset, and negative while overage is owed. Omitted when unlimited is true. */
|
|
2425
|
+
planBalance?: number;
|
|
2396
2426
|
/** The purchased part of the balance in rate scale: top-ups and adjustments. Consumed after the plan part and kept until the subscription ends. */
|
|
2397
2427
|
purchasedBalance: number;
|
|
2398
|
-
/** planBalance plus purchasedBalance, in rate scale. */
|
|
2399
|
-
totalBalance
|
|
2428
|
+
/** planBalance plus purchasedBalance, in rate scale. Omitted when unlimited is true. */
|
|
2429
|
+
totalBalance?: number;
|
|
2400
2430
|
planBalanceLimit: {
|
|
2401
2431
|
/** The most plan balance the subscription spends per window, in rate scale (10000 = 1.00 of the subscription currency). */
|
|
2402
2432
|
amount: number;
|
|
@@ -2434,7 +2464,10 @@ interface UsageEvent {
|
|
|
2434
2464
|
consumption?: {
|
|
2435
2465
|
model: "credits" | "balance";
|
|
2436
2466
|
deducted: number;
|
|
2437
|
-
|
|
2467
|
+
/** true when the plan credits or plan balance are unlimited: usage never spends them and only the plan limit caps it. */
|
|
2468
|
+
unlimited: boolean;
|
|
2469
|
+
/** Plan plus purchased amount left after this event. Omitted when unlimited is true. */
|
|
2470
|
+
remaining?: number;
|
|
2438
2471
|
blocked: boolean;
|
|
2439
2472
|
/** Credits consumption only, omitted for balance. The plan credit limit after this event; null when the plan has no limit. */
|
|
2440
2473
|
planCreditLimit?: {
|
|
@@ -2514,14 +2547,16 @@ interface WebhookAddonRef {
|
|
|
2514
2547
|
name: string;
|
|
2515
2548
|
}
|
|
2516
2549
|
interface WebhookBalance {
|
|
2517
|
-
/**
|
|
2518
|
-
|
|
2519
|
-
/** The plan
|
|
2520
|
-
|
|
2550
|
+
/** true when the plan balance is unlimited: usage never spends it and only the plan balance limit caps it. */
|
|
2551
|
+
unlimited: boolean;
|
|
2552
|
+
/** The available balance, plan plus purchased, in rate scale. Equal to totalBalance. Omitted when unlimited is true. */
|
|
2553
|
+
currentBalance?: number;
|
|
2554
|
+
/** The plan part in rate scale: spent first, replaced or rolled over at each reset, negative while overage is owed. Omitted when unlimited is true. */
|
|
2555
|
+
planBalance?: number;
|
|
2521
2556
|
/** The purchased part in rate scale: top-ups and manual adjustments, spent after the plan part and kept until the subscription ends. */
|
|
2522
2557
|
purchasedBalance: number;
|
|
2523
|
-
/** planBalance plus purchasedBalance, in rate scale. */
|
|
2524
|
-
totalBalance
|
|
2558
|
+
/** planBalance plus purchasedBalance, in rate scale. Omitted when unlimited is true. */
|
|
2559
|
+
totalBalance?: number;
|
|
2525
2560
|
}
|
|
2526
2561
|
interface WebhookBankRef {
|
|
2527
2562
|
bankName: string | null;
|
|
@@ -2534,9 +2569,13 @@ interface WebhookCardInfo {
|
|
|
2534
2569
|
expYear: number;
|
|
2535
2570
|
}
|
|
2536
2571
|
interface WebhookCreditsBalance {
|
|
2537
|
-
|
|
2572
|
+
/** true when the plan credits are unlimited: usage never spends them and only the plan credit limit caps it. */
|
|
2573
|
+
unlimited: boolean;
|
|
2574
|
+
/** Plan credits left. Omitted when unlimited is true. */
|
|
2575
|
+
planCredits?: number;
|
|
2538
2576
|
purchasedCredits: number;
|
|
2539
|
-
|
|
2577
|
+
/** planCredits plus purchasedCredits. Omitted when unlimited is true. */
|
|
2578
|
+
totalCredits?: number;
|
|
2540
2579
|
}
|
|
2541
2580
|
interface WebhookPlanGrantTimelineEvent {
|
|
2542
2581
|
/** The public ID of this plan grant event. */
|
|
@@ -2861,7 +2900,7 @@ interface UpdateCustomerParams {
|
|
|
2861
2900
|
email?: string;
|
|
2862
2901
|
fullName?: string;
|
|
2863
2902
|
taxDocument?: string;
|
|
2864
|
-
/** Business tax ID, such as an EU VAT number
|
|
2903
|
+
/** Business tax ID, such as an EU VAT number, a Peruvian RUC or an Argentine CUIT, for the country of the customer's address; its type comes from that country. Where Commet collects tax and that ID exempts business buyers, a valid ID replaces consumer tax with the business treatment; elsewhere it is stored as sent and does not change any charge. Send null to remove it. */
|
|
2865
2904
|
businessTaxId?: string | null;
|
|
2866
2905
|
externalId?: string;
|
|
2867
2906
|
timezone?: Timezone;
|
|
@@ -2883,6 +2922,8 @@ interface BatchCreateCustomersParams {
|
|
|
2883
2922
|
externalId?: string;
|
|
2884
2923
|
fullName?: string;
|
|
2885
2924
|
taxDocument?: string;
|
|
2925
|
+
/** Business tax ID, such as an EU VAT number, a Peruvian RUC or an Argentine CUIT, for the country of the customer's address; its type comes from that country. Where Commet collects tax and that ID exempts business buyers, a valid ID replaces consumer tax with the business treatment; elsewhere it is stored as sent and does not change any charge. */
|
|
2926
|
+
businessTaxId?: string;
|
|
2886
2927
|
timezone?: Timezone;
|
|
2887
2928
|
metadata?: Record<string, unknown>;
|
|
2888
2929
|
address?: {
|
|
@@ -2908,7 +2949,7 @@ interface CreateCustomerParams {
|
|
|
2908
2949
|
externalId?: string;
|
|
2909
2950
|
fullName?: string;
|
|
2910
2951
|
taxDocument?: string;
|
|
2911
|
-
/** Business tax ID, such as an EU VAT number
|
|
2952
|
+
/** Business tax ID, such as an EU VAT number, a Peruvian RUC or an Argentine CUIT, for the country of the customer's address; its type comes from that country. Where Commet collects tax and that ID exempts business buyers, a valid ID replaces consumer tax with the business treatment; elsewhere it is stored as sent and does not change any charge. */
|
|
2912
2953
|
businessTaxId?: string;
|
|
2913
2954
|
address?: {
|
|
2914
2955
|
line1: string;
|
|
@@ -3041,7 +3082,6 @@ interface SendInvoiceParams {
|
|
|
3041
3082
|
}
|
|
3042
3083
|
interface UpdateInvoiceStatusParams {
|
|
3043
3084
|
id: string;
|
|
3044
|
-
status: "paid" | "void";
|
|
3045
3085
|
}
|
|
3046
3086
|
interface ListInvoicesParams {
|
|
3047
3087
|
cursor?: string;
|
|
@@ -3065,8 +3105,11 @@ declare class InvoicesResource {
|
|
|
3065
3105
|
get(params: GetInvoiceParams, options?: RequestOptions): Promise<Invoice>;
|
|
3066
3106
|
/** Send the invoice to the customer via email. */
|
|
3067
3107
|
send(params: SendInvoiceParams, options?: RequestOptions): Promise<SentInvoice>;
|
|
3068
|
-
/**
|
|
3069
|
-
|
|
3108
|
+
/**
|
|
3109
|
+
* Deprecated. No longer changes the invoice. An invoice is paid when its charge settles: to collect a past-due subscription, reactivate it or send the customer a recovery link.
|
|
3110
|
+
* @deprecated
|
|
3111
|
+
*/
|
|
3112
|
+
updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<void>;
|
|
3070
3113
|
/** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
|
|
3071
3114
|
list(params?: ListInvoicesParams, options?: RequestOptions): Promise<{
|
|
3072
3115
|
object: "list";
|
|
@@ -3365,6 +3408,8 @@ type PublishPlanDraftParams = {
|
|
|
3365
3408
|
seatLimit?: true;
|
|
3366
3409
|
/** Add-ons it stops paying at renewal. */
|
|
3367
3410
|
removeAddonIds?: Array<string>;
|
|
3411
|
+
/** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
|
|
3412
|
+
currency?: string;
|
|
3368
3413
|
}>;
|
|
3369
3414
|
/** Check everything without publishing. */
|
|
3370
3415
|
preview?: boolean;
|
|
@@ -3394,6 +3439,8 @@ type PublishPlanDraftParams = {
|
|
|
3394
3439
|
seatLimit?: true;
|
|
3395
3440
|
/** Add-ons it stops paying at renewal. */
|
|
3396
3441
|
removeAddonIds?: Array<string>;
|
|
3442
|
+
/** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
|
|
3443
|
+
currency?: string;
|
|
3397
3444
|
}>;
|
|
3398
3445
|
/** Check everything without publishing. */
|
|
3399
3446
|
preview?: boolean;
|
|
@@ -3472,10 +3519,14 @@ interface UpdatePlanDraftParams {
|
|
|
3472
3519
|
freeIncludedBalance?: number | null;
|
|
3473
3520
|
unusedPlanCredits?: "expire" | "roll_over";
|
|
3474
3521
|
maxPlanCredits?: number | null;
|
|
3522
|
+
/** Credits plans only. true makes the plan credits unlimited: usage never spends them, only planCreditLimit caps it, and every price and the free plan include 0 credits. */
|
|
3523
|
+
unlimitedPlanCredits?: boolean;
|
|
3475
3524
|
planCreditLimit?: number | null;
|
|
3476
3525
|
planCreditLimitInterval?: "day" | "week" | null;
|
|
3477
3526
|
unusedPlanBalance?: "expire" | "roll_over";
|
|
3478
3527
|
maxPlanBalance?: number | null;
|
|
3528
|
+
/** Balance plans only. true makes the plan balance unlimited: usage never spends it, only planBalanceLimit caps it, and every price, country and the free plan include no balance. */
|
|
3529
|
+
unlimitedPlanBalance?: boolean;
|
|
3479
3530
|
planBalanceLimit?: number | null;
|
|
3480
3531
|
planBalanceLimitInterval?: "day" | "week" | null;
|
|
3481
3532
|
blockOnExhaustion?: boolean;
|
|
@@ -3514,6 +3565,8 @@ interface ArchivePlanExperimentParams {
|
|
|
3514
3565
|
seatLimit?: true;
|
|
3515
3566
|
/** Add-ons it stops paying at renewal. */
|
|
3516
3567
|
removeAddonIds?: Array<string>;
|
|
3568
|
+
/** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
|
|
3569
|
+
currency?: string;
|
|
3517
3570
|
}>;
|
|
3518
3571
|
/** Check the archive and the move without changing anything. */
|
|
3519
3572
|
preview?: boolean;
|
|
@@ -3648,6 +3701,8 @@ type CreatePlanMoveParams = {
|
|
|
3648
3701
|
seatLimit?: true;
|
|
3649
3702
|
/** Add-ons it stops paying at renewal. */
|
|
3650
3703
|
removeAddonIds?: Array<string>;
|
|
3704
|
+
/** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
|
|
3705
|
+
currency?: string;
|
|
3651
3706
|
}>;
|
|
3652
3707
|
/** Check every subscriber without moving anyone. */
|
|
3653
3708
|
preview?: boolean;
|
|
@@ -3669,6 +3724,8 @@ type CreatePlanMoveParams = {
|
|
|
3669
3724
|
seatLimit?: true;
|
|
3670
3725
|
/** Add-ons it stops paying at renewal. */
|
|
3671
3726
|
removeAddonIds?: Array<string>;
|
|
3727
|
+
/** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
|
|
3728
|
+
currency?: string;
|
|
3672
3729
|
}>;
|
|
3673
3730
|
/** Check every subscriber without moving anyone. */
|
|
3674
3731
|
preview?: boolean;
|
|
@@ -3783,6 +3840,8 @@ interface UpdatePlanParams {
|
|
|
3783
3840
|
/** The most plan credits a subscription holds after a reset, including the credits that reset grants; credits above it expire. At least the included credits of every price. null means no limit other than the largest storable balance, 2,147,483,647 plan credits. */
|
|
3784
3841
|
maxPlanCredits: number | null;
|
|
3785
3842
|
};
|
|
3843
|
+
/** Credits plans only. true makes the plan credits unlimited: usage never spends them, only planCreditLimit caps it, and every price includes 0 credits. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
|
|
3844
|
+
unlimitedPlanCredits?: boolean;
|
|
3786
3845
|
/** Credits plans only. The most plan credits a subscription spends per day or per week; null removes the limit. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
|
|
3787
3846
|
planCreditLimit?: {
|
|
3788
3847
|
/** The most plan credits a subscription spends in one window. */
|
|
@@ -3798,6 +3857,8 @@ interface UpdatePlanParams {
|
|
|
3798
3857
|
/** The most plan balance a subscription holds after a reset, in USD cents, including the balance that reset grants; balance above it expires. At least the included balance of every price. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. null means no limit other than the largest storable amount, 2,147,483,647 cents. */
|
|
3799
3858
|
maxPlanBalance: number | null;
|
|
3800
3859
|
};
|
|
3860
|
+
/** Balance plans only. true makes the plan balance unlimited: usage never spends it, only planBalanceLimit caps it, and every price and country includes no balance. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
|
|
3861
|
+
unlimitedPlanBalance?: boolean;
|
|
3801
3862
|
/** Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; null removes the limit. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
|
|
3802
3863
|
planBalanceLimit?: {
|
|
3803
3864
|
/** The most plan balance a subscription spends in one window, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. */
|
|
@@ -3877,6 +3938,8 @@ interface CreatePlanParams {
|
|
|
3877
3938
|
/** The most plan credits a subscription holds after a reset, including the credits that reset grants; credits above it expire. At least the included credits of every price. null means no limit other than the largest storable balance, 2,147,483,647 plan credits. */
|
|
3878
3939
|
maxPlanCredits: number | null;
|
|
3879
3940
|
};
|
|
3941
|
+
/** Credits plans only. true makes the plan credits unlimited: usage never spends them, only planCreditLimit caps it, and every price includes 0 credits. Omitted means false. */
|
|
3942
|
+
unlimitedPlanCredits?: boolean;
|
|
3880
3943
|
/** Credits plans only. The most plan credits a subscription spends per day or per week; omitted or null means no limit. */
|
|
3881
3944
|
planCreditLimit?: {
|
|
3882
3945
|
/** The most plan credits a subscription spends in one window. */
|
|
@@ -3892,6 +3955,8 @@ interface CreatePlanParams {
|
|
|
3892
3955
|
/** The most plan balance a subscription holds after a reset, in USD cents, including the balance that reset grants; balance above it expires. At least the included balance of every price. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. null means no limit other than the largest storable amount, 2,147,483,647 cents. */
|
|
3893
3956
|
maxPlanBalance: number | null;
|
|
3894
3957
|
};
|
|
3958
|
+
/** Balance plans only. true makes the plan balance unlimited: usage never spends it, only planBalanceLimit caps it, and every price and country includes no balance. Omitted means false. */
|
|
3959
|
+
unlimitedPlanBalance?: boolean;
|
|
3895
3960
|
/** Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; omitted or null means no limit. */
|
|
3896
3961
|
planBalanceLimit?: {
|
|
3897
3962
|
/** The most plan balance a subscription spends in one window, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. */
|
|
@@ -4245,6 +4310,8 @@ interface ChangeSubscriptionVersionParams {
|
|
|
4245
4310
|
planVersionId: string;
|
|
4246
4311
|
/** now changes features, limits and the included credits or balance at once (the included difference is added to or subtracted from the plan credits or plan balance: an increase first pays any plan-part debt, a decrease never creates new debt, and purchased credits and purchased balance are untouched) and charges the new price from the next renewal. period_end changes everything at the next renewal. There is never a proration charge or refund. */
|
|
4247
4312
|
effective: "now" | "period_end";
|
|
4313
|
+
/** usd to charge the subscription in USD from its next renewal when the version does not sell the currency it pays, or the USD price of its country: it pays the version's USD price for its country, or the USD base price. The whole move then happens at that renewal, even with effective now. Rejected with missing_regional_price when the version still sells what the subscription pays or for another currency, and with a currency_held_by code naming what keeps it in its currency: currency_held_by_payment_method (it pays through dLocal), currency_held_by_customer_credit, currency_held_by_balance_plan, currency_held_by_fixed_amount_discount, currency_held_by_prepaid_period or currency_held_by_scheduled_pause. */
|
|
4314
|
+
currency?: string;
|
|
4248
4315
|
}
|
|
4249
4316
|
type PurchaseCreditsParams = {
|
|
4250
4317
|
id: string;
|
|
@@ -4498,7 +4565,7 @@ declare class SubscriptionsResource {
|
|
|
4498
4565
|
constructor(httpClient: CommetHTTPClient);
|
|
4499
4566
|
/** Deactivate an add-on from a subscription. */
|
|
4500
4567
|
deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<DeletedSubscriptionAddon>;
|
|
4501
|
-
/** Activate an add-on on a subscription.
|
|
4568
|
+
/** Activate an add-on on a subscription. Creates the activation invoice and charges a prorated amount for the current billing period; the add-on is active once the payment is confirmed. Rejected with 409 while the add-on is active or an activation of it is still processing. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable. */
|
|
4502
4569
|
activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<SubscriptionAddon>;
|
|
4503
4570
|
/** Read whether the subscription tops up automatically with its saved payment method when its available credits or balance reach a threshold, with the top-ups used this period and the last failure. */
|
|
4504
4571
|
getAutoTopUp(params: GetSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
@@ -4506,15 +4573,15 @@ declare class SubscriptionsResource {
|
|
|
4506
4573
|
updateAutoTopUp(params: UpdateSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
4507
4574
|
/** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
|
|
4508
4575
|
adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<BalanceAdjustment>;
|
|
4509
|
-
/** Top up a balance subscription.
|
|
4576
|
+
/** Top up a balance subscription. Creates the top-up invoice and charges the customer's payment method for the amount plus tax. Once the payment is confirmed, adds the amount to the subscription's purchased balance (after paying back any overage owed on the plan balance), marks the invoice paid and emits `balance.topped_up`. Purchased balance is spent after the plan balance and is kept until the subscription ends. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge. */
|
|
4510
4577
|
topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<BalanceTopup>;
|
|
4511
4578
|
/** Cancel immediately or at period end and return the updated subscription. */
|
|
4512
4579
|
cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
4513
4580
|
/** Upgrade or change billing interval immediately, optionally applying an Offer by offerId or the Offer of a promoCode. Scheduled changes accept neither offerId nor promoCode. From a free plan, a promoCode opens the checkout with the code applied and counts its use when the checkout is paid; without offerId or promoCode, a destination price whose free trial requires no payment method starts that trial right away without checkout. During a trial without a payment method, an immediate change returns 409 no_payment_method; scheduled changes still apply. */
|
|
4514
4581
|
changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<PlanChange>;
|
|
4515
|
-
/** Move a subscription to a newer published version of its plan, now or at the end of the period, without proration; an older version is rejected with version_not_newer, and a subscription on a running experiment moves only to a later version of that experiment. The subscription keeps its currency and its price: a destination that does not sell its currency is rejected with missing_regional_price, and one that does not sell the price it pays with price_not_found. A free version moves only to a free version and a paid one only to a paid one (validation_error). A subscription whose usage does not fit the destination, or with an active add-on the destination does not sell, is not moved either, and the error says why. Each change is recorded as a move of this one subscription in the plan's moves. Repeating the same request changes nothing; a new one replaces the pending move. */
|
|
4582
|
+
/** Move a subscription to a newer published version of its plan, now or at the end of the period, without proration; an older version is rejected with version_not_newer, and a subscription on a running experiment moves only to a later version of that experiment. The subscription keeps its currency and its price: a destination that does not sell its currency is rejected with missing_regional_price unless currency asks to charge it in USD from its renewal, and one that does not sell the price it pays with price_not_found. A free version moves only to a free version and a paid one only to a paid one (validation_error). A subscription whose usage does not fit the destination, or with an active add-on the destination does not sell, is not moved either, and the error says why. Each change is recorded as a move of this one subscription in the plan's moves. Repeating the same request changes nothing; a new one replaces the pending move. */
|
|
4516
4583
|
changeVersion(params: ChangeSubscriptionVersionParams, options?: RequestOptions): Promise<Subscription>;
|
|
4517
|
-
/** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum.
|
|
4584
|
+
/** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Creates the purchase invoice, charges the saved payment method and adds the purchased credits once the payment is confirmed. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
|
|
4518
4585
|
purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
|
|
4519
4586
|
/** Apply a direct Offer to a subscription. On a pending checkout it quotes or replaces the checkout discount, which starts after the plan price trial when there is one, and the existing checkout URL remains unchanged. On an active subscription it applies the Offer immediately with its discount phases starting at the next billing cycle; the call is rejected while another applied Offer still has active or upcoming discount phases. */
|
|
4520
4587
|
applyOffer(params: ApplySubscriptionOfferParams, options?: RequestOptions): Promise<Subscription>;
|
|
@@ -4581,6 +4648,8 @@ declare class TestClockResource {
|
|
|
4581
4648
|
|
|
4582
4649
|
interface RefundTransactionParams {
|
|
4583
4650
|
id: string;
|
|
4651
|
+
/** Amount returned to the customer, including tax, in the payment currency’s smallest unit. Omit to refund the remainder. */
|
|
4652
|
+
amount?: number;
|
|
4584
4653
|
}
|
|
4585
4654
|
interface RetryTransactionParams {
|
|
4586
4655
|
id: string;
|
|
@@ -4597,7 +4666,7 @@ interface ListTransactionsParams {
|
|
|
4597
4666
|
declare class TransactionsResource {
|
|
4598
4667
|
private httpClient;
|
|
4599
4668
|
constructor(httpClient: CommetHTTPClient);
|
|
4600
|
-
/**
|
|
4669
|
+
/** Refund a positive amount in the payment currency’s smallest unit, or omit amount to refund the remaining amount. Returns the refund resource with its actual status. */
|
|
4601
4670
|
refund(params: RefundTransactionParams, options?: RequestOptions): Promise<Refund>;
|
|
4602
4671
|
/** Retry a failed subscription renewal and return an honest retry result. The original failed transaction remains immutable. */
|
|
4603
4672
|
retry(params: RetryTransactionParams, options?: RequestOptions): Promise<TransactionRetry>;
|
|
@@ -4990,7 +5059,7 @@ interface SubscriptionVersionChangeCanceledData {
|
|
|
4990
5059
|
customerId: string;
|
|
4991
5060
|
/** The version the subscription was going to move to. */
|
|
4992
5061
|
toVersionId: string;
|
|
4993
|
-
/** Why the move was canceled: canceled_by_merchant, version_change_failed when the move could not be applied at renewal,
|
|
5062
|
+
/** Why the move was canceled: canceled_by_merchant, version_change_failed when the move could not be applied at renewal, the code of what the subscription no longer fits (addon_unavailable, seat_limit_exceeded, price_not_found, missing_regional_price), or, for a move that charges it in USD, what keeps it in its currency (currency_held_by_payment_method, currency_held_by_customer_credit, currency_held_by_balance_plan, currency_held_by_fixed_amount_discount, currency_held_by_prepaid_period, currency_held_by_scheduled_pause). */
|
|
4994
5063
|
reason: string;
|
|
4995
5064
|
}
|
|
4996
5065
|
/** Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. past_due is a grace window, not a cutoff: usage and seats keep working while new purchases are blocked, and dunning retries the charge — use this to notify the customer and recover the payment. */
|
|
@@ -5230,6 +5299,8 @@ interface PaymentRefundedData {
|
|
|
5230
5299
|
customerId: string | null;
|
|
5231
5300
|
/** The subscription ID, if the invoice is linked to a subscription. */
|
|
5232
5301
|
subscriptionId: string | null;
|
|
5302
|
+
/** Cumulative confirmed refunds in the payment currency’s smallest unit. */
|
|
5303
|
+
amountRefunded: number;
|
|
5233
5304
|
/** The refunded amount in cents (100 = $1.00). */
|
|
5234
5305
|
refundAmount: number;
|
|
5235
5306
|
/** The refund currency code. */
|
|
@@ -5420,7 +5491,7 @@ interface InvoiceCreatedData {
|
|
|
5420
5491
|
/** The subscription ID, if the invoice is linked to a subscription. */
|
|
5421
5492
|
subscriptionId: string | null;
|
|
5422
5493
|
}
|
|
5423
|
-
/** Fired when an invoice is voided — nullified before collection,
|
|
5494
|
+
/** Fired when an invoice is voided — nullified before collection, for example when its subscription is canceled. Voiding is terminal: a void invoice is never retried or collected. */
|
|
5424
5495
|
interface InvoiceVoidedData {
|
|
5425
5496
|
/** The invoice ID. */
|
|
5426
5497
|
invoiceId: string;
|
|
@@ -5686,8 +5757,10 @@ interface CustomerStateChangedData {
|
|
|
5686
5757
|
creditsPerUnit: number;
|
|
5687
5758
|
/** Actual credits deducted by this feature during the period. */
|
|
5688
5759
|
creditsConsumed: number;
|
|
5689
|
-
/**
|
|
5690
|
-
|
|
5760
|
+
/** Whether the plan credits are unlimited: usage never spends them and only the plan credit limit caps it. */
|
|
5761
|
+
unlimited: boolean;
|
|
5762
|
+
/** Additional product units available from the current shared credit pool at this feature's conversion rate. Absent when unlimited is true. */
|
|
5763
|
+
availableUnits?: number;
|
|
5691
5764
|
} | {
|
|
5692
5765
|
/** Product usage deducts money from a shared balance. */
|
|
5693
5766
|
model: "balance";
|
|
@@ -5713,7 +5786,9 @@ interface CustomerStateChangedData {
|
|
|
5713
5786
|
/** Lowercase ISO 4217 currency code. */
|
|
5714
5787
|
currency: string;
|
|
5715
5788
|
};
|
|
5716
|
-
/**
|
|
5789
|
+
/** Whether the plan balance is unlimited: usage never spends it and only the plan balance limit caps it. */
|
|
5790
|
+
unlimited: boolean;
|
|
5791
|
+
/** Estimated additional units available from the current shared balance at this feature's fixed price. Absent for dynamic pricing and when unlimited is true. */
|
|
5717
5792
|
availableUnits?: number;
|
|
5718
5793
|
/** Price for one additional product unit. */
|
|
5719
5794
|
unitPrice?: {
|