@commet/node 9.7.0 → 9.8.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 +208 -40
- package/dist/index.d.ts +208 -40
- package/dist/index.js +37 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -10
- package/dist/index.mjs.map +1 -1
- package/docs/ai-onboarding/mcp-server.md +1 -1
- package/docs/api-reference/customers.md +4 -2
- package/docs/api-reference/index.md +2 -2
- package/docs/api-reference/offers.md +2 -2
- package/docs/api-reference/plans.md +9 -1
- package/docs/api-reference/promo-codes.md +3 -1
- package/docs/api-reference/subscriptions.md +80 -7
- package/docs/api-reference/usage.md +0 -4
- package/docs/errors/customer_deleted.md +22 -0
- package/docs/errors/index.md +4 -0
- package/docs/errors/managed_by_integration.md +22 -0
- package/docs/errors/no_scheduled_plan_change.md +22 -0
- package/docs/errors/plan_credit_limit_reached.md +22 -0
- package/docs/manifest.json +43 -1
- package/docs/schemas.md +33 -4
- package/docs/webhooks.md +11 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -254,6 +254,8 @@ interface CreatedSubscription {
|
|
|
254
254
|
billingDayOfMonth: number | null;
|
|
255
255
|
nextBillingDate: string | null;
|
|
256
256
|
checkoutUrl: string | null;
|
|
257
|
+
/** Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false. */
|
|
258
|
+
hasPaymentMethod: boolean;
|
|
257
259
|
/** @format date-time */
|
|
258
260
|
createdAt: string;
|
|
259
261
|
/** @format date-time */
|
|
@@ -761,6 +763,7 @@ interface InvoiceListItem {
|
|
|
761
763
|
object: "invoice";
|
|
762
764
|
livemode: boolean;
|
|
763
765
|
}
|
|
766
|
+
type ManagedBy = "dub" | null;
|
|
764
767
|
interface Market {
|
|
765
768
|
id: string;
|
|
766
769
|
name: string;
|
|
@@ -777,9 +780,6 @@ interface Offer {
|
|
|
777
780
|
id: string;
|
|
778
781
|
name: string;
|
|
779
782
|
phases: Array<{
|
|
780
|
-
type: "free_trial";
|
|
781
|
-
durationDays: number;
|
|
782
|
-
} | {
|
|
783
783
|
type: "percentage";
|
|
784
784
|
durationCycles: number | null;
|
|
785
785
|
/** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
|
|
@@ -811,6 +811,8 @@ interface Offer {
|
|
|
811
811
|
startsAt: string | null;
|
|
812
812
|
endsAt: string | null;
|
|
813
813
|
active: boolean;
|
|
814
|
+
/** Integration that manages this record, or null when the merchant does. While an integration manages it, its terms change only in that integration and edits answer 409 managed_by_integration. */
|
|
815
|
+
managedBy: ManagedBy;
|
|
814
816
|
/** @format date-time */
|
|
815
817
|
createdAt: string;
|
|
816
818
|
/** @format date-time */
|
|
@@ -900,6 +902,21 @@ interface Plan {
|
|
|
900
902
|
isDefault: boolean;
|
|
901
903
|
isFree: boolean;
|
|
902
904
|
blockOnExhaustion: boolean | null;
|
|
905
|
+
/** Credits plans only; null for other consumption models. What happens to unused plan credits at each reset. Purchased credits never expire and never count toward maxPlanCredits. */
|
|
906
|
+
unusedPlanCredits: {
|
|
907
|
+
type: "expire";
|
|
908
|
+
} | {
|
|
909
|
+
type: "roll_over";
|
|
910
|
+
/** 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. */
|
|
911
|
+
maxPlanCredits: number | null;
|
|
912
|
+
} | null;
|
|
913
|
+
/** Credits plans only. The most plan credits a subscription spends per day or per week; null means no limit. */
|
|
914
|
+
planCreditLimit: {
|
|
915
|
+
/** The most plan credits a subscription spends in one window. */
|
|
916
|
+
credits: number;
|
|
917
|
+
/** The window length: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. */
|
|
918
|
+
interval: "day" | "week";
|
|
919
|
+
} | null;
|
|
903
920
|
sortOrder: number;
|
|
904
921
|
planGroupId: string | null;
|
|
905
922
|
metadata: Record<string, unknown> | null;
|
|
@@ -934,6 +951,8 @@ interface Plan {
|
|
|
934
951
|
price: number;
|
|
935
952
|
isDefault: boolean;
|
|
936
953
|
trialDays: number;
|
|
954
|
+
/** Whether the price's free trial needs a payment method to start. When false, a new subscription starts trialing right away without checkout; without a payment method added by the trial end, the customer moves to the plan group's default plan, or the subscription is canceled when there is none. Null when the price has no trial. */
|
|
955
|
+
trialRequiresPaymentMethod: boolean | null;
|
|
937
956
|
includedBalance: number | null;
|
|
938
957
|
includedCredits: number | null;
|
|
939
958
|
/** Automatic introductory offer for this price. Pass a Promotional Offer ID when creating a subscription to override it. */
|
|
@@ -1215,6 +1234,8 @@ interface PlanPrice {
|
|
|
1215
1234
|
price: number;
|
|
1216
1235
|
isDefault: boolean;
|
|
1217
1236
|
trialDays: number;
|
|
1237
|
+
/** Whether the price's free trial needs a payment method to start. When false, a new subscription starts trialing right away without checkout; without a payment method added by the trial end, the customer moves to the plan group's default plan, or the subscription is canceled when there is none. Null when the price has no trial. */
|
|
1238
|
+
trialRequiresPaymentMethod: boolean | null;
|
|
1218
1239
|
includedBalance: number | null;
|
|
1219
1240
|
includedCredits: number | null;
|
|
1220
1241
|
/** Automatic introductory offer for this price. */
|
|
@@ -1342,6 +1363,10 @@ interface PromoCode {
|
|
|
1342
1363
|
expiresAt: string | null;
|
|
1343
1364
|
isActive: boolean;
|
|
1344
1365
|
redemptionCount: number;
|
|
1366
|
+
/** Whether the code only applies to a customer's first purchase: one with no paid invoice above zero and no paid subscription. */
|
|
1367
|
+
firstPurchaseOnly: boolean;
|
|
1368
|
+
/** Integration that manages this record, or null when the merchant does. While an integration manages it, its terms change only in that integration and edits answer 409 managed_by_integration. */
|
|
1369
|
+
managedBy: ManagedBy;
|
|
1345
1370
|
/** @format date-time */
|
|
1346
1371
|
createdAt: string;
|
|
1347
1372
|
/** @format date-time */
|
|
@@ -1520,6 +1545,8 @@ interface Subscription {
|
|
|
1520
1545
|
billingDayOfMonth: number | null;
|
|
1521
1546
|
nextBillingDate: string | null;
|
|
1522
1547
|
checkoutUrl: string | null;
|
|
1548
|
+
/** Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false. */
|
|
1549
|
+
hasPaymentMethod: boolean;
|
|
1523
1550
|
/** @format date-time */
|
|
1524
1551
|
createdAt: string;
|
|
1525
1552
|
/** @format date-time */
|
|
@@ -1629,6 +1656,30 @@ interface SubscriptionAddon {
|
|
|
1629
1656
|
object: "subscription_addon";
|
|
1630
1657
|
livemode: boolean;
|
|
1631
1658
|
}
|
|
1659
|
+
interface SubscriptionAutoTopUp {
|
|
1660
|
+
/** Whether credits are bought automatically. Always false when the plan does not sell credits. */
|
|
1661
|
+
enabled: boolean;
|
|
1662
|
+
/** Credits at or below which a top-up is bought, or null when never configured. */
|
|
1663
|
+
threshold: number | null;
|
|
1664
|
+
/** Credits each top-up buys, or null when never configured. */
|
|
1665
|
+
quantity: number | null;
|
|
1666
|
+
/** Maximum top-ups per credit renewal period, or null when never configured. */
|
|
1667
|
+
maxPerPeriod: number | null;
|
|
1668
|
+
/** active buys when credits reach the threshold; paused stops after three consecutive failed top-ups, or after one whose charge could not be refunded, until the payment method changes, a credit purchase succeeds or it is saved enabled again; off buys nothing. */
|
|
1669
|
+
status: "active" | "paused" | "off";
|
|
1670
|
+
/** Top-ups bought in the current credit renewal period. */
|
|
1671
|
+
topUpsThisPeriod: number;
|
|
1672
|
+
/** When the top-up count of the period resets, or null before the subscription starts its first period. */
|
|
1673
|
+
periodResetsAt: string | null;
|
|
1674
|
+
/** The last top-up that failed, or null when none has failed. */
|
|
1675
|
+
lastFailure: {
|
|
1676
|
+
reason: "payment_declined" | "no_payment_method" | "quantity_below_minimum" | "purchase_failed";
|
|
1677
|
+
/** @format date-time */
|
|
1678
|
+
at: string;
|
|
1679
|
+
} | null;
|
|
1680
|
+
object: "subscription_auto_top_up";
|
|
1681
|
+
livemode: boolean;
|
|
1682
|
+
}
|
|
1632
1683
|
interface SubscriptionOfferApplication {
|
|
1633
1684
|
id: string;
|
|
1634
1685
|
name: string;
|
|
@@ -1731,6 +1782,8 @@ interface SubscriptionSummary {
|
|
|
1731
1782
|
billingDayOfMonth: number | null;
|
|
1732
1783
|
nextBillingDate: string | null;
|
|
1733
1784
|
checkoutUrl: string | null;
|
|
1785
|
+
/** Whether Commet can charge this subscription on its own at its next charge (the trial end or the renewal). A trial that started without a payment method reports false until the customer adds one for this subscription; a payment method saved for another subscription does not count. A subscription on a free plan reports false. */
|
|
1786
|
+
hasPaymentMethod: boolean;
|
|
1734
1787
|
/** @format date-time */
|
|
1735
1788
|
createdAt: string;
|
|
1736
1789
|
/** @format date-time */
|
|
@@ -1957,6 +2010,21 @@ type UsageCheck = {
|
|
|
1957
2010
|
planCredits: number;
|
|
1958
2011
|
purchasedCredits: number;
|
|
1959
2012
|
totalCredits: number;
|
|
2013
|
+
planCreditLimit: {
|
|
2014
|
+
/** The most plan credits the subscription spends per window. */
|
|
2015
|
+
credits: number;
|
|
2016
|
+
/** The window length: 24 hours for `day`, 7 days for `week`. */
|
|
2017
|
+
interval: "day" | "week";
|
|
2018
|
+
/** Plan credits spent in the current window. */
|
|
2019
|
+
spent: number;
|
|
2020
|
+
/** Plan credits the subscription can still spend in the current window. Purchased credits are not limited. */
|
|
2021
|
+
remaining: number;
|
|
2022
|
+
/**
|
|
2023
|
+
* When the next window starts and spending resets.
|
|
2024
|
+
* @format date-time
|
|
2025
|
+
*/
|
|
2026
|
+
resetsAt: string;
|
|
2027
|
+
} | null;
|
|
1960
2028
|
object: "usage_check";
|
|
1961
2029
|
livemode: boolean;
|
|
1962
2030
|
} | {
|
|
@@ -1994,6 +2062,22 @@ interface UsageEvent {
|
|
|
1994
2062
|
deducted: number;
|
|
1995
2063
|
remaining: number;
|
|
1996
2064
|
blocked: boolean;
|
|
2065
|
+
/** Credits consumption only, omitted for balance. The plan credit limit after this event; null when the plan has no limit. */
|
|
2066
|
+
planCreditLimit?: {
|
|
2067
|
+
/** The most plan credits the subscription spends per window. */
|
|
2068
|
+
credits: number;
|
|
2069
|
+
/** The window length: 24 hours for `day`, 7 days for `week`. */
|
|
2070
|
+
interval: "day" | "week";
|
|
2071
|
+
/** Plan credits spent in the current window. */
|
|
2072
|
+
spent: number;
|
|
2073
|
+
/** Plan credits the subscription can still spend in the current window. Purchased credits are not limited. */
|
|
2074
|
+
remaining: number;
|
|
2075
|
+
/**
|
|
2076
|
+
* When the next window starts and spending resets.
|
|
2077
|
+
* @format date-time
|
|
2078
|
+
*/
|
|
2079
|
+
resetsAt: string;
|
|
2080
|
+
} | null;
|
|
1997
2081
|
};
|
|
1998
2082
|
object: "usage_event";
|
|
1999
2083
|
livemode: boolean;
|
|
@@ -2398,6 +2482,8 @@ interface BatchCreateCustomersParams {
|
|
|
2398
2482
|
region?: string;
|
|
2399
2483
|
};
|
|
2400
2484
|
}>;
|
|
2485
|
+
/** Plan group whose starting plan the customer starts on when it has no open subscription: its signup trial, a trial without a payment method, when the group has one and the customer never had that plan, otherwise its default plan. A customer who already had the signup trial plan in a group without a default plan starts on none. Without it, no plan is assigned. */
|
|
2486
|
+
planGroupId?: string;
|
|
2401
2487
|
}
|
|
2402
2488
|
interface ListCustomersParams {
|
|
2403
2489
|
cursor?: string;
|
|
@@ -2422,6 +2508,8 @@ interface CreateCustomerParams {
|
|
|
2422
2508
|
email: string;
|
|
2423
2509
|
timezone?: Timezone;
|
|
2424
2510
|
metadata?: Record<string, unknown>;
|
|
2511
|
+
/** Plan group whose starting plan the customer starts on when it has no open subscription: its signup trial, a trial without a payment method, when the group has one and the customer never had that plan, otherwise its default plan. A customer who already had the signup trial plan in a group without a default plan starts on none. Without it, no plan is assigned. */
|
|
2512
|
+
planGroupId?: string;
|
|
2425
2513
|
}
|
|
2426
2514
|
declare class CustomersResource {
|
|
2427
2515
|
private httpClient;
|
|
@@ -2454,7 +2542,7 @@ declare class CustomersResource {
|
|
|
2454
2542
|
get(params: GetCustomerParams, options?: RequestOptions): Promise<Customer>;
|
|
2455
2543
|
/** Update a customer's name, external ID, or metadata. */
|
|
2456
2544
|
update(params: UpdateCustomerParams, options?: RequestOptions): Promise<Customer>;
|
|
2457
|
-
/** Create up to 100 customers in a single request. */
|
|
2545
|
+
/** Create up to 100 customers in a single request. With planGroupId, each customer without an open subscription starts on that group's starting plan (see planGroupId), and the entry of a deleted customer fails with customer_deleted. */
|
|
2458
2546
|
createBatch(params: BatchCreateCustomersParams, options?: RequestOptions): Promise<CustomerBatch>;
|
|
2459
2547
|
/** List customers with cursor-based pagination. */
|
|
2460
2548
|
list(params?: ListCustomersParams, options?: RequestOptions): Promise<{
|
|
@@ -2463,7 +2551,7 @@ declare class CustomersResource {
|
|
|
2463
2551
|
hasMore: boolean;
|
|
2464
2552
|
nextCursor?: string;
|
|
2465
2553
|
}>;
|
|
2466
|
-
/** Create a new customer. Idempotent when customerId is provided. */
|
|
2554
|
+
/** Create a new customer. Idempotent when customerId is provided. With planGroupId, a customer without an open subscription starts on that group's starting plan (see planGroupId), and the externalId of a deleted customer is rejected. */
|
|
2467
2555
|
create(params: CreateCustomerParams, options?: RequestOptions): Promise<Customer>;
|
|
2468
2556
|
}
|
|
2469
2557
|
|
|
@@ -2619,9 +2707,6 @@ interface UpdateOfferParams {
|
|
|
2619
2707
|
id: string;
|
|
2620
2708
|
name: string;
|
|
2621
2709
|
phases: Array<{
|
|
2622
|
-
type: "free_trial";
|
|
2623
|
-
durationDays: number;
|
|
2624
|
-
} | {
|
|
2625
2710
|
type: "percentage";
|
|
2626
2711
|
durationCycles: number | null;
|
|
2627
2712
|
/** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
|
|
@@ -2665,9 +2750,6 @@ interface ListOffersParams {
|
|
|
2665
2750
|
interface CreateOfferParams {
|
|
2666
2751
|
name: string;
|
|
2667
2752
|
phases: Array<{
|
|
2668
|
-
type: "free_trial";
|
|
2669
|
-
durationDays: number;
|
|
2670
|
-
} | {
|
|
2671
2753
|
type: "percentage";
|
|
2672
2754
|
durationCycles: number | null;
|
|
2673
2755
|
/** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
|
|
@@ -2904,6 +2986,8 @@ interface UpdatePlanPriceParams {
|
|
|
2904
2986
|
price?: number;
|
|
2905
2987
|
isDefault?: boolean;
|
|
2906
2988
|
trialDays?: number;
|
|
2989
|
+
/** Set to false so the price's free trial starts without a payment method. Requires trialDays on the price. */
|
|
2990
|
+
trialRequiresPaymentMethod?: boolean;
|
|
2907
2991
|
includedBalance?: number | null;
|
|
2908
2992
|
includedCredits?: number | null;
|
|
2909
2993
|
/** Metadata keys to merge into the existing price metadata. */
|
|
@@ -2924,6 +3008,8 @@ type AddPlanPriceParams = {
|
|
|
2924
3008
|
metadata?: Record<string, unknown>;
|
|
2925
3009
|
price: number;
|
|
2926
3010
|
trialDays?: number;
|
|
3011
|
+
/** Set to false so the price's free trial starts without a payment method. Requires trialDays on the price. */
|
|
3012
|
+
trialRequiresPaymentMethod?: boolean;
|
|
2927
3013
|
isDefault?: boolean;
|
|
2928
3014
|
includedBalance?: number | null;
|
|
2929
3015
|
includedCredits?: number | null;
|
|
@@ -2972,6 +3058,23 @@ interface UpdatePlanParams {
|
|
|
2972
3058
|
description?: string | null;
|
|
2973
3059
|
metadata?: Record<string, unknown>;
|
|
2974
3060
|
isPublic?: boolean;
|
|
3061
|
+
/** Credits plans only. What happens to unused plan credits at each reset. Existing subscriptions apply it from their next reset. */
|
|
3062
|
+
unusedPlanCredits?: {
|
|
3063
|
+
type: "expire";
|
|
3064
|
+
} | {
|
|
3065
|
+
type: "roll_over";
|
|
3066
|
+
/** 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. */
|
|
3067
|
+
maxPlanCredits: number | null;
|
|
3068
|
+
};
|
|
3069
|
+
/** Credits plans only. The most plan credits a subscription spends per day or per week; null removes the limit. Raising or removing it applies to existing subscriptions at once; lowering it, adding it or changing its interval applies from their next period. */
|
|
3070
|
+
planCreditLimit?: {
|
|
3071
|
+
/** The most plan credits a subscription spends in one window. */
|
|
3072
|
+
credits: number;
|
|
3073
|
+
/** The window length: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. */
|
|
3074
|
+
interval: "day" | "week";
|
|
3075
|
+
} | null;
|
|
3076
|
+
/** Make this plan the default plan of its plan group: customers created with that planGroupId start on it, and a paid plan of the group that ends from the customer portal, a revoked payment authorization or exhausted dunning moves to it instead of canceling. Requires a free plan in a plan group; replaces the group's previous default plan. false unmarks it. */
|
|
3077
|
+
isDefault?: boolean;
|
|
2975
3078
|
}
|
|
2976
3079
|
interface DeletePlanParams {
|
|
2977
3080
|
id: string;
|
|
@@ -2991,7 +3094,24 @@ interface CreatePlanParams {
|
|
|
2991
3094
|
isPublic?: boolean;
|
|
2992
3095
|
isFree?: boolean;
|
|
2993
3096
|
blockOnExhaustion?: boolean;
|
|
3097
|
+
/** Credits plans only. What happens to unused plan credits at each reset; omitted means they expire. */
|
|
3098
|
+
unusedPlanCredits?: {
|
|
3099
|
+
type: "expire";
|
|
3100
|
+
} | {
|
|
3101
|
+
type: "roll_over";
|
|
3102
|
+
/** 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. */
|
|
3103
|
+
maxPlanCredits: number | null;
|
|
3104
|
+
};
|
|
3105
|
+
/** Credits plans only. The most plan credits a subscription spends per day or per week; omitted or null means no limit. */
|
|
3106
|
+
planCreditLimit?: {
|
|
3107
|
+
/** The most plan credits a subscription spends in one window. */
|
|
3108
|
+
credits: number;
|
|
3109
|
+
/** The window length: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. */
|
|
3110
|
+
interval: "day" | "week";
|
|
3111
|
+
} | null;
|
|
2994
3112
|
planGroupId?: string;
|
|
3113
|
+
/** Make this plan the default plan of its plan group: customers created with that planGroupId start on it, and a paid plan of the group that ends from the customer portal, a revoked payment authorization or exhausted dunning moves to it instead of canceling. Requires a free plan with a planGroupId; replaces the group's previous default plan. */
|
|
3114
|
+
isDefault?: boolean;
|
|
2995
3115
|
metadata?: Record<string, unknown>;
|
|
2996
3116
|
}
|
|
2997
3117
|
declare class PlansResource {
|
|
@@ -3019,7 +3139,7 @@ declare class PlansResource {
|
|
|
3019
3139
|
setRegionalPricing(params: SetPlanRegionalPricingParams, options?: RequestOptions): Promise<PlanRegionalPricingResult>;
|
|
3020
3140
|
/** Get a plan with public price IDs and their automatic introductory offer IDs. */
|
|
3021
3141
|
get(params: GetPlanParams, options?: RequestOptions): Promise<Plan>;
|
|
3022
|
-
/** Update a plan's name, description, visibility, or
|
|
3142
|
+
/** Update a plan's name, description, visibility, default status, metadata, what happens to its unused plan credits, or its plan credit limit. */
|
|
3023
3143
|
update(params: UpdatePlanParams, options?: RequestOptions): Promise<Plan>;
|
|
3024
3144
|
/** Soft-delete a plan. */
|
|
3025
3145
|
delete(params: DeletePlanParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
@@ -3060,6 +3180,8 @@ interface UpdatePromoCodeParams {
|
|
|
3060
3180
|
expiresAt?: string | null;
|
|
3061
3181
|
active?: boolean;
|
|
3062
3182
|
planIds?: Array<string>;
|
|
3183
|
+
/** Whether the code only applies to a customer's first purchase: one with no paid invoice above zero and no paid subscription. */
|
|
3184
|
+
firstPurchaseOnly?: boolean;
|
|
3063
3185
|
}
|
|
3064
3186
|
interface ListPromoCodesParams {
|
|
3065
3187
|
cursor?: string;
|
|
@@ -3073,6 +3195,8 @@ interface CreatePromoCodeParams {
|
|
|
3073
3195
|
/** @format date-time */
|
|
3074
3196
|
expiresAt?: string;
|
|
3075
3197
|
planIds?: Array<string>;
|
|
3198
|
+
/** Whether the code only applies to a customer's first purchase: one with no paid invoice above zero and no paid subscription. Defaults to false. */
|
|
3199
|
+
firstPurchaseOnly?: boolean;
|
|
3076
3200
|
}
|
|
3077
3201
|
declare class PromoCodesResource {
|
|
3078
3202
|
private httpClient;
|
|
@@ -3088,7 +3212,7 @@ declare class PromoCodesResource {
|
|
|
3088
3212
|
hasMore: boolean;
|
|
3089
3213
|
nextCursor?: string;
|
|
3090
3214
|
}>;
|
|
3091
|
-
/** Create a distribution code for an existing Offer with one or more sequential discount phases
|
|
3215
|
+
/** Create a distribution code for an existing Offer with one or more sequential discount phases. The code owns redemption restrictions. */
|
|
3092
3216
|
create(params: CreatePromoCodeParams, options?: RequestOptions): Promise<PromoCode>;
|
|
3093
3217
|
}
|
|
3094
3218
|
|
|
@@ -3209,6 +3333,16 @@ interface ActivateAddonParams {
|
|
|
3209
3333
|
id: string;
|
|
3210
3334
|
addonId: string;
|
|
3211
3335
|
}
|
|
3336
|
+
interface GetSubscriptionAutoTopUpParams {
|
|
3337
|
+
id: string;
|
|
3338
|
+
}
|
|
3339
|
+
interface UpdateSubscriptionAutoTopUpParams {
|
|
3340
|
+
id: string;
|
|
3341
|
+
enabled?: boolean;
|
|
3342
|
+
threshold?: number;
|
|
3343
|
+
quantity?: number;
|
|
3344
|
+
maxPerPeriod?: number;
|
|
3345
|
+
}
|
|
3212
3346
|
interface AdjustBalanceParams {
|
|
3213
3347
|
id: string;
|
|
3214
3348
|
amount: number;
|
|
@@ -3224,17 +3358,30 @@ interface CancelSubscriptionParams {
|
|
|
3224
3358
|
reason?: string;
|
|
3225
3359
|
immediate?: boolean;
|
|
3226
3360
|
}
|
|
3227
|
-
|
|
3361
|
+
type ChangePlanParams = {
|
|
3228
3362
|
id: string;
|
|
3229
3363
|
newPlanId?: string;
|
|
3230
3364
|
newBillingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
3231
3365
|
successUrl?: string;
|
|
3232
3366
|
offerId?: string;
|
|
3233
|
-
|
|
3234
|
-
|
|
3367
|
+
promoCode?: never;
|
|
3368
|
+
} | {
|
|
3369
|
+
id: string;
|
|
3370
|
+
newPlanId?: string;
|
|
3371
|
+
newBillingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
3372
|
+
successUrl?: string;
|
|
3373
|
+
offerId?: never;
|
|
3374
|
+
/** Promo code whose Offer prices the change, validated with the checkout's rules: a code the checkout would refuse returns 400 validation_error with the checkout's reason in details.reason. Cannot be combined with offerId. */
|
|
3375
|
+
promoCode: string;
|
|
3376
|
+
};
|
|
3377
|
+
type PurchaseCreditsParams = {
|
|
3235
3378
|
id: string;
|
|
3236
3379
|
creditPackId: string;
|
|
3237
|
-
|
|
3380
|
+
quantity?: never;
|
|
3381
|
+
} | {
|
|
3382
|
+
id: string;
|
|
3383
|
+
quantity: number;
|
|
3384
|
+
};
|
|
3238
3385
|
interface ApplySubscriptionOfferParams {
|
|
3239
3386
|
id: string;
|
|
3240
3387
|
offerId: string;
|
|
@@ -3268,12 +3415,20 @@ interface CreatePrepaidPeriodsCheckoutParams {
|
|
|
3268
3415
|
offerId?: string;
|
|
3269
3416
|
successUrl?: string;
|
|
3270
3417
|
}
|
|
3271
|
-
|
|
3418
|
+
type PreviewChangePlanParams = {
|
|
3272
3419
|
id: string;
|
|
3273
3420
|
planId: string;
|
|
3274
3421
|
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3275
3422
|
offerId?: string;
|
|
3276
|
-
|
|
3423
|
+
promoCode?: never;
|
|
3424
|
+
} | {
|
|
3425
|
+
id: string;
|
|
3426
|
+
planId: string;
|
|
3427
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3428
|
+
offerId?: never;
|
|
3429
|
+
/** Promo code whose Offer prices the change, validated with the checkout's rules: a code the checkout would refuse returns 400 validation_error with the checkout's reason in details.reason. Cannot be combined with offerId. */
|
|
3430
|
+
promoCode: string;
|
|
3431
|
+
};
|
|
3277
3432
|
interface ReactivateSubscriptionParams {
|
|
3278
3433
|
id: string;
|
|
3279
3434
|
offerId?: string;
|
|
@@ -3287,6 +3442,9 @@ interface ResumeSubscriptionParams {
|
|
|
3287
3442
|
interface GetSubscriptionParams {
|
|
3288
3443
|
id: string;
|
|
3289
3444
|
}
|
|
3445
|
+
interface RevokeScheduledPlanChangeParams {
|
|
3446
|
+
id: string;
|
|
3447
|
+
}
|
|
3290
3448
|
interface UncancelSubscriptionParams {
|
|
3291
3449
|
id: string;
|
|
3292
3450
|
}
|
|
@@ -3315,6 +3473,7 @@ type CreateSubscriptionParams = {
|
|
|
3315
3473
|
cancelAtPeriodEnd?: boolean;
|
|
3316
3474
|
offerId?: never;
|
|
3317
3475
|
promoCode?: string;
|
|
3476
|
+
/** Trial length in days, replacing the price's trial. A customer who already had this plan, in a trial or paying, gets no trial and goes through the regular checkout. */
|
|
3318
3477
|
customTrialDays?: number;
|
|
3319
3478
|
skipTrial?: boolean;
|
|
3320
3479
|
planId: string;
|
|
@@ -3336,6 +3495,7 @@ type CreateSubscriptionParams = {
|
|
|
3336
3495
|
cancelAtPeriodEnd?: boolean;
|
|
3337
3496
|
offerId?: never;
|
|
3338
3497
|
promoCode?: string;
|
|
3498
|
+
/** Trial length in days, replacing the price's trial. A customer who already had this plan, in a trial or paying, gets no trial and goes through the regular checkout. */
|
|
3339
3499
|
customTrialDays?: number;
|
|
3340
3500
|
skipTrial?: boolean;
|
|
3341
3501
|
planCode: string;
|
|
@@ -3357,8 +3517,9 @@ type CreateSubscriptionParams = {
|
|
|
3357
3517
|
cancelAtPeriodEnd?: boolean;
|
|
3358
3518
|
offerId: string;
|
|
3359
3519
|
promoCode?: never;
|
|
3360
|
-
|
|
3361
|
-
|
|
3520
|
+
/** Trial length in days, replacing the price's trial. A customer who already had this plan, in a trial or paying, gets no trial and goes through the regular checkout. */
|
|
3521
|
+
customTrialDays?: number;
|
|
3522
|
+
skipTrial?: boolean;
|
|
3362
3523
|
planId: string;
|
|
3363
3524
|
} | {
|
|
3364
3525
|
customerId: string;
|
|
@@ -3378,8 +3539,9 @@ type CreateSubscriptionParams = {
|
|
|
3378
3539
|
cancelAtPeriodEnd?: boolean;
|
|
3379
3540
|
offerId: string;
|
|
3380
3541
|
promoCode?: never;
|
|
3381
|
-
|
|
3382
|
-
|
|
3542
|
+
/** Trial length in days, replacing the price's trial. A customer who already had this plan, in a trial or paying, gets no trial and goes through the regular checkout. */
|
|
3543
|
+
customTrialDays?: number;
|
|
3544
|
+
skipTrial?: boolean;
|
|
3383
3545
|
planCode: string;
|
|
3384
3546
|
} | {
|
|
3385
3547
|
customerId: string;
|
|
@@ -3435,17 +3597,21 @@ declare class SubscriptionsResource {
|
|
|
3435
3597
|
deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<DeletedSubscriptionAddon>;
|
|
3436
3598
|
/** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
|
|
3437
3599
|
activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<SubscriptionAddon>;
|
|
3600
|
+
/** Read whether the subscription buys credits automatically with its saved payment method when credits reach a threshold, with the top-ups used this period and the last failure. */
|
|
3601
|
+
getAutoTopUp(params: GetSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
3602
|
+
/** Turn automatic credit purchases on or off and set the threshold, the credits each top-up buys and the maximum top-ups per period. Send only the fields that change. Enabling requires a plan that sells credits. The quantity must be at least the plan's purchase minimum when auto top-up is enabled or when the quantity changes, so turning it off keeps working after the minimum rises. Saving it enabled resumes a paused auto top-up. */
|
|
3603
|
+
updateAutoTopUp(params: UpdateSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
3438
3604
|
/** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
|
|
3439
3605
|
adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<BalanceAdjustment>;
|
|
3440
3606
|
/** Top up a subscription's balance. Charges the customer's payment method for the specified amount. */
|
|
3441
3607
|
topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<BalanceTopup>;
|
|
3442
3608
|
/** Cancel immediately or at period end and return the updated subscription. */
|
|
3443
3609
|
cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
3444
|
-
/** Upgrade or change billing interval immediately, optionally applying an Offer. Scheduled changes
|
|
3610
|
+
/** 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. */
|
|
3445
3611
|
changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<PlanChange>;
|
|
3446
|
-
/** Purchase a credit pack
|
|
3612
|
+
/** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Charges the saved payment method and adds purchased credits. */
|
|
3447
3613
|
purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
|
|
3448
|
-
/** Apply a direct Offer to a subscription. On a pending
|
|
3614
|
+
/** 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. */
|
|
3449
3615
|
applyOffer(params: ApplySubscriptionOfferParams, options?: RequestOptions): Promise<Subscription>;
|
|
3450
3616
|
/** Remove the quoted direct Offer from a subscription's pending payment checkout. The existing checkout URL remains unchanged and returns to its undiscounted price. */
|
|
3451
3617
|
removeOffer(params: RemoveSubscriptionOfferParams, options?: RequestOptions): Promise<Subscription>;
|
|
@@ -3459,7 +3625,7 @@ declare class SubscriptionsResource {
|
|
|
3459
3625
|
updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<PaymentMethodUpdateCheckout>;
|
|
3460
3626
|
/** Creates a hosted checkout to pay billing periods of a recurring subscription in advance with any payment method. On an active subscription the paid periods start after the last paid period and replace any open prepaid-periods checkout. On a pending-payment subscription the first payment covers the requested periods and replaces its pending checkout. The billing interval does not change. */
|
|
3461
3627
|
createPrepaidPeriodsCheckout(params: CreatePrepaidPeriodsCheckoutParams, options?: RequestOptions): Promise<PrepaidPeriodsCheckout>;
|
|
3462
|
-
/** Preview proration details for an immediate plan change without applying it. Free-to-paid changes are never scheduled and the change-plan endpoint
|
|
3628
|
+
/** Preview proration details for an immediate plan change without applying it. Free-to-paid changes are never scheduled and the change-plan endpoint returns hosted checkout for them, except a change without offerId or promoCode to a price whose free trial needs no payment method, for a customer who never had that plan: it starts the trial at once, so the preview reports nothing due today. For paid plans, interval direction takes precedence: a longer interval is immediate and a shorter interval is scheduled. When the interval is unchanged, a higher-sort-order plan is immediate and a lower-sort-order plan is scheduled. A paid-to-free change is always scheduled. 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. Scheduled changes return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with an Offer, or promoCode to quote it with the Offer of a promo code validated with the checkout's rules. */
|
|
3463
3629
|
previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<PreviewChange>;
|
|
3464
3630
|
/** 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 an Offer by offerId; past-due recovery cannot. */
|
|
3465
3631
|
reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ReactivatedSubscription>;
|
|
@@ -3469,6 +3635,8 @@ declare class SubscriptionsResource {
|
|
|
3469
3635
|
resume(params: ResumeSubscriptionParams, options?: RequestOptions): Promise<SubscriptionResume>;
|
|
3470
3636
|
/** Get a subscription by its public ID, regardless of status (including pending_payment and past_due). */
|
|
3471
3637
|
get(params: GetSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
3638
|
+
/** Revoke the plan or interval change scheduled for the end of the period, so the subscription stays on its current plan. Returns the updated subscription. */
|
|
3639
|
+
revokeScheduledPlanChange(params: RevokeScheduledPlanChangeParams, options?: RequestOptions): Promise<Subscription>;
|
|
3472
3640
|
/** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. */
|
|
3473
3641
|
uncancel(params: UncancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
3474
3642
|
/** Get the active subscription for a customer. Returns null if none. */
|
|
@@ -3480,7 +3648,7 @@ declare class SubscriptionsResource {
|
|
|
3480
3648
|
hasMore: boolean;
|
|
3481
3649
|
nextCursor?: string;
|
|
3482
3650
|
}>;
|
|
3483
|
-
/** Create a subscription for a customer. Commet selects the default price when priceId is omitted. The subscription starts at the base USD price; market and currency are resolved from the buyer's request country when the checkout opens. Without an offer override, Commet applies the price's automatic introductory Offer. Pass offerId to apply an active compatible Offer directly, or cardPromotionId to preselect a card-eligible Promotional Offer for the initial checkout when card promotions are enabled for the organization. For the initial checkout, provider accepts either a processor name or an exact payment connection ID. */
|
|
3651
|
+
/** Create a subscription for a customer. Commet selects the default price when priceId is omitted. The subscription starts at the base USD price; market and currency are resolved from the buyer's request country when the checkout opens. Without an offer override, Commet applies the price's automatic introductory Offer. Pass offerId to apply an active compatible Offer directly, or cardPromotionId to preselect a card-eligible Promotional Offer for the initial checkout when card promotions are enabled for the organization. For the initial checkout, provider accepts either a processor name or an exact payment connection ID. When the price's free trial requires no payment method, the subscription starts trialing right away with no checkout (checkoutUrl null, hasPaymentMethod false); it cannot be combined with offerId, promoCode, cardPromotionId or provider, and an organization that cannot charge yet receives 403. */
|
|
3484
3652
|
create(params: CreateSubscriptionParams, options?: RequestOptions): Promise<CreatedSubscription>;
|
|
3485
3653
|
}
|
|
3486
3654
|
|
|
@@ -3619,7 +3787,7 @@ declare class GeneratedResources {
|
|
|
3619
3787
|
}
|
|
3620
3788
|
|
|
3621
3789
|
type WebhookEvent = "subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.pause_scheduled" | "subscription.pause_updated" | "subscription.pause_revoked" | "subscription.paused" | "subscription.resumed" | "subscription.resume_failed" | "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" | "plan_grant.created" | "plan_grant.updated" | "plan_grant.expired" | "plan_grant.revoked" | "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";
|
|
3622
|
-
/** Fired when a subscription record is created with status pending_payment
|
|
3790
|
+
/** Fired when a subscription record is created, usually with status pending_payment: the first charge has not been confirmed yet — do NOT grant access here; wait for subscription.activated. A trial whose price requires no payment method is created already trialing, together with trial.started. */
|
|
3623
3791
|
interface SubscriptionCreatedData {
|
|
3624
3792
|
/** The subscription ID. */
|
|
3625
3793
|
subscriptionId: string;
|
|
@@ -3791,7 +3959,7 @@ interface SubscriptionCanceledData {
|
|
|
3791
3959
|
status: string;
|
|
3792
3960
|
/** ISO 8601 datetime when the cancellation was requested or triggered. */
|
|
3793
3961
|
canceledAt?: string;
|
|
3794
|
-
/** The reason for cancellation, if provided. Set to "dunning_exhausted" when all payment retries fail. Historical refund-triggered cancellations may have "refund". */
|
|
3962
|
+
/** The reason for cancellation, if provided. Set to "dunning_exhausted" when all payment retries fail, and to "trial_ended_without_payment_method" when a trial without a payment method ends with no card and no default plan. Historical refund-triggered cancellations may have "refund". */
|
|
3795
3963
|
cancelReason: string | null;
|
|
3796
3964
|
/** ISO 8601 datetime when the subscription ended. Matches the billing period end for scheduled cancellations; for immediate terminations it is the moment of termination. */
|
|
3797
3965
|
endDate?: string;
|
|
@@ -3875,7 +4043,7 @@ interface SubscriptionPlanChangeScheduledData {
|
|
|
3875
4043
|
/** ISO 8601 datetime when the change executes (the billing period end). */
|
|
3876
4044
|
effectiveAt: string;
|
|
3877
4045
|
}
|
|
3878
|
-
/** Fired when a scheduled plan change
|
|
4046
|
+
/** Fired when a scheduled plan change will no longer take effect: it was revoked through the API, the dashboard or the customer portal, an immediate plan change or an immediate cancellation voided it, or a different change replaced it. A replacement also fires subscription.plan_change_scheduled with the new target plan. */
|
|
3879
4047
|
interface SubscriptionPlanChangeRevokedData {
|
|
3880
4048
|
/** The subscription ID. */
|
|
3881
4049
|
subscriptionId: string;
|
|
@@ -3905,7 +4073,7 @@ interface SubscriptionPastDueData {
|
|
|
3905
4073
|
/** The human-readable invoice number. */
|
|
3906
4074
|
invoiceNumber: string;
|
|
3907
4075
|
}
|
|
3908
|
-
/** Fired when a subscription enters its trial period after checkout. Grant access here — trialing subscriptions have full access until trialEndsAt. */
|
|
4076
|
+
/** Fired when a subscription enters its trial period: after checkout, or right away when the price's trial requires no payment method. Grant access here — trialing subscriptions have full access until trialEndsAt. */
|
|
3909
4077
|
interface TrialStartedData {
|
|
3910
4078
|
/** The subscription ID. */
|
|
3911
4079
|
subscriptionId: string;
|
|
@@ -3933,7 +4101,7 @@ interface TrialConvertedData {
|
|
|
3933
4101
|
/** The plan name. */
|
|
3934
4102
|
planName: string;
|
|
3935
4103
|
}
|
|
3936
|
-
/** Fired when a trial period runs out
|
|
4104
|
+
/** Fired when a trial period runs out. With a payment method the billing cycle activates the subscription and generates the first regular invoice right after — the natural trial-to-paid transition. A trial without a payment method instead moves to the plan group's default plan (subscription.plan_changed) or is canceled with cancelReason trial_ended_without_payment_method (subscription.canceled), without an invoice. */
|
|
3937
4105
|
interface TrialExpiredData {
|
|
3938
4106
|
/** The subscription ID. */
|
|
3939
4107
|
subscriptionId: string;
|
|
@@ -3963,7 +4131,7 @@ interface TrialWillEndData {
|
|
|
3963
4131
|
/** ISO 8601 datetime when the trial will end. */
|
|
3964
4132
|
trialEndsAt: string;
|
|
3965
4133
|
}
|
|
3966
|
-
/** Fired when a trial checkout link is ready to share with the customer. Completing this checkout saves a payment method and starts the trial (trial.started) — the customer is not charged until the trial ends. */
|
|
4134
|
+
/** Fired when a trial checkout link is ready to share with the customer. Completing this checkout saves a payment method and starts the trial (trial.started) — the customer is not charged until the trial ends. Not fired for a trial whose price requires no payment method, which starts without checkout. */
|
|
3967
4135
|
interface TrialCheckoutReadyData {
|
|
3968
4136
|
/** The subscription ID. */
|
|
3969
4137
|
subscriptionId: string;
|
|
@@ -4885,7 +5053,7 @@ interface PlanGrantRevokedData {
|
|
|
4885
5053
|
/** The grant timeline through the represented transition. */
|
|
4886
5054
|
events: Array<WebhookPlanGrantTimelineEvent>;
|
|
4887
5055
|
}
|
|
4888
|
-
/** Fired when non-purchase credits are granted to a subscription: plan-included credits at the start of each billing period, or a manual adjustment from the dashboard. Credit
|
|
5056
|
+
/** Fired when non-purchase credits are granted to a subscription: plan-included credits at the start of each billing period, or a manual adjustment from the dashboard. Credit purchases through the API, automatic top-ups, or the customer portal fire credits.purchased instead. */
|
|
4889
5057
|
interface CreditsGrantedData {
|
|
4890
5058
|
/** The subscription ID. */
|
|
4891
5059
|
subscriptionId: string;
|
|
@@ -4896,7 +5064,7 @@ interface CreditsGrantedData {
|
|
|
4896
5064
|
/** Why the credits were granted: period_reset or manual_adjustment. */
|
|
4897
5065
|
reason: string;
|
|
4898
5066
|
}
|
|
4899
|
-
/** Fired when a customer buys a credit pack through the customer portal and the payment succeeds. Purchased credits never expire — unlike plan credits, they survive period resets. Plan-included credit grants fire credits.granted instead. */
|
|
5067
|
+
/** Fired when a customer buys a credit pack or a chosen quantity of credits through the API, an automatic top-up, or the customer portal and the payment succeeds. Purchased credits never expire — unlike plan credits, they survive period resets. Plan-included credit grants fire credits.granted instead. */
|
|
4900
5068
|
interface CreditsPurchasedData {
|
|
4901
5069
|
/** The subscription ID. */
|
|
4902
5070
|
subscriptionId: string;
|
|
@@ -4906,7 +5074,7 @@ interface CreditsPurchasedData {
|
|
|
4906
5074
|
invoiceId: string;
|
|
4907
5075
|
/** The human-readable invoice number. */
|
|
4908
5076
|
invoiceNumber: string;
|
|
4909
|
-
/** The purchased credit pack's name. */
|
|
5077
|
+
/** The purchased credit pack's name, or Credit purchase for a chosen quantity of credits. */
|
|
4910
5078
|
creditPackName: string;
|
|
4911
5079
|
/** The number of credits purchased. */
|
|
4912
5080
|
credits: number;
|
|
@@ -4933,13 +5101,13 @@ interface CreditsDepletedData {
|
|
|
4933
5101
|
/** Credits remaining after depletion. Always 0. */
|
|
4934
5102
|
remainingCredits: number;
|
|
4935
5103
|
}
|
|
4936
|
-
/** Fired at
|
|
5104
|
+
/** Fired at a reset when unused plan credits are discarded. On a plan whose unused plan credits expire, every unused plan credit expires at each reset. On a plan that rolls them over, a reset keeps them, up to the plan's maxPlanCredits when it has one, and only the excess expires. A change to another credits plan applies the new plan's terms the same way. Purchased credits never expire and are not affected. */
|
|
4937
5105
|
interface CreditsExpiredData {
|
|
4938
5106
|
/** The subscription ID. */
|
|
4939
5107
|
subscriptionId: string;
|
|
4940
5108
|
/** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
|
|
4941
5109
|
customerId: string;
|
|
4942
|
-
/** The
|
|
5110
|
+
/** The plan credits that were discarded. */
|
|
4943
5111
|
expiredCredits: number;
|
|
4944
5112
|
}
|
|
4945
5113
|
/** Fired when a customer on a balance plan tops up their prepaid balance through the customer portal and the payment succeeds. */
|
|
@@ -5312,4 +5480,4 @@ declare function registerIntegration(name: string, version: string): void;
|
|
|
5312
5480
|
declare const API_VERSION = "2026-08-27";
|
|
5313
5481
|
declare const SDK_VERSION: string;
|
|
5314
5482
|
|
|
5315
|
-
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 ApplySubscriptionOfferParams, 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, type CommetErrorContext, CommetValidationError, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerCreditParams, type CreateCustomerParams, type CreateFeatureParams, type CreateMarketParams, type CreateOfferParams, type CreatePaymentParams, type CreatePlanGrantParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePrepaidPeriodsCheckoutParams, 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 CustomerCredit, type CustomerCreditRevocation, type CustomerStateChangedData, type CustomerUpdatedData, type DeactivateAddonParams, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeleteMarketParams, 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 GetMarketParams, 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 ListCustomerCreditsParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListOffersParams, type ListPaymentsParams, type ListPlanGrantsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhookEndpointsParams, type Market, type Offer, type PauseSubscriptionParams, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethod, 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 Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGrant, type PlanGrantCreatedData, type PlanGrantExpiredData, type PlanGrantRevokedData, type PlanGrantUpdatedData, type PlanGroup, type PlanGroupDetail, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PortalAccess, type PrepaidPeriodsCheckout, 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 RemoveSubscriptionOfferParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type ResumeSubscriptionParams, type RetryTransactionParams, type RevokeCustomerCreditParams, type RevokePlanGrantParams, type RevokeSubscriptionPauseParams, 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 SubPaymentMethod, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionOfferApplication, type SubscriptionOfferApplicationPhase, type SubscriptionPastDueData, type SubscriptionPauseRevokedData, type SubscriptionPauseScheduledData, type SubscriptionPauseUpdatedData, type SubscriptionPausedData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionResume, type SubscriptionResumeFailedData, type SubscriptionResumedData, type SubscriptionStatus, type SubscriptionSummary, type SubscriptionUpdatedData, type TestClock, type TestClockRun, 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 UpdateMarketParams, type UpdateOfferParams, type UpdatePaymentMethodParams, type UpdatePlanFeatureParams, type UpdatePlanGrantParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateSubscriptionPauseParams, 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 WebhookPlanGrantTimelineEvent, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTest, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
|
|
5483
|
+
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 ApplySubscriptionOfferParams, 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, type CommetErrorContext, CommetValidationError, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerCreditParams, type CreateCustomerParams, type CreateFeatureParams, type CreateMarketParams, type CreateOfferParams, type CreatePaymentParams, type CreatePlanGrantParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePrepaidPeriodsCheckoutParams, 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 CustomerCredit, type CustomerCreditRevocation, type CustomerStateChangedData, type CustomerUpdatedData, type DeactivateAddonParams, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeleteMarketParams, 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 GetMarketParams, type GetOfferParams, type GetPaymentParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionAutoTopUpParams, 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 ListCustomerCreditsParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListOffersParams, type ListPaymentsParams, type ListPlanGrantsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhookEndpointsParams, type ManagedBy, type Market, type Offer, type PauseSubscriptionParams, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethod, 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 Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGrant, type PlanGrantCreatedData, type PlanGrantExpiredData, type PlanGrantRevokedData, type PlanGrantUpdatedData, type PlanGroup, type PlanGroupDetail, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PortalAccess, type PrepaidPeriodsCheckout, 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 RemoveSubscriptionOfferParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type ResumeSubscriptionParams, type RetryTransactionParams, type RevokeCustomerCreditParams, type RevokePlanGrantParams, type RevokeScheduledPlanChangeParams, type RevokeSubscriptionPauseParams, 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 SubPaymentMethod, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionAutoTopUp, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionOfferApplication, type SubscriptionOfferApplicationPhase, type SubscriptionPastDueData, type SubscriptionPauseRevokedData, type SubscriptionPauseScheduledData, type SubscriptionPauseUpdatedData, type SubscriptionPausedData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionResume, type SubscriptionResumeFailedData, type SubscriptionResumedData, type SubscriptionStatus, type SubscriptionSummary, type SubscriptionUpdatedData, type TestClock, type TestClockRun, 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 UpdateMarketParams, type UpdateOfferParams, type UpdatePaymentMethodParams, type UpdatePlanFeatureParams, type UpdatePlanGrantParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateSubscriptionAutoTopUpParams, type UpdateSubscriptionPauseParams, 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 WebhookPlanGrantTimelineEvent, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTest, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
|