@commet/node 9.12.0 → 9.13.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 +298 -495
- package/dist/index.d.ts +298 -495
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/index.mjs.map +1 -1
- package/docs/api-reference/addons.md +8 -15
- package/docs/api-reference/api-keys.md +1 -1
- package/docs/api-reference/credit-packs.md +2 -2
- package/docs/api-reference/customers.md +7 -19
- package/docs/api-reference/offers.md +9 -5
- package/docs/api-reference/payments.md +1 -1
- package/docs/api-reference/plan-groups.md +2 -2
- package/docs/api-reference/plans.md +28 -44
- package/docs/api-reference/portal.md +3 -8
- package/docs/api-reference/promo-codes.md +3 -3
- package/docs/api-reference/quota.md +6 -21
- package/docs/api-reference/subscriptions.md +38 -55
- package/docs/api-reference/test-clock.md +3 -8
- package/docs/api-reference/usage.md +6 -11
- package/docs/documentation/create-api-key.md +4 -2
- package/docs/documentation/invoicing/handle-failed-payments.md +12 -3
- package/docs/documentation/plans/one-time-payments.md +1 -0
- package/docs/documentation/sales/offers.md +21 -3
- package/docs/documentation/sales/promo-codes.md +2 -2
- package/docs/documentation/sales/promotional-offers.md +1 -1
- package/docs/documentation/subscriptions/manage-subscriptions.md +3 -3
- package/docs/documentation/subscriptions/pay-in-advance.md +6 -4
- package/docs/errors/already_has_active_subscription.md +1 -1
- package/docs/errors/charge_failed.md +1 -1
- package/docs/errors/no_payment_method.md +1 -1
- package/docs/errors/payment_failed.md +1 -1
- package/docs/errors/subscription_not_active.md +1 -1
- package/docs/errors/validation_error.md +1 -1
- package/docs/knowledge-base/how-do-discounts-work.md +3 -3
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +6 -6
- package/docs/schemas.md +6 -4
- package/docs/webhooks.md +2 -0
- package/docs/webhooks.openapi.json +22 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -193,7 +193,7 @@ 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. `requires_checkout` when the subscription has no saved payment method
|
|
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. `requires_checkout` when `successUrl` was sent and the subscription has no saved payment method or the saved one was declined: the balance is added once the customer pays at `checkoutUrl`. */
|
|
197
197
|
status: "succeeded" | "processing" | "requires_checkout";
|
|
198
198
|
/** Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`. */
|
|
199
199
|
checkoutUrl?: string;
|
|
@@ -317,7 +317,7 @@ interface CreatedWebhook {
|
|
|
317
317
|
}
|
|
318
318
|
interface CreditGrant {
|
|
319
319
|
credits: number;
|
|
320
|
-
/** `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. `requires_checkout` when the subscription has no saved payment method
|
|
320
|
+
/** `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. `requires_checkout` when `successUrl` was sent and the subscription has no saved payment method or the saved one was declined: the credits are added once the customer pays at `checkoutUrl`. */
|
|
321
321
|
status: "succeeded" | "processing" | "requires_checkout";
|
|
322
322
|
/** Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`. */
|
|
323
323
|
checkoutUrl?: string;
|
|
@@ -849,6 +849,10 @@ interface Offer {
|
|
|
849
849
|
startsAt: string | null;
|
|
850
850
|
endsAt: string | null;
|
|
851
851
|
active: boolean;
|
|
852
|
+
/** Plans the offer is limited to. Empty when it applies to any plan. */
|
|
853
|
+
planIds: Array<string>;
|
|
854
|
+
/** Billing interval the offer is limited to. Null when it applies to any interval. */
|
|
855
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null;
|
|
852
856
|
/** 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. */
|
|
853
857
|
managedBy: ManagedBy;
|
|
854
858
|
/** @format date-time */
|
|
@@ -1073,11 +1077,6 @@ interface Plan {
|
|
|
1073
1077
|
livemode: boolean;
|
|
1074
1078
|
}
|
|
1075
1079
|
type PlanChange = {
|
|
1076
|
-
outcome: "processing";
|
|
1077
|
-
invoiceId: string;
|
|
1078
|
-
object: "plan_change";
|
|
1079
|
-
livemode: boolean;
|
|
1080
|
-
} | {
|
|
1081
1080
|
outcome: "requires_checkout";
|
|
1082
1081
|
requiresCheckout: true;
|
|
1083
1082
|
checkoutUrl: string;
|
|
@@ -1236,6 +1235,11 @@ type PlanChange = {
|
|
|
1236
1235
|
};
|
|
1237
1236
|
object: "plan_change";
|
|
1238
1237
|
livemode: boolean;
|
|
1238
|
+
} | {
|
|
1239
|
+
outcome: "processing";
|
|
1240
|
+
invoiceId: string;
|
|
1241
|
+
object: "plan_change";
|
|
1242
|
+
livemode: boolean;
|
|
1239
1243
|
};
|
|
1240
1244
|
interface PlanDraft {
|
|
1241
1245
|
/** Public plan draft ID. */
|
|
@@ -2020,7 +2024,7 @@ interface Subscription {
|
|
|
2020
2024
|
}
|
|
2021
2025
|
interface SubscriptionAddon {
|
|
2022
2026
|
addonId: string;
|
|
2023
|
-
/** `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. `requires_checkout` when the subscription has no saved payment method
|
|
2027
|
+
/** `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. `requires_checkout` when `successUrl` was sent and the subscription has no saved payment method or the saved one was declined: the add-on is activated once the customer pays at `checkoutUrl`. */
|
|
2024
2028
|
status: "active" | "processing" | "requires_checkout";
|
|
2025
2029
|
proratedCharge: number;
|
|
2026
2030
|
/** Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`. */
|
|
@@ -2675,9 +2679,11 @@ interface UpdateAddonParams {
|
|
|
2675
2679
|
name?: string;
|
|
2676
2680
|
description?: string;
|
|
2677
2681
|
basePrice?: number;
|
|
2682
|
+
/** Only on a metered add-on. */
|
|
2678
2683
|
includedUnits?: number;
|
|
2684
|
+
/** Only on a metered or balance add-on. */
|
|
2679
2685
|
overageRate?: number;
|
|
2680
|
-
/** Plans that sell the add-on, replacing the current ones. Empty means every plan; omitted keeps them. Removing a plan is rejected with addon_has_activations while a subscription of that plan has the add-on active. */
|
|
2686
|
+
/** Plans that sell the add-on, replacing the current ones. Empty means every plan; omitted keeps them. Removing a plan is rejected with addon_has_activations while a subscription of that plan has the add-on active. Each entry is a plan ID (`pln_…`) or a plan code. */
|
|
2681
2687
|
planIds?: Array<string>;
|
|
2682
2688
|
}
|
|
2683
2689
|
interface DeleteAddonParams {
|
|
@@ -2687,43 +2693,21 @@ interface ListAddonsParams {
|
|
|
2687
2693
|
cursor?: string;
|
|
2688
2694
|
limit?: number;
|
|
2689
2695
|
}
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
description?: string;
|
|
2693
|
-
basePrice: number;
|
|
2694
|
-
featureId: string;
|
|
2695
|
-
/** Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2696
|
-
planIds?: Array<string>;
|
|
2697
|
-
consumptionModel: "boolean";
|
|
2698
|
-
} | {
|
|
2699
|
-
name: string;
|
|
2700
|
-
description?: string;
|
|
2701
|
-
basePrice: number;
|
|
2702
|
-
featureId: string;
|
|
2703
|
-
/** Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2704
|
-
planIds?: Array<string>;
|
|
2705
|
-
consumptionModel: "metered";
|
|
2706
|
-
includedUnits: number;
|
|
2707
|
-
overageRate: number;
|
|
2708
|
-
} | {
|
|
2709
|
-
name: string;
|
|
2710
|
-
description?: string;
|
|
2711
|
-
basePrice: number;
|
|
2712
|
-
featureId: string;
|
|
2713
|
-
/** Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2714
|
-
planIds?: Array<string>;
|
|
2715
|
-
consumptionModel: "credits";
|
|
2716
|
-
creditCost: number;
|
|
2717
|
-
} | {
|
|
2696
|
+
interface CreateAddonParams {
|
|
2697
|
+
consumptionModel: "boolean" | "metered" | "credits" | "balance";
|
|
2718
2698
|
name: string;
|
|
2719
2699
|
description?: string;
|
|
2720
2700
|
basePrice: number;
|
|
2721
2701
|
featureId: string;
|
|
2722
|
-
/** Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2702
|
+
/** Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. Each entry is a plan ID (`pln_…`) or a plan code. */
|
|
2723
2703
|
planIds?: Array<string>;
|
|
2724
|
-
consumptionModel
|
|
2725
|
-
|
|
2726
|
-
|
|
2704
|
+
/** Required when `consumptionModel` is `metered`. Only when `consumptionModel` is `metered`. */
|
|
2705
|
+
includedUnits?: number;
|
|
2706
|
+
/** Required when `consumptionModel` is `metered` or `balance`. Only when `consumptionModel` is `metered` or `balance`. */
|
|
2707
|
+
overageRate?: number;
|
|
2708
|
+
/** Required when `consumptionModel` is `credits`. Only when `consumptionModel` is `credits`. */
|
|
2709
|
+
creditCost?: number;
|
|
2710
|
+
}
|
|
2727
2711
|
declare class AddonsResource {
|
|
2728
2712
|
private httpClient;
|
|
2729
2713
|
constructor(httpClient: CommetHTTPClient);
|
|
@@ -2762,25 +2746,44 @@ interface CreateApiKeyParams {
|
|
|
2762
2746
|
name: string;
|
|
2763
2747
|
expiresInDays?: number;
|
|
2764
2748
|
permissions?: {
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2749
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2750
|
+
customer?: Array<"read" | "write">;
|
|
2751
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2752
|
+
subscription?: Array<"read" | "write">;
|
|
2753
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2754
|
+
invoice?: Array<"read" | "write">;
|
|
2755
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2756
|
+
usage?: Array<"read" | "write">;
|
|
2757
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2758
|
+
seat?: Array<"read" | "write">;
|
|
2759
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2760
|
+
plan?: Array<"read" | "write">;
|
|
2761
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2762
|
+
plan_group?: Array<"read" | "write">;
|
|
2763
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2764
|
+
feature?: Array<"read" | "write">;
|
|
2765
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2766
|
+
addon?: Array<"read" | "write">;
|
|
2767
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2768
|
+
credit_pack?: Array<"read" | "write">;
|
|
2769
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2770
|
+
offer?: Array<"read" | "write">;
|
|
2771
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2772
|
+
promo_code?: Array<"read" | "write">;
|
|
2773
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2774
|
+
market_group?: Array<"read" | "write">;
|
|
2775
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2776
|
+
payment?: Array<"read" | "write">;
|
|
2777
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2778
|
+
transaction?: Array<"read" | "write">;
|
|
2779
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2780
|
+
payout?: Array<"read" | "write">;
|
|
2781
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2782
|
+
test_clock?: Array<"read" | "write">;
|
|
2783
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2784
|
+
organization?: Array<"read" | "write">;
|
|
2785
|
+
/** Empty for no access, `read` to read, or `read` and `write`, in either order, to read and write. `write` requires `read`. */
|
|
2786
|
+
api_key?: Array<"read" | "write">;
|
|
2784
2787
|
};
|
|
2785
2788
|
}
|
|
2786
2789
|
declare class ApiKeysResource {
|
|
@@ -2806,7 +2809,7 @@ interface UpdateCreditPackParams {
|
|
|
2806
2809
|
credits?: number;
|
|
2807
2810
|
price?: number;
|
|
2808
2811
|
isActive?: boolean;
|
|
2809
|
-
/** Plans that sell the credit pack, replacing the current ones. Empty means every plan; omitted keeps them. */
|
|
2812
|
+
/** Plans that sell the credit pack, replacing the current ones. Empty means every plan; omitted keeps them. Each entry is a plan ID (`pln_…`) or a plan code. */
|
|
2810
2813
|
planIds?: Array<string>;
|
|
2811
2814
|
}
|
|
2812
2815
|
interface DeleteCreditPackParams {
|
|
@@ -2818,7 +2821,7 @@ interface CreateCreditPackParams {
|
|
|
2818
2821
|
credits: number;
|
|
2819
2822
|
price: number;
|
|
2820
2823
|
isActive?: boolean;
|
|
2821
|
-
/** Plans that sell the credit pack. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2824
|
+
/** Plans that sell the credit pack. Omitted or empty, every plan sells it. Plans created later sell it too. Each entry is a plan ID (`pln_…`) or a plan code. */
|
|
2822
2825
|
planIds?: Array<string>;
|
|
2823
2826
|
}
|
|
2824
2827
|
declare class CreditPacksResource {
|
|
@@ -2859,50 +2862,37 @@ interface RevokePlanGrantParams {
|
|
|
2859
2862
|
grantId: string;
|
|
2860
2863
|
reason: string;
|
|
2861
2864
|
}
|
|
2862
|
-
|
|
2863
|
-
id: string;
|
|
2864
|
-
grantId: string;
|
|
2865
|
-
reason: string;
|
|
2866
|
-
duration: "cycles";
|
|
2867
|
-
durationCycles: number;
|
|
2868
|
-
} | {
|
|
2869
|
-
id: string;
|
|
2870
|
-
grantId: string;
|
|
2871
|
-
reason: string;
|
|
2872
|
-
duration: "until_date";
|
|
2873
|
-
/** @format date-time */
|
|
2874
|
-
expiresAt: string;
|
|
2875
|
-
} | {
|
|
2865
|
+
interface UpdatePlanGrantParams {
|
|
2876
2866
|
id: string;
|
|
2877
2867
|
grantId: string;
|
|
2868
|
+
duration: "cycles" | "until_date" | "until_revoked";
|
|
2878
2869
|
reason: string;
|
|
2879
|
-
duration
|
|
2880
|
-
|
|
2870
|
+
/** Required when `duration` is `cycles`. Ignored when `duration` is `until_date` or `until_revoked`. */
|
|
2871
|
+
durationCycles?: number;
|
|
2872
|
+
/**
|
|
2873
|
+
* Required when `duration` is `until_date`. Ignored when `duration` is `cycles` or `until_revoked`.
|
|
2874
|
+
* @format date-time
|
|
2875
|
+
*/
|
|
2876
|
+
expiresAt?: string;
|
|
2877
|
+
}
|
|
2881
2878
|
interface ListPlanGrantsParams {
|
|
2882
2879
|
id: string;
|
|
2883
2880
|
}
|
|
2884
|
-
|
|
2885
|
-
id: string;
|
|
2886
|
-
subscriptionId: string;
|
|
2887
|
-
planId: string;
|
|
2888
|
-
reason: string;
|
|
2889
|
-
duration: "cycles";
|
|
2890
|
-
durationCycles: number;
|
|
2891
|
-
} | {
|
|
2892
|
-
id: string;
|
|
2893
|
-
subscriptionId: string;
|
|
2894
|
-
planId: string;
|
|
2895
|
-
reason: string;
|
|
2896
|
-
duration: "until_date";
|
|
2897
|
-
/** @format date-time */
|
|
2898
|
-
expiresAt: string;
|
|
2899
|
-
} | {
|
|
2881
|
+
interface CreatePlanGrantParams {
|
|
2900
2882
|
id: string;
|
|
2883
|
+
duration: "cycles" | "until_date" | "until_revoked";
|
|
2901
2884
|
subscriptionId: string;
|
|
2885
|
+
/** The plan's ID (`pln_…`) or its code. */
|
|
2902
2886
|
planId: string;
|
|
2903
2887
|
reason: string;
|
|
2904
|
-
duration
|
|
2905
|
-
|
|
2888
|
+
/** Required when `duration` is `cycles`. Ignored when `duration` is `until_date` or `until_revoked`. */
|
|
2889
|
+
durationCycles?: number;
|
|
2890
|
+
/**
|
|
2891
|
+
* Required when `duration` is `until_date`. Ignored when `duration` is `cycles` or `until_revoked`.
|
|
2892
|
+
* @format date-time
|
|
2893
|
+
*/
|
|
2894
|
+
expiresAt?: string;
|
|
2895
|
+
}
|
|
2906
2896
|
interface GetCustomerParams {
|
|
2907
2897
|
id: string;
|
|
2908
2898
|
}
|
|
@@ -3176,28 +3166,21 @@ interface UpdateOfferParams {
|
|
|
3176
3166
|
id: string;
|
|
3177
3167
|
name: string;
|
|
3178
3168
|
phases: Array<{
|
|
3179
|
-
type: "percentage";
|
|
3180
|
-
|
|
3181
|
-
/** 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. */
|
|
3182
|
-
durationInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null;
|
|
3183
|
-
/** Discount in basis points. 5000 means 50%. */
|
|
3184
|
-
percentage: number;
|
|
3185
|
-
} | {
|
|
3186
|
-
type: "amount_off";
|
|
3169
|
+
type: "percentage" | "amount_off" | "fixed_price";
|
|
3170
|
+
/** Cycles the phase lasts. `null` for a phase that never ends, which must be the last phase. */
|
|
3187
3171
|
durationCycles: number | null;
|
|
3188
3172
|
/** 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. */
|
|
3189
3173
|
durationInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null;
|
|
3190
|
-
|
|
3174
|
+
/** Discount in basis points. 5000 means 50%. Required when `type` is `percentage`. Ignored when `type` is `amount_off` or `fixed_price`. */
|
|
3175
|
+
percentage?: number;
|
|
3176
|
+
/** Each currency at most once, including a USD value. Each amount off is greater than 0. Required when `type` is `amount_off`. Ignored when `type` is `percentage` or `fixed_price`. */
|
|
3177
|
+
amounts?: Array<{
|
|
3191
3178
|
currency: string;
|
|
3192
3179
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
3193
3180
|
amount: number;
|
|
3194
3181
|
}>;
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
durationCycles: number | null;
|
|
3198
|
-
/** 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. */
|
|
3199
|
-
durationInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null;
|
|
3200
|
-
prices: Array<{
|
|
3182
|
+
/** Each currency at most once, including a USD value. Each price meets its currency's minimum charge, unless every price is 0 (a gifted phase). Required when `type` is `fixed_price`. Ignored when `type` is `percentage` or `amount_off`. */
|
|
3183
|
+
prices?: Array<{
|
|
3201
3184
|
currency: string;
|
|
3202
3185
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
3203
3186
|
amount: number;
|
|
@@ -3205,8 +3188,13 @@ interface UpdateOfferParams {
|
|
|
3205
3188
|
}>;
|
|
3206
3189
|
metadata?: Record<string, unknown>;
|
|
3207
3190
|
startsAt?: string | null;
|
|
3191
|
+
/** After `startsAt`. */
|
|
3208
3192
|
endsAt?: string | null;
|
|
3209
3193
|
active?: boolean;
|
|
3194
|
+
/** Plans the offer is limited to: it cannot be applied to a subscription on another plan, and an applied offer ends when the subscriber changes to one. An empty list removes the limit. Omit to keep the current limit. Each entry is a plan ID (`pln_…`) or a plan code. */
|
|
3195
|
+
planIds?: Array<string>;
|
|
3196
|
+
/** Billing interval the offer is limited to: it cannot be applied to a subscription on another interval, and an applied offer ends when the subscriber changes to one. Null removes the limit. Omit to keep the current limit. */
|
|
3197
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null;
|
|
3210
3198
|
}
|
|
3211
3199
|
interface DeleteOfferParams {
|
|
3212
3200
|
id: string;
|
|
@@ -3219,28 +3207,21 @@ interface ListOffersParams {
|
|
|
3219
3207
|
interface CreateOfferParams {
|
|
3220
3208
|
name: string;
|
|
3221
3209
|
phases: Array<{
|
|
3222
|
-
type: "percentage";
|
|
3210
|
+
type: "percentage" | "amount_off" | "fixed_price";
|
|
3211
|
+
/** Cycles the phase lasts. `null` for a phase that never ends, which must be the last phase. */
|
|
3223
3212
|
durationCycles: number | null;
|
|
3224
3213
|
/** 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. */
|
|
3225
3214
|
durationInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null;
|
|
3226
|
-
/** Discount in basis points. 5000 means 50%. */
|
|
3227
|
-
percentage
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
durationCycles: number | null;
|
|
3231
|
-
/** 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. */
|
|
3232
|
-
durationInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null;
|
|
3233
|
-
amounts: Array<{
|
|
3215
|
+
/** Discount in basis points. 5000 means 50%. Required when `type` is `percentage`. Ignored when `type` is `amount_off` or `fixed_price`. */
|
|
3216
|
+
percentage?: number;
|
|
3217
|
+
/** Each currency at most once, including a USD value. Each amount off is greater than 0. Required when `type` is `amount_off`. Ignored when `type` is `percentage` or `fixed_price`. */
|
|
3218
|
+
amounts?: Array<{
|
|
3234
3219
|
currency: string;
|
|
3235
3220
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
3236
3221
|
amount: number;
|
|
3237
3222
|
}>;
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
durationCycles: number | null;
|
|
3241
|
-
/** 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. */
|
|
3242
|
-
durationInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null;
|
|
3243
|
-
prices: Array<{
|
|
3223
|
+
/** Each currency at most once, including a USD value. Each price meets its currency's minimum charge, unless every price is 0 (a gifted phase). Required when `type` is `fixed_price`. Ignored when `type` is `percentage` or `amount_off`. */
|
|
3224
|
+
prices?: Array<{
|
|
3244
3225
|
currency: string;
|
|
3245
3226
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
3246
3227
|
amount: number;
|
|
@@ -3248,8 +3229,13 @@ interface CreateOfferParams {
|
|
|
3248
3229
|
}>;
|
|
3249
3230
|
metadata?: Record<string, unknown>;
|
|
3250
3231
|
startsAt?: string | null;
|
|
3232
|
+
/** After `startsAt`. */
|
|
3251
3233
|
endsAt?: string | null;
|
|
3252
3234
|
active?: boolean;
|
|
3235
|
+
/** Plans the offer is limited to: it cannot be applied to a subscription on another plan, and an applied offer ends when the subscriber changes to one. An empty list removes the limit. Omit to keep the current limit. Each entry is a plan ID (`pln_…`) or a plan code. */
|
|
3236
|
+
planIds?: Array<string>;
|
|
3237
|
+
/** Billing interval the offer is limited to: it cannot be applied to a subscription on another interval, and an applied offer ends when the subscriber changes to one. Null removes the limit. Omit to keep the current limit. */
|
|
3238
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null;
|
|
3253
3239
|
}
|
|
3254
3240
|
declare class OffersResource {
|
|
3255
3241
|
private httpClient;
|
|
@@ -3267,7 +3253,7 @@ declare class OffersResource {
|
|
|
3267
3253
|
hasMore: boolean;
|
|
3268
3254
|
nextCursor?: string;
|
|
3269
3255
|
}>;
|
|
3270
|
-
/** Create reusable offer terms
|
|
3256
|
+
/** Create reusable offer terms. An offer applies to any plan and billing interval unless `planIds` or `billingInterval` limit it. */
|
|
3271
3257
|
create(params: CreateOfferParams, options?: RequestOptions): Promise<Offer>;
|
|
3272
3258
|
}
|
|
3273
3259
|
|
|
@@ -3290,6 +3276,7 @@ interface ListPaymentsParams {
|
|
|
3290
3276
|
customerId?: string;
|
|
3291
3277
|
}
|
|
3292
3278
|
interface CreatePaymentParams {
|
|
3279
|
+
/** In the currency's minor unit, at least the currency's minimum charge. */
|
|
3293
3280
|
amount: number;
|
|
3294
3281
|
currency: string;
|
|
3295
3282
|
customerId?: string;
|
|
@@ -3348,10 +3335,12 @@ interface RemovePlanFromGroupParams {
|
|
|
3348
3335
|
}
|
|
3349
3336
|
interface ReorderPlansInGroupParams {
|
|
3350
3337
|
id: string;
|
|
3338
|
+
/** Each entry is a plan ID (`pln_…`) or a plan code. */
|
|
3351
3339
|
planIds: Array<string>;
|
|
3352
3340
|
}
|
|
3353
3341
|
interface AddPlanToGroupParams {
|
|
3354
3342
|
id: string;
|
|
3343
|
+
/** The plan's ID (`pln_…`) or its code. */
|
|
3355
3344
|
planId: string;
|
|
3356
3345
|
sortOrder?: number;
|
|
3357
3346
|
}
|
|
@@ -3402,45 +3391,14 @@ declare class PlanGroupsResource {
|
|
|
3402
3391
|
create(params: CreatePlanGroupParams, options?: RequestOptions): Promise<PlanGroup>;
|
|
3403
3392
|
}
|
|
3404
3393
|
|
|
3405
|
-
|
|
3406
|
-
id: string;
|
|
3407
|
-
draftId: string;
|
|
3408
|
-
/** current sells the draft to every new buyer. */
|
|
3409
|
-
publishAs: "current";
|
|
3410
|
-
/** What happens to subscribers of earlier versions: keep them, move them at their next renewal, or move them now (features and balance change today, the price at renewal). Nobody moves unless every one of them fits or has a change below. */
|
|
3411
|
-
move?: "keep" | "period_end" | "now";
|
|
3412
|
-
/** Per-subscriber changes that make each one fit, applied at its renewal. */
|
|
3413
|
-
changes?: Array<{
|
|
3414
|
-
subscriptionId: string;
|
|
3415
|
-
/** Leave this subscriber on its version. */
|
|
3416
|
-
keepOnVersion?: true;
|
|
3417
|
-
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
3418
|
-
/** Lower its seats to the version's limit at renewal. */
|
|
3419
|
-
seatLimit?: true;
|
|
3420
|
-
/** Add-ons it stops paying at renewal. */
|
|
3421
|
-
removeAddonIds?: Array<string>;
|
|
3422
|
-
/** 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. */
|
|
3423
|
-
currency?: string;
|
|
3424
|
-
}>;
|
|
3425
|
-
/** Check everything without publishing. */
|
|
3426
|
-
preview?: boolean;
|
|
3427
|
-
} | {
|
|
3428
|
-
id: string;
|
|
3429
|
-
draftId: string;
|
|
3430
|
-
/** experiment starts an experiment with experimentCode, sold with planCode plan:code. Starting an experiment moves nobody, so it takes no move or changes. */
|
|
3431
|
-
publishAs: "experiment";
|
|
3432
|
-
/** The experiment's own code, after the plan's code. */
|
|
3433
|
-
experimentCode: string;
|
|
3434
|
-
/** Check everything without publishing. */
|
|
3435
|
-
preview?: boolean;
|
|
3436
|
-
} | {
|
|
3394
|
+
interface PublishPlanDraftParams {
|
|
3437
3395
|
id: string;
|
|
3438
3396
|
draftId: string;
|
|
3439
|
-
/** experiment_version publishes the next version of the experiment the draft started from. */
|
|
3440
|
-
publishAs: "experiment_version";
|
|
3441
|
-
/** What happens to subscribers of earlier versions: keep them, move them at their next renewal, or move them now (features and balance change today, the price at renewal). Nobody moves unless every one of them fits or has a change below. */
|
|
3397
|
+
/** current sells the draft to every new buyer. experiment starts an experiment with experimentCode, sold with planCode plan:code. Starting an experiment moves nobody, so it takes no move or changes. experiment_version publishes the next version of the experiment the draft started from. */
|
|
3398
|
+
publishAs: "current" | "experiment" | "experiment_version";
|
|
3399
|
+
/** What happens to subscribers of earlier versions: keep them, move them at their next renewal, or move them now (features and balance change today, the price at renewal). Nobody moves unless every one of them fits or has a change below. Only when `publishAs` is `current` or `experiment_version`. Defaults to `keep` when `publishAs` is `current` or `experiment_version`. */
|
|
3442
3400
|
move?: "keep" | "period_end" | "now";
|
|
3443
|
-
/** Per-subscriber changes that make each one fit, applied at its renewal. */
|
|
3401
|
+
/** Per-subscriber changes that make each one fit, applied at its renewal. Only when `publishAs` is `current` or `experiment_version`. Defaults to `[]` when `publishAs` is `current` or `experiment_version`. */
|
|
3444
3402
|
changes?: Array<{
|
|
3445
3403
|
subscriptionId: string;
|
|
3446
3404
|
/** Leave this subscriber on its version. */
|
|
@@ -3453,9 +3411,11 @@ type PublishPlanDraftParams = {
|
|
|
3453
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. */
|
|
3454
3412
|
currency?: string;
|
|
3455
3413
|
}>;
|
|
3414
|
+
/** The experiment's own code, after the plan's code. Required when `publishAs` is `experiment`. Ignored when `publishAs` is `current` or `experiment_version`. */
|
|
3415
|
+
experimentCode?: string;
|
|
3456
3416
|
/** Check everything without publishing. */
|
|
3457
3417
|
preview?: boolean;
|
|
3458
|
-
}
|
|
3418
|
+
}
|
|
3459
3419
|
interface GetPlanDraftParams {
|
|
3460
3420
|
id: string;
|
|
3461
3421
|
draftId: string;
|
|
@@ -3486,14 +3446,12 @@ interface UpdatePlanDraftParams {
|
|
|
3486
3446
|
exchangeRate?: number | null;
|
|
3487
3447
|
prices: Array<{
|
|
3488
3448
|
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3489
|
-
/** The price set by hand, in the currency's minor unit. */
|
|
3490
|
-
price
|
|
3491
|
-
/** The balance included each period in this country, in the currency's minor unit. Required when the plan's price includes a balance. */
|
|
3449
|
+
/** The price set by hand, in the currency's minor unit. Required unless `followBase` is sent. Ignored when `followBase` is true and `price` or `includedBalance` is invalid. */
|
|
3450
|
+
price?: number;
|
|
3451
|
+
/** The balance included each period in this country, in the currency's minor unit. Required when the plan's price includes a balance. Ignored when `followBase` is true and `price` or `includedBalance` is invalid. Ignored unless `price` is sent. */
|
|
3492
3452
|
includedBalance?: number;
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
/** Follow the USD base at the exchange rate. */
|
|
3496
|
-
followBase: true;
|
|
3453
|
+
/** Follow the USD base at the exchange rate. Required unless `price` is sent. Ignored when `price` is sent, unless it is true and `price` or `includedBalance` is invalid. */
|
|
3454
|
+
followBase?: true;
|
|
3497
3455
|
}>;
|
|
3498
3456
|
/** Smallest balance top-up in this country, in the currency's minor unit. Null follows the USD minimum at the exchange rate; left out keeps it. */
|
|
3499
3457
|
topUpMinimum?: number | null;
|
|
@@ -3504,22 +3462,18 @@ interface UpdatePlanDraftParams {
|
|
|
3504
3462
|
/** What the country pays for each add-on the draft sells. Left out keeps the country's add-on prices; sent, it replaces them, and add-ons not listed follow the USD price. */
|
|
3505
3463
|
addonPrices?: Array<{
|
|
3506
3464
|
addonId: string;
|
|
3507
|
-
/** The add-on's price set by hand, in the currency's minor unit. */
|
|
3508
|
-
price
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
/** Follow the add-on's USD price at the exchange rate. */
|
|
3512
|
-
followBase: true;
|
|
3465
|
+
/** The add-on's price set by hand, in the currency's minor unit. Required unless `followBase` is sent. Ignored when `followBase` is true and `price` is invalid. */
|
|
3466
|
+
price?: number;
|
|
3467
|
+
/** Follow the add-on's USD price at the exchange rate. Required unless `price` is sent. Ignored when `price` is sent, unless it is true and `price` is invalid. */
|
|
3468
|
+
followBase?: true;
|
|
3513
3469
|
}>;
|
|
3514
3470
|
/** What the country pays for each credit pack the draft sells. Left out keeps the country's pack prices; sent, it replaces them, and packs not listed follow the USD price. */
|
|
3515
3471
|
creditPackPrices?: Array<{
|
|
3516
3472
|
creditPackId: string;
|
|
3517
|
-
/** The pack's price set by hand, in the currency's minor unit. */
|
|
3518
|
-
price
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
/** Follow the pack's USD price at the exchange rate. */
|
|
3522
|
-
followBase: true;
|
|
3473
|
+
/** The pack's price set by hand, in the currency's minor unit. Required unless `followBase` is sent. Ignored when `followBase` is true and `price` is invalid. */
|
|
3474
|
+
price?: number;
|
|
3475
|
+
/** Follow the pack's USD price at the exchange rate. Required unless `price` is sent. Ignored when `price` is sent, unless it is true and `price` is invalid. */
|
|
3476
|
+
followBase?: true;
|
|
3523
3477
|
}>;
|
|
3524
3478
|
}>;
|
|
3525
3479
|
/** Credit or balance rules; fields left out stay as they are. */
|
|
@@ -3652,7 +3606,9 @@ interface UpdatePlanFeatureParams {
|
|
|
3652
3606
|
id: string;
|
|
3653
3607
|
featureId: string;
|
|
3654
3608
|
enabled?: boolean;
|
|
3609
|
+
/** Must be 0 when `unlimited` is true, sent or already set on the plan feature. */
|
|
3655
3610
|
includedAmount?: number;
|
|
3611
|
+
/** When true, `includedAmount` must be 0, sent or already set on the plan feature. */
|
|
3656
3612
|
unlimited?: boolean;
|
|
3657
3613
|
overage?: {
|
|
3658
3614
|
enabled?: boolean;
|
|
@@ -3666,16 +3622,22 @@ interface RemovePlanFeatureParams {
|
|
|
3666
3622
|
}
|
|
3667
3623
|
interface AddPlanFeatureParams {
|
|
3668
3624
|
id: string;
|
|
3625
|
+
/** The feature's ID (`ftr_…`) or its code. */
|
|
3669
3626
|
featureId: string;
|
|
3670
3627
|
enabled?: boolean;
|
|
3628
|
+
/** Must be 0 when `unlimited` is true. */
|
|
3671
3629
|
includedAmount?: number;
|
|
3630
|
+
/** When true, `includedAmount` must be 0. */
|
|
3672
3631
|
unlimited?: boolean;
|
|
3673
3632
|
overage?: {
|
|
3674
3633
|
enabled?: boolean;
|
|
3634
|
+
/** Must be above 0 when `enabled` is true, `pricingMode` is `fixed` and the plan is metered or balance. */
|
|
3675
3635
|
unitPrice?: number;
|
|
3676
3636
|
};
|
|
3637
|
+
/** Above 0 only on a credits plan. */
|
|
3677
3638
|
creditsPerUnit?: number | null;
|
|
3678
3639
|
pricingMode?: "fixed" | "ai_model";
|
|
3640
|
+
/** Required when `overage.enabled` is true, `pricingMode` is `ai_model` and the plan is metered or balance. */
|
|
3679
3641
|
margin?: number | null;
|
|
3680
3642
|
}
|
|
3681
3643
|
interface CancelPlanMoveParams {
|
|
@@ -3694,33 +3656,12 @@ interface CancelPlanMoveSubscriptionParams {
|
|
|
3694
3656
|
interface ListPlanMovesParams {
|
|
3695
3657
|
id: string;
|
|
3696
3658
|
}
|
|
3697
|
-
|
|
3698
|
-
id: string;
|
|
3699
|
-
/** Public IDs of the subscriptions to move. */
|
|
3700
|
-
subscriptionIds: Array<string>;
|
|
3701
|
-
/** The version subscribers move to. */
|
|
3702
|
-
toVersionId: string;
|
|
3703
|
-
/** now changes features and the included amount today and the price at renewal; period_end moves each subscriber at its next renewal. */
|
|
3704
|
-
effective: "now" | "period_end";
|
|
3705
|
-
/** Per-subscriber changes that make each one fit, applied at its renewal. */
|
|
3706
|
-
changes?: Array<{
|
|
3707
|
-
subscriptionId: string;
|
|
3708
|
-
/** Leave this subscriber on its version. */
|
|
3709
|
-
keepOnVersion?: true;
|
|
3710
|
-
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
3711
|
-
/** Lower its seats to the version's limit at renewal. */
|
|
3712
|
-
seatLimit?: true;
|
|
3713
|
-
/** Add-ons it stops paying at renewal. */
|
|
3714
|
-
removeAddonIds?: Array<string>;
|
|
3715
|
-
/** 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. */
|
|
3716
|
-
currency?: string;
|
|
3717
|
-
}>;
|
|
3718
|
-
/** Check every subscriber without moving anyone. */
|
|
3719
|
-
preview?: boolean;
|
|
3720
|
-
} | {
|
|
3659
|
+
interface CreatePlanMoveParams {
|
|
3721
3660
|
id: string;
|
|
3722
|
-
/**
|
|
3723
|
-
|
|
3661
|
+
/** Public IDs of the subscriptions to move. Required unless `fromVersionId` is sent. Cannot be combined with `fromVersionId`. */
|
|
3662
|
+
subscriptionIds?: Array<string>;
|
|
3663
|
+
/** Move every active, trialing and past due subscription on this version of the plan. Another version than `toVersionId`. Required unless `subscriptionIds` is sent. Cannot be combined with `subscriptionIds`. */
|
|
3664
|
+
fromVersionId?: string;
|
|
3724
3665
|
/** The version subscribers move to. */
|
|
3725
3666
|
toVersionId: string;
|
|
3726
3667
|
/** now changes features and the included amount today and the price at renewal; period_end moves each subscriber at its next renewal. */
|
|
@@ -3740,7 +3681,7 @@ type CreatePlanMoveParams = {
|
|
|
3740
3681
|
}>;
|
|
3741
3682
|
/** Check every subscriber without moving anyone. */
|
|
3742
3683
|
preview?: boolean;
|
|
3743
|
-
}
|
|
3684
|
+
}
|
|
3744
3685
|
interface KeepPlanSubscriberOnVersionParams {
|
|
3745
3686
|
id: string;
|
|
3746
3687
|
subscriptionId: string;
|
|
@@ -3787,17 +3728,23 @@ interface DeletePlanPriceParams {
|
|
|
3787
3728
|
id: string;
|
|
3788
3729
|
priceId: string;
|
|
3789
3730
|
}
|
|
3790
|
-
|
|
3731
|
+
interface AddPlanPriceParams {
|
|
3791
3732
|
id: string;
|
|
3792
3733
|
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3793
3734
|
metadata?: Record<string, unknown>;
|
|
3794
|
-
price
|
|
3735
|
+
/** The base price, in the currency's minor unit. Required unless `inheritsFromPriceId` is sent. Cannot be combined with `inheritsFromPriceId`. */
|
|
3736
|
+
price?: number;
|
|
3737
|
+
/** Cannot be combined with `inheritsFromPriceId`. */
|
|
3795
3738
|
trialDays?: number;
|
|
3796
|
-
/** Set to false so the price's free trial starts without a payment method. Requires trialDays on the price. */
|
|
3739
|
+
/** Set to false so the price's free trial starts without a payment method. Requires trialDays on the price. Cannot be combined with `inheritsFromPriceId`. */
|
|
3797
3740
|
trialRequiresPaymentMethod?: boolean;
|
|
3741
|
+
/** Cannot be combined with `inheritsFromPriceId`. */
|
|
3798
3742
|
isDefault?: boolean;
|
|
3743
|
+
/** Only on a balance plan. Cannot be combined with `inheritsFromPriceId`. */
|
|
3799
3744
|
includedBalance?: number | null;
|
|
3745
|
+
/** Only on a credits plan. Cannot be combined with `inheritsFromPriceId`. */
|
|
3800
3746
|
includedCredits?: number | null;
|
|
3747
|
+
/** Market price overrides. Optional on a base price, where currency pricing remains the fallback elsewhere. Required when `inheritsFromPriceId` is sent. */
|
|
3801
3748
|
marketPrices?: Array<{
|
|
3802
3749
|
/** Public ID of a reusable pricing market group. */
|
|
3803
3750
|
marketGroupId: string;
|
|
@@ -3806,20 +3753,9 @@ type AddPlanPriceParams = {
|
|
|
3806
3753
|
/** Market price in the currency's minor unit. */
|
|
3807
3754
|
price: number;
|
|
3808
3755
|
}>;
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
metadata?: Record<string, unknown>;
|
|
3813
|
-
inheritsFromPriceId: string;
|
|
3814
|
-
marketPrices: Array<{
|
|
3815
|
-
/** Public ID of a reusable pricing market group. */
|
|
3816
|
-
marketGroupId: string;
|
|
3817
|
-
/** Presentment currency configured for this plan and market. */
|
|
3818
|
-
currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "gbp" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb";
|
|
3819
|
-
/** Market price in the currency's minor unit. */
|
|
3820
|
-
price: number;
|
|
3821
|
-
}>;
|
|
3822
|
-
};
|
|
3756
|
+
/** Makes the price a selectable market price variant of this base price. It inherits the base terms and must override at least one market already configured on the base price. Required unless `price` is sent. Cannot be combined with `price`. Cannot be combined with `trialDays`. Cannot be combined with `trialRequiresPaymentMethod`. Cannot be combined with `isDefault`. Cannot be combined with `includedBalance`. Cannot be combined with `includedCredits`. */
|
|
3757
|
+
inheritsFromPriceId?: string;
|
|
3758
|
+
}
|
|
3823
3759
|
interface SetPlanRegionalPricingParams {
|
|
3824
3760
|
id: string;
|
|
3825
3761
|
currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "gbp" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb";
|
|
@@ -3830,6 +3766,7 @@ interface SetPlanRegionalPricingParams {
|
|
|
3830
3766
|
includedBalance?: number;
|
|
3831
3767
|
}>;
|
|
3832
3768
|
features?: Array<{
|
|
3769
|
+
/** The feature's ID (`ftr_…`) or its code. */
|
|
3833
3770
|
featureId: string;
|
|
3834
3771
|
overageUnitPrice: number;
|
|
3835
3772
|
}>;
|
|
@@ -3845,11 +3782,10 @@ interface UpdatePlanParams {
|
|
|
3845
3782
|
isPublic?: boolean;
|
|
3846
3783
|
/** Credits plans only. What happens to unused plan credits at each reset. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
|
|
3847
3784
|
unusedPlanCredits?: {
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
type
|
|
3851
|
-
|
|
3852
|
-
maxPlanCredits: number | null;
|
|
3785
|
+
/** `expire`: each reset replaces unused plan credits with the price's included credits. `roll_over`: unused plan credits roll over: each reset adds the price's included credits to them. */
|
|
3786
|
+
type: "expire" | "roll_over";
|
|
3787
|
+
/** 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. Required when `type` is `roll_over`. Ignored when `type` is `expire`. */
|
|
3788
|
+
maxPlanCredits?: number | null;
|
|
3853
3789
|
};
|
|
3854
3790
|
/** 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. */
|
|
3855
3791
|
unlimitedPlanCredits?: boolean;
|
|
@@ -3862,11 +3798,10 @@ interface UpdatePlanParams {
|
|
|
3862
3798
|
} | null;
|
|
3863
3799
|
/** Balance plans only. What happens to unused plan balance at each reset. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
|
|
3864
3800
|
unusedPlanBalance?: {
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
type
|
|
3868
|
-
|
|
3869
|
-
maxPlanBalance: number | null;
|
|
3801
|
+
/** `expire`: each reset replaces unused plan balance with the price's included balance. `roll_over`: unused plan balance rolls over: each reset adds the price's included balance to it. */
|
|
3802
|
+
type: "expire" | "roll_over";
|
|
3803
|
+
/** 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. Required when `type` is `roll_over`. Ignored when `type` is `expire`. */
|
|
3804
|
+
maxPlanBalance?: number | null;
|
|
3870
3805
|
};
|
|
3871
3806
|
/** 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. */
|
|
3872
3807
|
unlimitedPlanBalance?: boolean;
|
|
@@ -3879,7 +3814,7 @@ interface UpdatePlanParams {
|
|
|
3879
3814
|
} | null;
|
|
3880
3815
|
/** Credits and balance plans only. false lets usage continue past the plan and purchased amounts and bills the missing amount as overage at the next renewal; a credits plan bills it at the price per credit and needs one. Trials and free plans always stop, so free plans accept only true. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
|
|
3881
3816
|
blockOnExhaustion?: boolean;
|
|
3882
|
-
/** 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
|
|
3817
|
+
/** 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 (a cancellation from the API, dashboard or customer portal, a lost dispute, exhausted dunning or a card-less trial end) moves to it instead of canceling. Requires a free plan in a plan group; replaces the group's previous default plan. false unmarks it. */
|
|
3883
3818
|
isDefault?: boolean;
|
|
3884
3819
|
}
|
|
3885
3820
|
interface DeletePlanParams {
|
|
@@ -3943,11 +3878,10 @@ interface CreatePlanParams {
|
|
|
3943
3878
|
blockOnExhaustion?: boolean;
|
|
3944
3879
|
/** Credits plans only. What happens to unused plan credits at each reset; omitted means they expire. */
|
|
3945
3880
|
unusedPlanCredits?: {
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
type
|
|
3949
|
-
|
|
3950
|
-
maxPlanCredits: number | null;
|
|
3881
|
+
/** `expire`: each reset replaces unused plan credits with the price's included credits. `roll_over`: unused plan credits roll over: each reset adds the price's included credits to them. */
|
|
3882
|
+
type: "expire" | "roll_over";
|
|
3883
|
+
/** 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. Required when `type` is `roll_over`. Ignored when `type` is `expire`. */
|
|
3884
|
+
maxPlanCredits?: number | null;
|
|
3951
3885
|
};
|
|
3952
3886
|
/** 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. */
|
|
3953
3887
|
unlimitedPlanCredits?: boolean;
|
|
@@ -3960,11 +3894,10 @@ interface CreatePlanParams {
|
|
|
3960
3894
|
} | null;
|
|
3961
3895
|
/** Balance plans only. What happens to unused plan balance at each reset; omitted means it expires. */
|
|
3962
3896
|
unusedPlanBalance?: {
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
type
|
|
3966
|
-
|
|
3967
|
-
maxPlanBalance: number | null;
|
|
3897
|
+
/** `expire`: each reset replaces unused plan balance with the price's included balance. `roll_over`: unused plan balance rolls over: each reset adds the price's included balance to it. */
|
|
3898
|
+
type: "expire" | "roll_over";
|
|
3899
|
+
/** 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. Required when `type` is `roll_over`. Ignored when `type` is `expire`. */
|
|
3900
|
+
maxPlanBalance?: number | null;
|
|
3968
3901
|
};
|
|
3969
3902
|
/** 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. */
|
|
3970
3903
|
unlimitedPlanBalance?: boolean;
|
|
@@ -3976,7 +3909,7 @@ interface CreatePlanParams {
|
|
|
3976
3909
|
interval: "day" | "week";
|
|
3977
3910
|
} | null;
|
|
3978
3911
|
planGroupId?: string;
|
|
3979
|
-
/** 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
|
|
3912
|
+
/** 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 (a cancellation from the API, dashboard or customer portal, a lost dispute, exhausted dunning or a card-less trial end) moves to it instead of canceling. Requires a free plan with a planGroupId; replaces the group's previous default plan. */
|
|
3980
3913
|
isDefault?: boolean;
|
|
3981
3914
|
metadata?: Record<string, unknown>;
|
|
3982
3915
|
}
|
|
@@ -4093,18 +4026,18 @@ declare class PlansResource {
|
|
|
4093
4026
|
create(params: CreatePlanParams, options?: RequestOptions): Promise<Plan>;
|
|
4094
4027
|
}
|
|
4095
4028
|
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
customerId
|
|
4029
|
+
interface RequestPortalAccessParams {
|
|
4030
|
+
/** Required unless `customerId` is sent. Cannot be combined with `customerId`. */
|
|
4031
|
+
email?: string;
|
|
4032
|
+
/** Required unless `email` is sent. Cannot be combined with `email`. */
|
|
4033
|
+
customerId?: string;
|
|
4101
4034
|
returnUrl?: string;
|
|
4102
|
-
}
|
|
4035
|
+
}
|
|
4103
4036
|
declare class PortalResource {
|
|
4104
4037
|
private httpClient;
|
|
4105
4038
|
constructor(httpClient: CommetHTTPClient);
|
|
4106
4039
|
/** Generate a customer portal URL. Exactly one identifier (email or customerId) is required. */
|
|
4107
|
-
getUrl(params
|
|
4040
|
+
getUrl(params?: RequestPortalAccessParams, options?: RequestOptions): Promise<PortalAccess>;
|
|
4108
4041
|
}
|
|
4109
4042
|
|
|
4110
4043
|
interface GetPromoCodeParams {
|
|
@@ -4116,6 +4049,7 @@ interface UpdatePromoCodeParams {
|
|
|
4116
4049
|
maxRedemptions?: number | null;
|
|
4117
4050
|
expiresAt?: string | null;
|
|
4118
4051
|
active?: boolean;
|
|
4052
|
+
/** Each entry is a plan ID (`pln_…`) or a plan code. */
|
|
4119
4053
|
planIds?: Array<string>;
|
|
4120
4054
|
/** Whether the code only applies to a customer's first purchase: one with no paid invoice above zero and no paid subscription. */
|
|
4121
4055
|
firstPurchaseOnly?: boolean;
|
|
@@ -4131,6 +4065,7 @@ interface CreatePromoCodeParams {
|
|
|
4131
4065
|
maxRedemptions?: number;
|
|
4132
4066
|
/** @format date-time */
|
|
4133
4067
|
expiresAt?: string;
|
|
4068
|
+
/** Each entry is a plan ID (`pln_…`) or a plan code. */
|
|
4134
4069
|
planIds?: Array<string>;
|
|
4135
4070
|
/** 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. */
|
|
4136
4071
|
firstPurchaseOnly?: boolean;
|
|
@@ -4138,7 +4073,7 @@ interface CreatePromoCodeParams {
|
|
|
4138
4073
|
declare class PromoCodesResource {
|
|
4139
4074
|
private httpClient;
|
|
4140
4075
|
constructor(httpClient: CommetHTTPClient);
|
|
4141
|
-
/** Retrieve a promo code by its public ID. */
|
|
4076
|
+
/** Retrieve a promo code by its public ID or by the code customers enter, in any letter case. */
|
|
4142
4077
|
get(params: GetPromoCodeParams, options?: RequestOptions): Promise<PromoCode>;
|
|
4143
4078
|
/** Update a promo code's billing interval, redemption limits, expiration, active status, or plan restrictions. */
|
|
4144
4079
|
update(params: UpdatePromoCodeParams, options?: RequestOptions): Promise<PromoCode>;
|
|
@@ -4163,37 +4098,34 @@ declare class ProvisioningResource {
|
|
|
4163
4098
|
interface GetAllQuotaAllowancesParams {
|
|
4164
4099
|
customerId: string;
|
|
4165
4100
|
}
|
|
4166
|
-
|
|
4101
|
+
interface RemoveQuotaParams {
|
|
4167
4102
|
featureCode: string;
|
|
4168
4103
|
count?: number;
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
};
|
|
4104
|
+
/** Required unless `externalId` is sent. Cannot be combined with `externalId`. */
|
|
4105
|
+
customerId?: string;
|
|
4106
|
+
/** Required unless `customerId` is sent. Cannot be combined with `customerId`. */
|
|
4107
|
+
externalId?: string;
|
|
4108
|
+
}
|
|
4175
4109
|
interface GetQuotaAllowanceParams {
|
|
4176
4110
|
customerId: string;
|
|
4177
4111
|
featureCode: string;
|
|
4178
4112
|
}
|
|
4179
|
-
|
|
4180
|
-
featureCode: string;
|
|
4181
|
-
count?: number;
|
|
4182
|
-
customerId: string;
|
|
4183
|
-
} | {
|
|
4113
|
+
interface AddQuotaParams {
|
|
4184
4114
|
featureCode: string;
|
|
4185
4115
|
count?: number;
|
|
4186
|
-
externalId
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
} | {
|
|
4116
|
+
/** Required unless `externalId` is sent. Cannot be combined with `externalId`. */
|
|
4117
|
+
customerId?: string;
|
|
4118
|
+
/** Required unless `customerId` is sent. Cannot be combined with `customerId`. */
|
|
4119
|
+
externalId?: string;
|
|
4120
|
+
}
|
|
4121
|
+
interface SetQuotaParams {
|
|
4193
4122
|
featureCode: string;
|
|
4194
4123
|
count: number;
|
|
4195
|
-
externalId
|
|
4196
|
-
|
|
4124
|
+
/** Required unless `externalId` is sent. Cannot be combined with `externalId`. */
|
|
4125
|
+
customerId?: string;
|
|
4126
|
+
/** Required unless `customerId` is sent. Cannot be combined with `customerId`. */
|
|
4127
|
+
externalId?: string;
|
|
4128
|
+
}
|
|
4197
4129
|
declare class QuotaResource {
|
|
4198
4130
|
private httpClient;
|
|
4199
4131
|
constructor(httpClient: CommetHTTPClient);
|
|
@@ -4269,7 +4201,7 @@ interface DeactivateAddonParams {
|
|
|
4269
4201
|
interface ActivateAddonParams {
|
|
4270
4202
|
id: string;
|
|
4271
4203
|
addonId: string;
|
|
4272
|
-
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected
|
|
4204
|
+
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, or the saved method is declined or asks for authentication, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected in both cases. A saved method is always charged directly first, and a payment that fails for any other reason is rejected either way. */
|
|
4273
4205
|
successUrl?: string;
|
|
4274
4206
|
}
|
|
4275
4207
|
interface GetSubscriptionAutoTopUpParams {
|
|
@@ -4295,7 +4227,7 @@ interface TopupBalanceParams {
|
|
|
4295
4227
|
id: string;
|
|
4296
4228
|
/** The amount to add, in minor units of the subscription currency (cents; whole units for zero-decimal currencies). */
|
|
4297
4229
|
amount: number;
|
|
4298
|
-
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected
|
|
4230
|
+
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, or the saved method is declined or asks for authentication, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected in both cases. A saved method is always charged directly first, and a payment that fails for any other reason is rejected either way. */
|
|
4299
4231
|
successUrl?: string;
|
|
4300
4232
|
}
|
|
4301
4233
|
interface CancelSubscriptionParams {
|
|
@@ -4303,22 +4235,21 @@ interface CancelSubscriptionParams {
|
|
|
4303
4235
|
reason?: string;
|
|
4304
4236
|
immediate?: boolean;
|
|
4305
4237
|
}
|
|
4306
|
-
|
|
4238
|
+
interface ChangePlanParams {
|
|
4307
4239
|
id: string;
|
|
4308
|
-
newPlanId?: string;
|
|
4309
4240
|
newBillingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
4310
4241
|
successUrl?: string;
|
|
4242
|
+
/** Cannot be combined with `promoCode`. */
|
|
4311
4243
|
offerId?: string;
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4244
|
+
/** 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`. */
|
|
4245
|
+
promoCode?: string;
|
|
4246
|
+
/** The plan's ID (`pln_…`) or its code. Cannot be combined with `planCode`. */
|
|
4315
4247
|
newPlanId?: string;
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
};
|
|
4248
|
+
/** Code of the destination plan, or `<plan code>:<experiment code>` to change to the experiment's latest version while it runs (the plan's current version once the experiment is won or archived). Same rules as planCode on subscription creation. Cannot be combined with `newPlanId`. */
|
|
4249
|
+
planCode?: string;
|
|
4250
|
+
/** Public ID of a published version of the destination plan, current or not, including a running experiment's versions. The change is priced, checked out and activated on that version. Only for an immediate change to another paid plan, and not with an experiment code. When omitted, the change lands on the plan's current version, or the version its experiment code sells. Requires `newPlanId` or `planCode`. */
|
|
4251
|
+
planVersionId?: string;
|
|
4252
|
+
}
|
|
4322
4253
|
interface ChangeSubscriptionVersionParams {
|
|
4323
4254
|
id: string;
|
|
4324
4255
|
/** A published version of the subscription's plan. */
|
|
@@ -4328,22 +4259,22 @@ interface ChangeSubscriptionVersionParams {
|
|
|
4328
4259
|
/** 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. */
|
|
4329
4260
|
currency?: string;
|
|
4330
4261
|
}
|
|
4331
|
-
|
|
4332
|
-
id: string;
|
|
4333
|
-
creditPackId: string;
|
|
4334
|
-
quantity?: never;
|
|
4335
|
-
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way. */
|
|
4336
|
-
successUrl?: string;
|
|
4337
|
-
} | {
|
|
4262
|
+
interface PurchaseCreditsParams {
|
|
4338
4263
|
id: string;
|
|
4339
|
-
quantity
|
|
4340
|
-
|
|
4264
|
+
/** Required unless `quantity` is sent. Cannot be combined with `quantity`. */
|
|
4265
|
+
creditPackId?: string;
|
|
4266
|
+
/** Required unless `creditPackId` is sent. Cannot be combined with `creditPackId`. */
|
|
4267
|
+
quantity?: number;
|
|
4268
|
+
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, or the saved method is declined or asks for authentication, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected in both cases. A saved method is always charged directly first, and a payment that fails for any other reason is rejected either way. */
|
|
4341
4269
|
successUrl?: string;
|
|
4342
|
-
}
|
|
4270
|
+
}
|
|
4343
4271
|
interface ApplySubscriptionOfferParams {
|
|
4344
4272
|
id: string;
|
|
4345
4273
|
offerId: string;
|
|
4346
|
-
/**
|
|
4274
|
+
/**
|
|
4275
|
+
* Only for a pending payment checkout, and later than the current time.
|
|
4276
|
+
* @format date-time
|
|
4277
|
+
*/
|
|
4347
4278
|
expiresAt?: string;
|
|
4348
4279
|
}
|
|
4349
4280
|
interface RemoveSubscriptionOfferParams {
|
|
@@ -4373,20 +4304,20 @@ interface CreatePrepaidPeriodsCheckoutParams {
|
|
|
4373
4304
|
offerId?: string;
|
|
4374
4305
|
successUrl?: string;
|
|
4375
4306
|
}
|
|
4376
|
-
|
|
4307
|
+
interface PreviewChangePlanParams {
|
|
4377
4308
|
id: string;
|
|
4378
|
-
planId: string;
|
|
4379
4309
|
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
4310
|
+
/** Cannot be combined with `promoCode`. */
|
|
4380
4311
|
offerId?: string;
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
planId
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
/**
|
|
4388
|
-
|
|
4389
|
-
}
|
|
4312
|
+
/** 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`. */
|
|
4313
|
+
promoCode?: string;
|
|
4314
|
+
/** The plan's ID (`pln_…`) or its code. Required unless `planCode` is sent. Cannot be combined with `planCode`. */
|
|
4315
|
+
planId?: string;
|
|
4316
|
+
/** Code of the destination plan, or `<plan code>:<experiment code>` to change to the experiment's latest version while it runs (the plan's current version once the experiment is won or archived). Same rules as planCode on subscription creation. Required unless `planId` is sent. Cannot be combined with `planId`. */
|
|
4317
|
+
planCode?: string;
|
|
4318
|
+
/** Public ID of a published version of the destination plan, current or not, including a running experiment's versions. The change is priced, checked out and activated on that version. Only for an immediate change to another paid plan, and not with an experiment code. When omitted, the change lands on the plan's current version, or the version its experiment code sells. */
|
|
4319
|
+
planVersionId?: string;
|
|
4320
|
+
}
|
|
4390
4321
|
interface ReactivateSubscriptionParams {
|
|
4391
4322
|
id: string;
|
|
4392
4323
|
offerId?: string;
|
|
@@ -4413,178 +4344,53 @@ interface GetActiveSubscriptionParams {
|
|
|
4413
4344
|
customerId: string;
|
|
4414
4345
|
}
|
|
4415
4346
|
interface ListSubscriptionsParams {
|
|
4347
|
+
cursor?: string;
|
|
4348
|
+
limit?: number;
|
|
4416
4349
|
customerId?: string;
|
|
4417
4350
|
status?: SubscriptionStatus;
|
|
4418
4351
|
planVersionId?: string;
|
|
4419
4352
|
}
|
|
4420
|
-
|
|
4421
|
-
customerId: string;
|
|
4422
|
-
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null;
|
|
4423
|
-
/** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
|
|
4424
|
-
priceId?: string;
|
|
4425
|
-
initialSeats?: Record<string, number>;
|
|
4426
|
-
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4427
|
-
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4428
|
-
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4429
|
-
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4430
|
-
name?: string;
|
|
4431
|
-
/** @format date-time */
|
|
4432
|
-
startDate?: string;
|
|
4433
|
-
successUrl?: string;
|
|
4434
|
-
/** Billing periods of the subscription's interval paid with the first payment, including the current one. Defaults to 1. The interval does not change: each paid period renews at zero and the subscription renews normally after the last one unless `cancelAtPeriodEnd` is true. */
|
|
4435
|
-
prepaidPeriods?: number;
|
|
4436
|
-
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
4437
|
-
cancelAtPeriodEnd?: boolean;
|
|
4438
|
-
/** Public ID of a published version of the plan, current or not, including an experiment's versions. The subscription is created on that version and stays on it: checkout charges its price and activation grants its credits, add-ons and credit packs. When omitted, the subscription gets the current version, or the version an experiment code (planCode `<plan code>:<experiment code>`) sells. */
|
|
4439
|
-
planVersionId?: string;
|
|
4440
|
-
offerId?: never;
|
|
4441
|
-
promoCode?: string;
|
|
4442
|
-
/** 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. */
|
|
4443
|
-
customTrialDays?: number;
|
|
4444
|
-
skipTrial?: boolean;
|
|
4445
|
-
planId: string;
|
|
4446
|
-
} | {
|
|
4353
|
+
interface CreateSubscriptionParams {
|
|
4447
4354
|
customerId: string;
|
|
4448
4355
|
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null;
|
|
4449
4356
|
/** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
|
|
4450
4357
|
priceId?: string;
|
|
4451
4358
|
initialSeats?: Record<string, number>;
|
|
4452
|
-
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4359
|
+
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. Not available on free plans or with a free trial that requires no payment method. */
|
|
4453
4360
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4454
|
-
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4361
|
+
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. Not available on free plans or with a free trial that requires no payment method. */
|
|
4455
4362
|
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4456
4363
|
name?: string;
|
|
4457
4364
|
/** @format date-time */
|
|
4458
4365
|
startDate?: string;
|
|
4459
4366
|
successUrl?: string;
|
|
4460
|
-
/** Billing periods of the subscription's interval paid with the first payment, including the current one. Defaults to 1. The interval does not change: each paid period renews at zero and the subscription renews normally after the last one unless `cancelAtPeriodEnd` is true. */
|
|
4367
|
+
/** Billing periods of the subscription's interval paid with the first payment, including the current one. Defaults to 1. The interval does not change: each paid period renews at zero and the subscription renews normally after the last one unless `cancelAtPeriodEnd` is true. Above 1, needs a paid recurring price, cannot take an Offer whose phases bill on another interval and cannot be combined with `customTrialDays` above 0. */
|
|
4461
4368
|
prepaidPeriods?: number;
|
|
4462
|
-
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
4369
|
+
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. When the plan's group has a default free plan, it moves to that plan then instead of ending. When true, needs a paid recurring price and cannot be combined with `customTrialDays` above 0. */
|
|
4463
4370
|
cancelAtPeriodEnd?: boolean;
|
|
4464
|
-
/** Public ID of a published version of the plan, current or not, including an experiment's versions. The subscription is created on that version and stays on it: checkout charges its price and activation grants its credits, add-ons and credit packs. When omitted, the subscription gets the current version, or the version an experiment code (planCode `<plan code>:<experiment code>`) sells. */
|
|
4371
|
+
/** Public ID of a published version of the plan, current or not, including an experiment's versions. The subscription is created on that version and stays on it: checkout charges its price and activation grants its credits, add-ons and credit packs. When omitted, the subscription gets the current version, or the version an experiment code (planCode `<plan code>:<experiment code>`) sells. Cannot be combined with an experiment code in `planCode`. */
|
|
4465
4372
|
planVersionId?: string;
|
|
4466
|
-
|
|
4373
|
+
/** Cannot be combined with `promoCode`. Cannot be combined with `cardPromotionId`. */
|
|
4374
|
+
offerId?: string;
|
|
4375
|
+
/** Cannot be combined with `offerId`. Cannot be combined with `cardPromotionId`. */
|
|
4467
4376
|
promoCode?: string;
|
|
4468
|
-
/** 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. */
|
|
4469
|
-
customTrialDays?: number;
|
|
4470
|
-
skipTrial?: boolean;
|
|
4471
|
-
/** The plan code, or an experiment code as `<plan code>:<experiment code>` to sell the version the experiment sells. */
|
|
4472
|
-
planCode: string;
|
|
4473
|
-
} | {
|
|
4474
|
-
customerId: string;
|
|
4475
|
-
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null;
|
|
4476
|
-
/** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
|
|
4477
|
-
priceId?: string;
|
|
4478
|
-
initialSeats?: Record<string, number>;
|
|
4479
|
-
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4480
|
-
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4481
|
-
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4482
|
-
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4483
|
-
name?: string;
|
|
4484
|
-
/** @format date-time */
|
|
4485
|
-
startDate?: string;
|
|
4486
|
-
successUrl?: string;
|
|
4487
|
-
/** Billing periods of the subscription's interval paid with the first payment, including the current one. Defaults to 1. The interval does not change: each paid period renews at zero and the subscription renews normally after the last one unless `cancelAtPeriodEnd` is true. */
|
|
4488
|
-
prepaidPeriods?: number;
|
|
4489
|
-
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
4490
|
-
cancelAtPeriodEnd?: boolean;
|
|
4491
|
-
/** Public ID of a published version of the plan, current or not, including an experiment's versions. The subscription is created on that version and stays on it: checkout charges its price and activation grants its credits, add-ons and credit packs. When omitted, the subscription gets the current version, or the version an experiment code (planCode `<plan code>:<experiment code>`) sells. */
|
|
4492
|
-
planVersionId?: string;
|
|
4493
|
-
offerId: string;
|
|
4494
|
-
promoCode?: never;
|
|
4495
|
-
/** 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. */
|
|
4496
|
-
customTrialDays?: number;
|
|
4497
|
-
skipTrial?: boolean;
|
|
4498
|
-
planId: string;
|
|
4499
|
-
} | {
|
|
4500
|
-
customerId: string;
|
|
4501
|
-
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null;
|
|
4502
|
-
/** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
|
|
4503
|
-
priceId?: string;
|
|
4504
|
-
initialSeats?: Record<string, number>;
|
|
4505
|
-
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4506
|
-
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4507
|
-
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4508
|
-
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4509
|
-
name?: string;
|
|
4510
|
-
/** @format date-time */
|
|
4511
|
-
startDate?: string;
|
|
4512
|
-
successUrl?: string;
|
|
4513
|
-
/** Billing periods of the subscription's interval paid with the first payment, including the current one. Defaults to 1. The interval does not change: each paid period renews at zero and the subscription renews normally after the last one unless `cancelAtPeriodEnd` is true. */
|
|
4514
|
-
prepaidPeriods?: number;
|
|
4515
|
-
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
4516
|
-
cancelAtPeriodEnd?: boolean;
|
|
4517
|
-
/** Public ID of a published version of the plan, current or not, including an experiment's versions. The subscription is created on that version and stays on it: checkout charges its price and activation grants its credits, add-ons and credit packs. When omitted, the subscription gets the current version, or the version an experiment code (planCode `<plan code>:<experiment code>`) sells. */
|
|
4518
|
-
planVersionId?: string;
|
|
4519
|
-
offerId: string;
|
|
4520
|
-
promoCode?: never;
|
|
4521
|
-
/** 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. */
|
|
4377
|
+
/** 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. Above 0, cannot be combined with `prepaidPeriods` above 1 or with `cancelAtPeriodEnd` true. Cannot be combined with `cardPromotionId`. */
|
|
4522
4378
|
customTrialDays?: number;
|
|
4379
|
+
/** Cannot be `true` with `cardPromotionId`. */
|
|
4523
4380
|
skipTrial?: boolean;
|
|
4524
|
-
/**
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
initialSeats?: Record<string, number>;
|
|
4532
|
-
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4533
|
-
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4534
|
-
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4535
|
-
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4536
|
-
name?: string;
|
|
4537
|
-
/** @format date-time */
|
|
4538
|
-
startDate?: string;
|
|
4539
|
-
successUrl?: string;
|
|
4540
|
-
/** Billing periods of the subscription's interval paid with the first payment, including the current one. Defaults to 1. The interval does not change: each paid period renews at zero and the subscription renews normally after the last one unless `cancelAtPeriodEnd` is true. */
|
|
4541
|
-
prepaidPeriods?: number;
|
|
4542
|
-
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
4543
|
-
cancelAtPeriodEnd?: boolean;
|
|
4544
|
-
/** Public ID of a published version of the plan, current or not, including an experiment's versions. The subscription is created on that version and stays on it: checkout charges its price and activation grants its credits, add-ons and credit packs. When omitted, the subscription gets the current version, or the version an experiment code (planCode `<plan code>:<experiment code>`) sells. */
|
|
4545
|
-
planVersionId?: string;
|
|
4546
|
-
offerId?: never;
|
|
4547
|
-
/** Public card promotion ID. The offer is shown immediately and remains conditional on card eligibility until checkout confirmation. */
|
|
4548
|
-
cardPromotionId: string;
|
|
4549
|
-
promoCode?: never;
|
|
4550
|
-
customTrialDays?: never;
|
|
4551
|
-
skipTrial?: false;
|
|
4552
|
-
planId: string;
|
|
4553
|
-
} | {
|
|
4554
|
-
customerId: string;
|
|
4555
|
-
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null;
|
|
4556
|
-
/** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
|
|
4557
|
-
priceId?: string;
|
|
4558
|
-
initialSeats?: Record<string, number>;
|
|
4559
|
-
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4560
|
-
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4561
|
-
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4562
|
-
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4563
|
-
name?: string;
|
|
4564
|
-
/** @format date-time */
|
|
4565
|
-
startDate?: string;
|
|
4566
|
-
successUrl?: string;
|
|
4567
|
-
/** Billing periods of the subscription's interval paid with the first payment, including the current one. Defaults to 1. The interval does not change: each paid period renews at zero and the subscription renews normally after the last one unless `cancelAtPeriodEnd` is true. */
|
|
4568
|
-
prepaidPeriods?: number;
|
|
4569
|
-
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
4570
|
-
cancelAtPeriodEnd?: boolean;
|
|
4571
|
-
/** Public ID of a published version of the plan, current or not, including an experiment's versions. The subscription is created on that version and stays on it: checkout charges its price and activation grants its credits, add-ons and credit packs. When omitted, the subscription gets the current version, or the version an experiment code (planCode `<plan code>:<experiment code>`) sells. */
|
|
4572
|
-
planVersionId?: string;
|
|
4573
|
-
offerId?: never;
|
|
4574
|
-
/** Public card promotion ID. The offer is shown immediately and remains conditional on card eligibility until checkout confirmation. */
|
|
4575
|
-
cardPromotionId: string;
|
|
4576
|
-
promoCode?: never;
|
|
4577
|
-
customTrialDays?: never;
|
|
4578
|
-
skipTrial?: false;
|
|
4579
|
-
/** The plan code, or an experiment code as `<plan code>:<experiment code>` to sell the version the experiment sells. */
|
|
4580
|
-
planCode: string;
|
|
4581
|
-
};
|
|
4381
|
+
/** Public card promotion ID. The offer is shown immediately and remains conditional on card eligibility until checkout confirmation. Cannot be combined with `offerId`. Cannot be combined with `promoCode`. Cannot be combined with `customTrialDays`. Cannot be used when `skipTrial` is `true`. */
|
|
4382
|
+
cardPromotionId?: string;
|
|
4383
|
+
/** Required unless `planCode` is sent. Cannot be combined with `planCode`. */
|
|
4384
|
+
planId?: string;
|
|
4385
|
+
/** The plan code, or an experiment code as `<plan code>:<experiment code>` to sell the version the experiment sells. Required unless `planId` is sent. Cannot be combined with `planId`. */
|
|
4386
|
+
planCode?: string;
|
|
4387
|
+
}
|
|
4582
4388
|
declare class SubscriptionsResource {
|
|
4583
4389
|
private httpClient;
|
|
4584
4390
|
constructor(httpClient: CommetHTTPClient);
|
|
4585
4391
|
/** Deactivate an add-on from a subscription. */
|
|
4586
4392
|
deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<DeletedSubscriptionAddon>;
|
|
4587
|
-
/** 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.
|
|
4393
|
+
/** 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. Send successUrl to receive, when there is no saved payment method or it is declined, a checkout that charges the activation and saves the method. 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. */
|
|
4588
4394
|
activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<SubscriptionAddon>;
|
|
4589
4395
|
/** 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. */
|
|
4590
4396
|
getAutoTopUp(params: GetSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
@@ -4592,15 +4398,15 @@ declare class SubscriptionsResource {
|
|
|
4592
4398
|
updateAutoTopUp(params: UpdateSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
4593
4399
|
/** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
|
|
4594
4400
|
adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<BalanceAdjustment>;
|
|
4595
|
-
/** 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.
|
|
4401
|
+
/** 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. Send successUrl to receive, when there is no saved payment method or it is declined, a checkout that charges the top-up and saves the method. 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. */
|
|
4596
4402
|
topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<BalanceTopup>;
|
|
4597
|
-
/** Cancel immediately or at period end and return the updated subscription. */
|
|
4403
|
+
/** Cancel immediately or at period end and return the updated subscription. When the plan's group has a default free plan, a paid subscription moves to that plan instead of ending: now when `immediate` is true, otherwise at the end of the period or trial as a scheduled plan change that `POST /subscriptions/{id}/uncancel` undoes. The move sends `subscription.plan_change_scheduled` and `subscription.plan_changed` with the `reason` as `cancelReason`, never `subscription.canceled`. Cancelling the default plan itself ends the subscription. */
|
|
4598
4404
|
cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
4599
4405
|
/** 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. */
|
|
4600
4406
|
changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<PlanChange>;
|
|
4601
4407
|
/** 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. */
|
|
4602
4408
|
changeVersion(params: ChangeSubscriptionVersionParams, options?: RequestOptions): Promise<Subscription>;
|
|
4603
|
-
/** 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.
|
|
4409
|
+
/** 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. Send successUrl to receive, when there is no saved payment method or it is declined, a checkout that charges the purchase and saves the method. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
|
|
4604
4410
|
purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
|
|
4605
4411
|
/** 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. */
|
|
4606
4412
|
applyOffer(params: ApplySubscriptionOfferParams, options?: RequestOptions): Promise<Subscription>;
|
|
@@ -4618,7 +4424,7 @@ declare class SubscriptionsResource {
|
|
|
4618
4424
|
createPrepaidPeriodsCheckout(params: CreatePrepaidPeriodsCheckoutParams, options?: RequestOptions): Promise<PrepaidPeriodsCheckout>;
|
|
4619
4425
|
/** 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. */
|
|
4620
4426
|
previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<PreviewChange>;
|
|
4621
|
-
/** 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; when that invoice totals zero, for example under an Offer, it is marked paid without a charge and the subscription becomes active at once, still requiring a saved payment method. 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. */
|
|
4427
|
+
/** 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; when that invoice totals zero, for example under an Offer, it is marked paid without a charge and the subscription becomes active at once, still requiring a saved payment method. 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 past_due subscription without a payment method returns no_payment_method with the same recoveryUrl. A canceled subscription may apply an Offer by offerId; past-due recovery cannot. */
|
|
4622
4428
|
reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ReactivatedSubscription>;
|
|
4623
4429
|
/** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
|
|
4624
4430
|
createRecoveryLink(params: CreateSubscriptionRecoveryLinkParams, options?: RequestOptions): Promise<RecoveryLink>;
|
|
@@ -4630,27 +4436,30 @@ declare class SubscriptionsResource {
|
|
|
4630
4436
|
revokeScheduledPlanChange(params: RevokeScheduledPlanChangeParams, options?: RequestOptions): Promise<Subscription>;
|
|
4631
4437
|
/** Cancel the move to another plan version pending for the next renewal, so the subscription stays on its version, and send subscription.version_change_canceled with reason canceled_by_merchant. A move made now has nothing pending to revoke. With nothing pending it changes nothing. Returns the subscription. */
|
|
4632
4438
|
revokeScheduledVersionChange(params: RevokeScheduledVersionChangeParams, options?: RequestOptions): Promise<Subscription>;
|
|
4633
|
-
/** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. */
|
|
4439
|
+
/** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. When the cancellation scheduled a move to the group's default plan instead, it reverts that move: the subscription keeps its plan and renews normally. */
|
|
4634
4440
|
uncancel(params: UncancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
4635
4441
|
/** Get the active subscription for a customer. Returns null if none. */
|
|
4636
4442
|
getActive(params: GetActiveSubscriptionParams, options?: RequestOptions): Promise<Subscription | null>;
|
|
4637
|
-
/** List
|
|
4443
|
+
/** List subscriptions, newest first. Filter by customer ID, status or plan version. Send `limit` or `cursor` to receive them in pages and follow `nextCursor` while `hasMore` is true; without them the response holds every matching subscription, up to 80,000. */
|
|
4638
4444
|
list(params?: ListSubscriptionsParams, options?: RequestOptions): Promise<{
|
|
4639
4445
|
object: "list";
|
|
4640
4446
|
data: Array<SubscriptionSummary>;
|
|
4641
4447
|
hasMore: boolean;
|
|
4642
4448
|
nextCursor?: string;
|
|
4643
4449
|
}>;
|
|
4644
|
-
/** 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
|
|
4450
|
+
/** 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, provider or paymentMethodTypes, and an organization that cannot charge yet receives 403. When the customer already has a past_due subscription, the 409 error details carry its subscriptionId, its status and, while its renewal is unpaid, a recoveryUrl where the customer can pay it. */
|
|
4645
4451
|
create(params: CreateSubscriptionParams, options?: RequestOptions): Promise<CreatedSubscription>;
|
|
4646
4452
|
}
|
|
4647
4453
|
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
/**
|
|
4652
|
-
|
|
4653
|
-
|
|
4454
|
+
interface AdvanceTestClockParams {
|
|
4455
|
+
/** Required unless `frozenTime` is sent. Cannot be combined with `frozenTime`. */
|
|
4456
|
+
advanceDays?: number;
|
|
4457
|
+
/**
|
|
4458
|
+
* Required unless `advanceDays` is sent. Cannot be combined with `advanceDays`.
|
|
4459
|
+
* @format date-time
|
|
4460
|
+
*/
|
|
4461
|
+
frozenTime?: string;
|
|
4462
|
+
}
|
|
4654
4463
|
declare class TestClockResource {
|
|
4655
4464
|
private httpClient;
|
|
4656
4465
|
constructor(httpClient: CommetHTTPClient);
|
|
@@ -4662,7 +4471,7 @@ declare class TestClockResource {
|
|
|
4662
4471
|
/** Returns the organization's current test clock state and latest durable run. Sandbox only. */
|
|
4663
4472
|
get(): Promise<TestClock>;
|
|
4664
4473
|
/** Starts a durable run that moves the test clock forward and processes every billing deadline due before the target time. Poll GET /test-clock for progress and terminal results. Sandbox only. */
|
|
4665
|
-
advance(params
|
|
4474
|
+
advance(params?: AdvanceTestClockParams, options?: RequestOptions): Promise<TestClockRun>;
|
|
4666
4475
|
}
|
|
4667
4476
|
|
|
4668
4477
|
interface RefundTransactionParams {
|
|
@@ -4705,7 +4514,7 @@ interface CheckUsageAvailabilityParams {
|
|
|
4705
4514
|
featureCode: string;
|
|
4706
4515
|
quantity?: number;
|
|
4707
4516
|
}
|
|
4708
|
-
|
|
4517
|
+
interface TrackUsageParams {
|
|
4709
4518
|
featureCode: string;
|
|
4710
4519
|
customerId: string;
|
|
4711
4520
|
eventId?: string;
|
|
@@ -4715,29 +4524,19 @@ type TrackUsageParams = {
|
|
|
4715
4524
|
property: string;
|
|
4716
4525
|
value: string;
|
|
4717
4526
|
}>;
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
outputTokens
|
|
4721
|
-
|
|
4527
|
+
/** Required when `inputTokens`, `outputTokens`, `cacheReadTokens` or `cacheWriteTokens` is sent. Cannot be combined with `value`. */
|
|
4528
|
+
model?: string;
|
|
4529
|
+
/** Required when `model`, `outputTokens`, `cacheReadTokens` or `cacheWriteTokens` is sent. Cannot be combined with `value`. */
|
|
4530
|
+
inputTokens?: number;
|
|
4531
|
+
/** Required when `model`, `inputTokens`, `cacheReadTokens` or `cacheWriteTokens` is sent. Cannot be combined with `value`. */
|
|
4532
|
+
outputTokens?: number;
|
|
4533
|
+
/** Defaults to `1` unless `model` is sent. Cannot be combined with `model`, `inputTokens`, `outputTokens`, `cacheReadTokens` or `cacheWriteTokens`. */
|
|
4534
|
+
value?: number;
|
|
4535
|
+
/** Requires `model`, `inputTokens` and `outputTokens`. Cannot be combined with `value`. */
|
|
4722
4536
|
cacheReadTokens?: number;
|
|
4537
|
+
/** Requires `model`, `inputTokens` and `outputTokens`. Cannot be combined with `value`. */
|
|
4723
4538
|
cacheWriteTokens?: number;
|
|
4724
|
-
}
|
|
4725
|
-
featureCode: string;
|
|
4726
|
-
customerId: string;
|
|
4727
|
-
eventId?: string;
|
|
4728
|
-
/** @format date-time */
|
|
4729
|
-
timestamp?: string;
|
|
4730
|
-
properties?: Array<{
|
|
4731
|
-
property: string;
|
|
4732
|
-
value: string;
|
|
4733
|
-
}>;
|
|
4734
|
-
value?: number;
|
|
4735
|
-
model?: never;
|
|
4736
|
-
inputTokens?: never;
|
|
4737
|
-
outputTokens?: never;
|
|
4738
|
-
cacheReadTokens?: never;
|
|
4739
|
-
cacheWriteTokens?: never;
|
|
4740
|
-
};
|
|
4539
|
+
}
|
|
4741
4540
|
interface SetUsageParams {
|
|
4742
4541
|
customerId: string;
|
|
4743
4542
|
featureCode: string;
|
|
@@ -4992,6 +4791,8 @@ interface SubscriptionPlanChangedData {
|
|
|
4992
4791
|
charge: number;
|
|
4993
4792
|
/** Total amount charged in cents. */
|
|
4994
4793
|
totalCharged: number;
|
|
4794
|
+
/** The cancellation reason when a cancellation moved the subscription to its group's default plan instead of ending it. Null for any other plan change. */
|
|
4795
|
+
cancelReason: string | null;
|
|
4995
4796
|
}
|
|
4996
4797
|
/** Fired when a cancellation is scheduled for the end of the billing period. The subscription stays active until effectiveAt — do NOT revoke access here. subscription.updated also fires for backward compatibility. */
|
|
4997
4798
|
interface SubscriptionCancellationScheduledData {
|
|
@@ -5037,6 +4838,8 @@ interface SubscriptionPlanChangeScheduledData {
|
|
|
5037
4838
|
scheduledBillingInterval: string | null;
|
|
5038
4839
|
/** ISO 8601 datetime when the change executes (the billing period end). */
|
|
5039
4840
|
effectiveAt: string;
|
|
4841
|
+
/** The cancellation reason when a cancellation scheduled the move to the group's default plan instead of ending the subscription. Null for any other scheduled change. */
|
|
4842
|
+
cancelReason: string | null;
|
|
5040
4843
|
}
|
|
5041
4844
|
/** 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. */
|
|
5042
4845
|
interface SubscriptionPlanChangeRevokedData {
|