@commet/node 9.8.0 → 9.10.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 +1021 -30
- package/dist/index.d.ts +1021 -30
- package/dist/index.js +204 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +204 -11
- package/dist/index.mjs.map +1 -1
- package/docs/ai-onboarding/mcp-server.md +2 -0
- package/docs/api-reference/addons.md +3 -1
- package/docs/api-reference/credit-packs.md +3 -1
- package/docs/api-reference/customers.md +2 -0
- package/docs/api-reference/generated-webhooks.md +2 -2
- package/docs/api-reference/index.md +3 -3
- package/docs/api-reference/plans.md +488 -6
- package/docs/api-reference/subscriptions.md +50 -8
- package/docs/documentation/api-versioning.md +8 -2
- package/docs/documentation/cli.md +64 -49
- package/docs/documentation/create-api-key.md +3 -1
- package/docs/documentation/customers/customer-portal.md +10 -2
- package/docs/documentation/customers/manage-customers.md +2 -1
- package/docs/documentation/finance/payouts.md +11 -0
- package/docs/documentation/finance/supported-countries.md +5 -5
- package/docs/documentation/invoicing/handle-failed-payments.md +9 -9
- package/docs/documentation/payments/accept-one-time-payments.md +1 -1
- package/docs/documentation/payments/payment-orchestration.md +2 -0
- package/docs/documentation/payments/payment-providers.md +46 -0
- package/docs/documentation/payments/transactions-refunds-and-retries.md +1 -1
- package/docs/documentation/plans/add-ons.md +15 -4
- package/docs/documentation/plans/consumption-models.md +44 -9
- package/docs/documentation/plans/create-plans.md +5 -1
- package/docs/documentation/plans/credit-packs.md +61 -3
- package/docs/documentation/plans/one-time-payments.md +3 -3
- package/docs/documentation/plans/plan-groups.md +46 -10
- package/docs/documentation/plans/plan-versions.md +265 -0
- package/docs/documentation/platform/dashboard-metrics-and-events.md +40 -9
- package/docs/documentation/sales/connect-dub-affiliates.md +52 -0
- package/docs/documentation/sales/introductory-offers.md +7 -13
- package/docs/documentation/sales/offers.md +10 -6
- package/docs/documentation/sales/promo-codes.md +47 -17
- package/docs/documentation/sales/promotional-offers.md +6 -7
- package/docs/documentation/sales/regional-prices.md +38 -8
- package/docs/documentation/sales/trial-periods.md +67 -40
- package/docs/documentation/subscriptions/manage-subscriptions.md +114 -14
- package/docs/documentation/subscriptions/pay-in-advance.md +4 -7
- package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +22 -2
- package/docs/documentation/testing-sandbox.md +2 -0
- package/docs/documentation/usage/track-usage.md +23 -0
- package/docs/errors/addon_has_activations.md +2 -2
- package/docs/errors/addon_unavailable.md +22 -0
- package/docs/errors/credit_pack_unavailable.md +22 -0
- package/docs/errors/index.md +9 -2
- package/docs/errors/missing_regional_price.md +3 -3
- package/docs/errors/plan_balance_limit_reached.md +22 -0
- package/docs/errors/plan_experiment_not_found.md +22 -0
- package/docs/errors/plan_version_not_found.md +22 -0
- package/docs/errors/subscribers_do_not_fit.md +22 -0
- package/docs/errors/version_not_newer.md +22 -0
- package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +8 -8
- package/docs/knowledge-base/how-do-discounts-work.md +7 -5
- package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +18 -11
- package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +1 -1
- package/docs/knowledge-base/how-do-trial-periods-work.md +31 -25
- package/docs/knowledge-base/how-does-billing-work.md +26 -27
- package/docs/knowledge-base/how-does-quota-based-billing-work.md +12 -22
- package/docs/knowledge-base/how-does-seat-based-billing-work.md +12 -22
- package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +11 -8
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +11 -9
- package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +34 -29
- package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +1 -1
- package/docs/manifest.json +201 -2
- package/docs/platform-documentation.md +2 -0
- package/docs/schemas.md +134 -14
- package/docs/webhooks/introduction.md +17 -13
- package/docs/webhooks.md +66 -6
- package/docs/webhooks.openapi.json +1218 -876
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -168,6 +168,8 @@ interface Addon {
|
|
|
168
168
|
includedUnits: number | null;
|
|
169
169
|
overageRate: number | null;
|
|
170
170
|
creditCost: number | null;
|
|
171
|
+
/** Plans that sell the add-on. */
|
|
172
|
+
planIds: Array<string>;
|
|
171
173
|
object: "addon";
|
|
172
174
|
livemode: boolean;
|
|
173
175
|
}
|
|
@@ -194,6 +196,11 @@ interface BalanceTopup {
|
|
|
194
196
|
object: "balance_topup";
|
|
195
197
|
livemode: boolean;
|
|
196
198
|
}
|
|
199
|
+
interface BusinessTaxId {
|
|
200
|
+
country: string;
|
|
201
|
+
type: string;
|
|
202
|
+
value: string;
|
|
203
|
+
}
|
|
197
204
|
interface ClaimLink {
|
|
198
205
|
url: string;
|
|
199
206
|
/** @format date-time */
|
|
@@ -260,6 +267,13 @@ interface CreatedSubscription {
|
|
|
260
267
|
createdAt: string;
|
|
261
268
|
/** @format date-time */
|
|
262
269
|
updatedAt: string;
|
|
270
|
+
/** The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved. */
|
|
271
|
+
planVersion: {
|
|
272
|
+
/** Public plan version ID. */
|
|
273
|
+
id: string;
|
|
274
|
+
/** Main versions are 1, 2, 3; an experiment's versions carry its own code, like price-test 2. */
|
|
275
|
+
label: string;
|
|
276
|
+
} | null;
|
|
263
277
|
offerApplications: Array<SubscriptionOfferApplication>;
|
|
264
278
|
pause: {
|
|
265
279
|
status: "scheduled";
|
|
@@ -308,6 +322,8 @@ interface CreditPack {
|
|
|
308
322
|
description: string | null;
|
|
309
323
|
credits: number;
|
|
310
324
|
price: number;
|
|
325
|
+
/** Plans that sell the credit pack. */
|
|
326
|
+
planIds: Array<string>;
|
|
311
327
|
isActive: boolean;
|
|
312
328
|
/** @format date-time */
|
|
313
329
|
createdAt: string;
|
|
@@ -322,6 +338,8 @@ interface CreditPackListItem {
|
|
|
322
338
|
description: string | null;
|
|
323
339
|
credits: number;
|
|
324
340
|
price: number;
|
|
341
|
+
/** Plans that sell the credit pack. */
|
|
342
|
+
planIds: Array<string>;
|
|
325
343
|
currency: string;
|
|
326
344
|
object: "credit_pack";
|
|
327
345
|
livemode: boolean;
|
|
@@ -333,6 +351,7 @@ interface Customer {
|
|
|
333
351
|
email: string;
|
|
334
352
|
taxDocument: string | null;
|
|
335
353
|
documentType: string | null;
|
|
354
|
+
businessTaxId: BusinessTaxId | null;
|
|
336
355
|
timezone: string | null;
|
|
337
356
|
metadata: Record<string, unknown> | null;
|
|
338
357
|
/** @format date-time */
|
|
@@ -763,6 +782,12 @@ interface InvoiceListItem {
|
|
|
763
782
|
object: "invoice";
|
|
764
783
|
livemode: boolean;
|
|
765
784
|
}
|
|
785
|
+
interface KeptOnVersion {
|
|
786
|
+
subscriptionId: string;
|
|
787
|
+
keptOnVersion: true;
|
|
788
|
+
object: "kept_on_version";
|
|
789
|
+
livemode: boolean;
|
|
790
|
+
}
|
|
766
791
|
type ManagedBy = "dub" | null;
|
|
767
792
|
interface Market {
|
|
768
793
|
id: string;
|
|
@@ -901,6 +926,7 @@ interface Plan {
|
|
|
901
926
|
isPublic: boolean;
|
|
902
927
|
isDefault: boolean;
|
|
903
928
|
isFree: boolean;
|
|
929
|
+
/** Credits and balance plans: true stops usage when the plan and purchased amounts run out; false lets usage continue and bills the missing amount as overage at the next renewal (credits at the price per credit). Trials and free plans always stop. */
|
|
904
930
|
blockOnExhaustion: boolean | null;
|
|
905
931
|
/** Credits plans only; null for other consumption models. What happens to unused plan credits at each reset. Purchased credits never expire and never count toward maxPlanCredits. */
|
|
906
932
|
unusedPlanCredits: {
|
|
@@ -917,6 +943,21 @@ interface Plan {
|
|
|
917
943
|
/** The window length: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. */
|
|
918
944
|
interval: "day" | "week";
|
|
919
945
|
} | null;
|
|
946
|
+
/** Balance plans only; null for other consumption models. What happens to unused plan balance at each reset. Purchased balance never expires and never counts toward maxPlanBalance. */
|
|
947
|
+
unusedPlanBalance: {
|
|
948
|
+
type: "expire";
|
|
949
|
+
} | {
|
|
950
|
+
type: "roll_over";
|
|
951
|
+
/** The most plan balance a subscription holds after a reset, in USD cents, including the balance that reset grants; balance above it expires. At least the included balance of every price. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. null means no limit other than the largest storable amount, 2,147,483,647 cents. */
|
|
952
|
+
maxPlanBalance: number | null;
|
|
953
|
+
} | null;
|
|
954
|
+
/** Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; null means no limit. */
|
|
955
|
+
planBalanceLimit: {
|
|
956
|
+
/** The most plan balance a subscription spends in one window, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. */
|
|
957
|
+
amount: number;
|
|
958
|
+
/** The window length: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. */
|
|
959
|
+
interval: "day" | "week";
|
|
960
|
+
} | null;
|
|
920
961
|
sortOrder: number;
|
|
921
962
|
planGroupId: string | null;
|
|
922
963
|
metadata: Record<string, unknown> | null;
|
|
@@ -981,6 +1022,36 @@ interface Plan {
|
|
|
981
1022
|
currency: string;
|
|
982
1023
|
exchangeRate: number;
|
|
983
1024
|
}>;
|
|
1025
|
+
/** Countries with their own currency or prices in the current version. Buyers from any other country pay the USD prices. */
|
|
1026
|
+
countries: Array<{
|
|
1027
|
+
/** ISO country code. */
|
|
1028
|
+
country: string;
|
|
1029
|
+
/** The currency buyers from the country pay, USD included. */
|
|
1030
|
+
currency: string;
|
|
1031
|
+
prices: Array<{
|
|
1032
|
+
billingInterval: BillingInterval;
|
|
1033
|
+
/** The country's price in the currency's minor unit. */
|
|
1034
|
+
price: number;
|
|
1035
|
+
/** True when set by hand; false when it follows the USD base at the exchange rate. */
|
|
1036
|
+
manual: boolean;
|
|
1037
|
+
}>;
|
|
1038
|
+
/** Every add-on the version sells, priced for the country. */
|
|
1039
|
+
addons: Array<{
|
|
1040
|
+
addonId: string;
|
|
1041
|
+
/** What buyers from the country pay for the add-on, in the currency's minor unit. */
|
|
1042
|
+
price: number;
|
|
1043
|
+
/** True when set by hand; false when it follows the add-on's USD price at the exchange rate. */
|
|
1044
|
+
manual: boolean;
|
|
1045
|
+
}>;
|
|
1046
|
+
/** Every credit pack the version sells, priced for the country. */
|
|
1047
|
+
creditPacks: Array<{
|
|
1048
|
+
creditPackId: string;
|
|
1049
|
+
/** What buyers from the country pay for the pack, in the currency's minor unit. */
|
|
1050
|
+
price: number;
|
|
1051
|
+
/** True when set by hand; false when it follows the pack's USD price at the exchange rate. */
|
|
1052
|
+
manual: boolean;
|
|
1053
|
+
}>;
|
|
1054
|
+
}>;
|
|
984
1055
|
object: "plan";
|
|
985
1056
|
livemode: boolean;
|
|
986
1057
|
}
|
|
@@ -1144,6 +1215,136 @@ type PlanChange = {
|
|
|
1144
1215
|
object: "plan_change";
|
|
1145
1216
|
livemode: boolean;
|
|
1146
1217
|
};
|
|
1218
|
+
interface PlanDraft {
|
|
1219
|
+
/** Public plan draft ID. */
|
|
1220
|
+
id: string;
|
|
1221
|
+
/** The version the draft started from. */
|
|
1222
|
+
fromVersionId: string;
|
|
1223
|
+
/** What the draft changes against the version it started from. */
|
|
1224
|
+
changes: Array<{
|
|
1225
|
+
/** Identifies the change; send it to undo just this change. */
|
|
1226
|
+
key: string;
|
|
1227
|
+
/** Where the change is: Price, Trial, a rules section, Add-ons, or a country. */
|
|
1228
|
+
section: string;
|
|
1229
|
+
/** ISO country code when the change belongs to one country. */
|
|
1230
|
+
country: string | null;
|
|
1231
|
+
/** What changed, such as Monthly price. */
|
|
1232
|
+
label: string;
|
|
1233
|
+
/** The value before, formatted. */
|
|
1234
|
+
before: string | null;
|
|
1235
|
+
/** The value now, formatted. */
|
|
1236
|
+
after: string | null;
|
|
1237
|
+
}>;
|
|
1238
|
+
/** @format date-time */
|
|
1239
|
+
createdAt: string;
|
|
1240
|
+
/** @format date-time */
|
|
1241
|
+
updatedAt: string;
|
|
1242
|
+
object: "plan_draft";
|
|
1243
|
+
livemode: boolean;
|
|
1244
|
+
}
|
|
1245
|
+
interface PlanDraftPublication {
|
|
1246
|
+
preview: boolean;
|
|
1247
|
+
/** The published version. Null for a preview. */
|
|
1248
|
+
version: {
|
|
1249
|
+
/** Public plan version ID. */
|
|
1250
|
+
id: string;
|
|
1251
|
+
/** The plan's versions are numbered 1, 2, 3; an experiment's own versions read with its code, such as price-test 2. */
|
|
1252
|
+
label: string;
|
|
1253
|
+
/** The plan's version number. Null for a version that only belongs to an experiment; an experiment version made current takes the next number. */
|
|
1254
|
+
number: number | null;
|
|
1255
|
+
/** The experiment this version belongs to, if any. */
|
|
1256
|
+
experiment: {
|
|
1257
|
+
/** The experiment's code, as sold with planCode. */
|
|
1258
|
+
code: string;
|
|
1259
|
+
/** Its number within the experiment. */
|
|
1260
|
+
version: number;
|
|
1261
|
+
} | null;
|
|
1262
|
+
/** Whether new buyers get this version. */
|
|
1263
|
+
isCurrent: boolean;
|
|
1264
|
+
/** The version this one was created from. */
|
|
1265
|
+
parentVersionId: string | null;
|
|
1266
|
+
/** Active, trialing, past due and paused subscriptions on it. */
|
|
1267
|
+
subscriptionCount: number;
|
|
1268
|
+
maxPlanCredits: number | null;
|
|
1269
|
+
maxPlanBalance: number | null;
|
|
1270
|
+
prices: Array<{
|
|
1271
|
+
/** Public plan price ID. */
|
|
1272
|
+
id: string;
|
|
1273
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
1274
|
+
price: number;
|
|
1275
|
+
includedCredits: number | null;
|
|
1276
|
+
includedBalance: number | null;
|
|
1277
|
+
regionalPrices: Array<{
|
|
1278
|
+
currency: string;
|
|
1279
|
+
price: number;
|
|
1280
|
+
includedBalance: number | null;
|
|
1281
|
+
}>;
|
|
1282
|
+
}>;
|
|
1283
|
+
/** @format date-time */
|
|
1284
|
+
createdAt: string;
|
|
1285
|
+
} | null;
|
|
1286
|
+
/** The move of subscribers, if any. */
|
|
1287
|
+
moveId: string | null;
|
|
1288
|
+
subscribers: {
|
|
1289
|
+
moving: number;
|
|
1290
|
+
keptOnVersion: number;
|
|
1291
|
+
/** Left on their version because no change makes them fit; they show among the subscribers that need a change. */
|
|
1292
|
+
needsAChange: number;
|
|
1293
|
+
leftOut: Array<{
|
|
1294
|
+
subscriptionId: string;
|
|
1295
|
+
code: string;
|
|
1296
|
+
message: string;
|
|
1297
|
+
}>;
|
|
1298
|
+
} | null;
|
|
1299
|
+
object: "plan_draft_publication";
|
|
1300
|
+
livemode: boolean;
|
|
1301
|
+
}
|
|
1302
|
+
interface PlanExperiment {
|
|
1303
|
+
/** Public plan experiment ID. */
|
|
1304
|
+
id: string;
|
|
1305
|
+
/** The code to sell it with as planCode, such as pro:price-test. It always sells the experiment's latest version while running, and the plan's current version once closed. */
|
|
1306
|
+
code: string;
|
|
1307
|
+
/** running sells its latest version; won became the plan's current version; archived stopped selling. */
|
|
1308
|
+
status: "running" | "won" | "archived";
|
|
1309
|
+
/** The plan's version that was current when it started. */
|
|
1310
|
+
startedFromVersionId: string;
|
|
1311
|
+
/** Its latest version. */
|
|
1312
|
+
latestVersionId: string;
|
|
1313
|
+
/** The version its code sells to new buyers today. */
|
|
1314
|
+
sellsVersionId: string;
|
|
1315
|
+
/** Active, trialing, past due and paused subscriptions on its versions. */
|
|
1316
|
+
subscriptionCount: number;
|
|
1317
|
+
/** @format date-time */
|
|
1318
|
+
createdAt: string;
|
|
1319
|
+
closedAt: string | null;
|
|
1320
|
+
object: "plan_experiment";
|
|
1321
|
+
livemode: boolean;
|
|
1322
|
+
}
|
|
1323
|
+
interface PlanExperimentArchive {
|
|
1324
|
+
experiment: {
|
|
1325
|
+
/** Public plan experiment ID. */
|
|
1326
|
+
id: string;
|
|
1327
|
+
/** The code to sell it with as planCode, such as pro:price-test. It always sells the experiment's latest version while running, and the plan's current version once closed. */
|
|
1328
|
+
code: string;
|
|
1329
|
+
/** running sells its latest version; won became the plan's current version; archived stopped selling. */
|
|
1330
|
+
status: "running" | "won" | "archived";
|
|
1331
|
+
/** The plan's version that was current when it started. */
|
|
1332
|
+
startedFromVersionId: string;
|
|
1333
|
+
/** Its latest version. */
|
|
1334
|
+
latestVersionId: string;
|
|
1335
|
+
/** The version its code sells to new buyers today. */
|
|
1336
|
+
sellsVersionId: string;
|
|
1337
|
+
/** Active, trialing, past due and paused subscriptions on its versions. */
|
|
1338
|
+
subscriptionCount: number;
|
|
1339
|
+
/** @format date-time */
|
|
1340
|
+
createdAt: string;
|
|
1341
|
+
closedAt: string | null;
|
|
1342
|
+
};
|
|
1343
|
+
/** The move of its subscribers, or null when they stay. */
|
|
1344
|
+
moveId: string | null;
|
|
1345
|
+
object: "plan_experiment_archive";
|
|
1346
|
+
livemode: boolean;
|
|
1347
|
+
}
|
|
1147
1348
|
interface PlanFeature {
|
|
1148
1349
|
planId: string;
|
|
1149
1350
|
featureId: string;
|
|
@@ -1225,6 +1426,37 @@ interface PlanGroupDetail {
|
|
|
1225
1426
|
object: "plan_group";
|
|
1226
1427
|
livemode: boolean;
|
|
1227
1428
|
}
|
|
1429
|
+
interface PlanMove {
|
|
1430
|
+
/** Public move ID. Null for a preview, which records nothing. */
|
|
1431
|
+
id: string | null;
|
|
1432
|
+
toVersionId: string;
|
|
1433
|
+
/** The versions its subscribers are moving from. */
|
|
1434
|
+
fromVersionIds: Array<string>;
|
|
1435
|
+
effective: "now" | "period_end";
|
|
1436
|
+
preview: boolean;
|
|
1437
|
+
/** checked is a preview where everyone fits; moving while subscribers wait for their move; completed once every move ran; canceled after it was canceled. */
|
|
1438
|
+
status: "checking" | "blocked" | "checked" | "moving" | "completed" | "canceled";
|
|
1439
|
+
counts: {
|
|
1440
|
+
moving: number;
|
|
1441
|
+
moved: number;
|
|
1442
|
+
needsAChange: number;
|
|
1443
|
+
leftOut: number;
|
|
1444
|
+
canceled: number;
|
|
1445
|
+
keptOnVersion: number;
|
|
1446
|
+
};
|
|
1447
|
+
subscriptions: Array<{
|
|
1448
|
+
subscriptionId: string;
|
|
1449
|
+
/** moving waits for its renewal or is being moved; moved is on the destination; needs_a_change could not move and keeps its version until it is resolved or kept; left_out was not moved because it was not active, trialing or past due, such as a paused subscription (invalid_subscription_status), or because a listed subscription was already on the destination (no_change_requested); canceled was canceled before it moved; kept_on_version was left on its version by the merchant. */
|
|
1450
|
+
status: "moving" | "moved" | "needs_a_change" | "left_out" | "canceled" | "kept_on_version";
|
|
1451
|
+
code: string | null;
|
|
1452
|
+
message: string | null;
|
|
1453
|
+
}>;
|
|
1454
|
+
createdAt: string | null;
|
|
1455
|
+
completedAt: string | null;
|
|
1456
|
+
canceledAt: string | null;
|
|
1457
|
+
object: "plan_move";
|
|
1458
|
+
livemode: boolean;
|
|
1459
|
+
}
|
|
1228
1460
|
interface PlanPrice {
|
|
1229
1461
|
/** Public plan price ID. */
|
|
1230
1462
|
id: string;
|
|
@@ -1279,6 +1511,69 @@ interface PlanRegionalPricingResult {
|
|
|
1279
1511
|
object: "plan_regional_pricing";
|
|
1280
1512
|
livemode: boolean;
|
|
1281
1513
|
}
|
|
1514
|
+
interface PlanVersion {
|
|
1515
|
+
/** Public plan version ID. */
|
|
1516
|
+
id: string;
|
|
1517
|
+
/** The plan's versions are numbered 1, 2, 3; an experiment's own versions read with its code, such as price-test 2. */
|
|
1518
|
+
label: string;
|
|
1519
|
+
/** The plan's version number. Null for a version that only belongs to an experiment; an experiment version made current takes the next number. */
|
|
1520
|
+
number: number | null;
|
|
1521
|
+
/** The experiment this version belongs to, if any. */
|
|
1522
|
+
experiment: {
|
|
1523
|
+
/** The experiment's code, as sold with planCode. */
|
|
1524
|
+
code: string;
|
|
1525
|
+
/** Its number within the experiment. */
|
|
1526
|
+
version: number;
|
|
1527
|
+
} | null;
|
|
1528
|
+
/** Whether new buyers get this version. */
|
|
1529
|
+
isCurrent: boolean;
|
|
1530
|
+
/** The version this one was created from. */
|
|
1531
|
+
parentVersionId: string | null;
|
|
1532
|
+
/** Active, trialing, past due and paused subscriptions on it. */
|
|
1533
|
+
subscriptionCount: number;
|
|
1534
|
+
maxPlanCredits: number | null;
|
|
1535
|
+
maxPlanBalance: number | null;
|
|
1536
|
+
prices: Array<{
|
|
1537
|
+
/** Public plan price ID. */
|
|
1538
|
+
id: string;
|
|
1539
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
1540
|
+
price: number;
|
|
1541
|
+
includedCredits: number | null;
|
|
1542
|
+
includedBalance: number | null;
|
|
1543
|
+
regionalPrices: Array<{
|
|
1544
|
+
currency: string;
|
|
1545
|
+
price: number;
|
|
1546
|
+
includedBalance: number | null;
|
|
1547
|
+
}>;
|
|
1548
|
+
}>;
|
|
1549
|
+
/** @format date-time */
|
|
1550
|
+
createdAt: string;
|
|
1551
|
+
object: "plan_version";
|
|
1552
|
+
livemode: boolean;
|
|
1553
|
+
}
|
|
1554
|
+
interface PlanVersionComparison {
|
|
1555
|
+
/** The version the changes start from. */
|
|
1556
|
+
versionId: string;
|
|
1557
|
+
/** The version they end at. */
|
|
1558
|
+
againstVersionId: string;
|
|
1559
|
+
/** Every term that differs, the plan's first and then each country. */
|
|
1560
|
+
changes: Array<{
|
|
1561
|
+
/** Identifies the change; send it to undo just this change. */
|
|
1562
|
+
key: string;
|
|
1563
|
+
/** Where the change is: Price, Trial, a rules section, Add-ons, or a country. */
|
|
1564
|
+
section: string;
|
|
1565
|
+
/** ISO country code when the change belongs to one country. */
|
|
1566
|
+
country: string | null;
|
|
1567
|
+
/** What changed, such as Monthly price. */
|
|
1568
|
+
label: string;
|
|
1569
|
+
/** The value before, formatted. */
|
|
1570
|
+
before: string | null;
|
|
1571
|
+
/** The value now, formatted. */
|
|
1572
|
+
after: string | null;
|
|
1573
|
+
}>;
|
|
1574
|
+
object: "plan_version_comparison";
|
|
1575
|
+
livemode: boolean;
|
|
1576
|
+
}
|
|
1282
1577
|
interface PortalAccess {
|
|
1283
1578
|
portalUrl: string;
|
|
1284
1579
|
object: "portal_session";
|
|
@@ -1299,6 +1594,11 @@ interface PreviewChange {
|
|
|
1299
1594
|
daysRemaining: number;
|
|
1300
1595
|
totalDays: number;
|
|
1301
1596
|
isUpgrade: boolean;
|
|
1597
|
+
/** Active add-ons that the version the change moves the subscription to does not sell. The change deactivates them when it applies. */
|
|
1598
|
+
deactivatedAddons: Array<{
|
|
1599
|
+
addonId: string;
|
|
1600
|
+
name: string;
|
|
1601
|
+
}>;
|
|
1302
1602
|
offerApplication?: {
|
|
1303
1603
|
id: string;
|
|
1304
1604
|
offerId: string;
|
|
@@ -1503,6 +1803,20 @@ interface SentInvoice {
|
|
|
1503
1803
|
object: "invoice_delivery";
|
|
1504
1804
|
livemode: boolean;
|
|
1505
1805
|
}
|
|
1806
|
+
interface SubscriberNeedingAChange {
|
|
1807
|
+
subscriptionId: string;
|
|
1808
|
+
/** The move it could not complete. */
|
|
1809
|
+
moveId: string;
|
|
1810
|
+
/** The version it stays on. */
|
|
1811
|
+
fromVersionId: string;
|
|
1812
|
+
/** The version it could not move to. */
|
|
1813
|
+
toVersionId: string;
|
|
1814
|
+
/** Why it could not move. */
|
|
1815
|
+
code: string;
|
|
1816
|
+
message: string;
|
|
1817
|
+
object: "subscriber_needing_a_change";
|
|
1818
|
+
livemode: boolean;
|
|
1819
|
+
}
|
|
1506
1820
|
interface Subscription {
|
|
1507
1821
|
id: string;
|
|
1508
1822
|
customerId: string;
|
|
@@ -1551,6 +1865,13 @@ interface Subscription {
|
|
|
1551
1865
|
createdAt: string;
|
|
1552
1866
|
/** @format date-time */
|
|
1553
1867
|
updatedAt: string;
|
|
1868
|
+
/** The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved. */
|
|
1869
|
+
planVersion: {
|
|
1870
|
+
/** Public plan version ID. */
|
|
1871
|
+
id: string;
|
|
1872
|
+
/** Main versions are 1, 2, 3; an experiment's versions carry its own code, like price-test 2. */
|
|
1873
|
+
label: string;
|
|
1874
|
+
} | null;
|
|
1554
1875
|
offerApplications: Array<SubscriptionOfferApplication>;
|
|
1555
1876
|
pause: {
|
|
1556
1877
|
status: "scheduled";
|
|
@@ -1569,6 +1890,13 @@ interface Subscription {
|
|
|
1569
1890
|
effectiveAt: string;
|
|
1570
1891
|
resumeAt: string | null;
|
|
1571
1892
|
} | null;
|
|
1893
|
+
/** A move to another version of the plan pending for the next renewal. */
|
|
1894
|
+
scheduledVersionChange: {
|
|
1895
|
+
planVersionId: string;
|
|
1896
|
+
label: string;
|
|
1897
|
+
/** @format date-time */
|
|
1898
|
+
effectiveAt: string;
|
|
1899
|
+
} | null;
|
|
1572
1900
|
planGrant?: {
|
|
1573
1901
|
/** The active Plan Grant ID. */
|
|
1574
1902
|
id: string;
|
|
@@ -1636,14 +1964,27 @@ interface Subscription {
|
|
|
1636
1964
|
} | null;
|
|
1637
1965
|
}>;
|
|
1638
1966
|
credits: {
|
|
1967
|
+
/** Plan credits left. Kept for compatibility; equal to `plan`. */
|
|
1639
1968
|
remaining: number;
|
|
1640
1969
|
included: number;
|
|
1970
|
+
/** Purchased credits: purchases and manual adjustments. Spent after plan credits and kept until the subscription ends. */
|
|
1641
1971
|
purchased: number;
|
|
1972
|
+
/** Plan credits left this period. Spent first and replaced or rolled over at each reset; negative while overage is owed. */
|
|
1973
|
+
plan: number;
|
|
1974
|
+
/** Credits available: `plan` plus `purchased`. */
|
|
1975
|
+
total: number;
|
|
1642
1976
|
} | null;
|
|
1643
1977
|
balance: {
|
|
1978
|
+
/** Balance available in minor units of the subscription currency. Kept for compatibility; equal to `total`. */
|
|
1644
1979
|
remaining: number;
|
|
1645
1980
|
included: number;
|
|
1646
1981
|
currency: string;
|
|
1982
|
+
/** Plan balance left this period, in minor units. Spent first and replaced or rolled over at each reset; negative while overage is owed. */
|
|
1983
|
+
plan: number;
|
|
1984
|
+
/** Purchased balance in minor units: top-ups and manual adjustments. Spent after the plan balance and kept until the subscription ends. */
|
|
1985
|
+
purchased: number;
|
|
1986
|
+
/** Balance available in minor units: `plan` plus `purchased`. */
|
|
1987
|
+
total: number;
|
|
1647
1988
|
} | null;
|
|
1648
1989
|
priceId: string | null;
|
|
1649
1990
|
object: "subscription";
|
|
@@ -1657,23 +1998,25 @@ interface SubscriptionAddon {
|
|
|
1657
1998
|
livemode: boolean;
|
|
1658
1999
|
}
|
|
1659
2000
|
interface SubscriptionAutoTopUp {
|
|
1660
|
-
/** Whether credits
|
|
2001
|
+
/** Whether top-ups run automatically: credits bought on a credits plan, balance added on a balance plan. Always false when the plan does not sell credits or has balance top-ups turned off. */
|
|
1661
2002
|
enabled: boolean;
|
|
1662
|
-
/**
|
|
2003
|
+
/** The available amount at or below which a top-up runs, or null when never configured: credits (plan plus purchased) on a credits plan, minor units of the subscription currency (plan plus purchased balance) on a balance plan. */
|
|
1663
2004
|
threshold: number | null;
|
|
1664
|
-
/** Credits each top-up buys, or null when never configured. */
|
|
2005
|
+
/** Credits each top-up buys on a credits plan, or null when never configured or on a balance plan. */
|
|
1665
2006
|
quantity: number | null;
|
|
1666
|
-
/**
|
|
2007
|
+
/** Minor units of the subscription currency each top-up adds on a balance plan, charged plus tax, or null when never configured or on a credits plan. */
|
|
2008
|
+
amount: number | null;
|
|
2009
|
+
/** Maximum top-ups per renewal period, or null when never configured. */
|
|
1667
2010
|
maxPerPeriod: number | null;
|
|
1668
|
-
/** active
|
|
2011
|
+
/** active tops up when the available amount reaches the threshold; paused stops after three consecutive failed top-ups, or after one whose charge could not be refunded, until the payment method changes, a credit purchase or balance top-up succeeds or it is saved enabled again; off tops up nothing. */
|
|
1669
2012
|
status: "active" | "paused" | "off";
|
|
1670
|
-
/** Top-ups
|
|
2013
|
+
/** Top-ups made in the current renewal period. */
|
|
1671
2014
|
topUpsThisPeriod: number;
|
|
1672
2015
|
/** When the top-up count of the period resets, or null before the subscription starts its first period. */
|
|
1673
2016
|
periodResetsAt: string | null;
|
|
1674
2017
|
/** The last top-up that failed, or null when none has failed. */
|
|
1675
2018
|
lastFailure: {
|
|
1676
|
-
reason: "payment_declined" | "no_payment_method" | "quantity_below_minimum" | "purchase_failed";
|
|
2019
|
+
reason: "payment_declined" | "no_payment_method" | "quantity_below_minimum" | "amount_below_minimum" | "purchase_failed";
|
|
1677
2020
|
/** @format date-time */
|
|
1678
2021
|
at: string;
|
|
1679
2022
|
} | null;
|
|
@@ -1788,6 +2131,13 @@ interface SubscriptionSummary {
|
|
|
1788
2131
|
createdAt: string;
|
|
1789
2132
|
/** @format date-time */
|
|
1790
2133
|
updatedAt: string;
|
|
2134
|
+
/** The plan version whose terms the subscription has now. It keeps paying and receiving everything from this version until it is moved. */
|
|
2135
|
+
planVersion: {
|
|
2136
|
+
/** Public plan version ID. */
|
|
2137
|
+
id: string;
|
|
2138
|
+
/** Main versions are 1, 2, 3; an experiment's versions carry its own code, like price-test 2. */
|
|
2139
|
+
label: string;
|
|
2140
|
+
} | null;
|
|
1791
2141
|
offerApplications: Array<SubscriptionOfferApplication>;
|
|
1792
2142
|
pause: {
|
|
1793
2143
|
status: "scheduled";
|
|
@@ -2025,6 +2375,8 @@ type UsageCheck = {
|
|
|
2025
2375
|
*/
|
|
2026
2376
|
resetsAt: string;
|
|
2027
2377
|
} | null;
|
|
2378
|
+
/** Whether usage stops when plan and purchased credits run out. False only when the plan allows overage, which is billed at its price per credit; trials and free plans always stop. */
|
|
2379
|
+
blockOnExhaustion: boolean;
|
|
2028
2380
|
object: "usage_check";
|
|
2029
2381
|
livemode: boolean;
|
|
2030
2382
|
} | {
|
|
@@ -2037,7 +2389,29 @@ type UsageCheck = {
|
|
|
2037
2389
|
consumptionModel: "balance";
|
|
2038
2390
|
unitPrice: number;
|
|
2039
2391
|
estimatedAmount: number;
|
|
2392
|
+
/** The available balance, plan plus purchased, in rate scale (10000 = 1.00 of the subscription currency). Equal to totalBalance. */
|
|
2040
2393
|
currentBalance: number;
|
|
2394
|
+
/** The plan part of the balance in rate scale. Consumed first, replaced or rolled over at each reset, and negative while overage is owed. */
|
|
2395
|
+
planBalance: number;
|
|
2396
|
+
/** The purchased part of the balance in rate scale: top-ups and adjustments. Consumed after the plan part and kept until the subscription ends. */
|
|
2397
|
+
purchasedBalance: number;
|
|
2398
|
+
/** planBalance plus purchasedBalance, in rate scale. */
|
|
2399
|
+
totalBalance: number;
|
|
2400
|
+
planBalanceLimit: {
|
|
2401
|
+
/** The most plan balance the subscription spends per window, in rate scale (10000 = 1.00 of the subscription currency). */
|
|
2402
|
+
amount: number;
|
|
2403
|
+
/** The window length: 24 hours for `day`, 7 days for `week`. */
|
|
2404
|
+
interval: "day" | "week";
|
|
2405
|
+
/** Plan balance spent in the current window, in rate scale. */
|
|
2406
|
+
spent: number;
|
|
2407
|
+
/** Plan balance the subscription can still spend in the current window, in rate scale. Purchased balance is not limited. */
|
|
2408
|
+
remaining: number;
|
|
2409
|
+
/**
|
|
2410
|
+
* When the next window starts and spending resets.
|
|
2411
|
+
* @format date-time
|
|
2412
|
+
*/
|
|
2413
|
+
resetsAt: string;
|
|
2414
|
+
} | null;
|
|
2041
2415
|
blockOnExhaustion: boolean;
|
|
2042
2416
|
currency: string;
|
|
2043
2417
|
object: "usage_check";
|
|
@@ -2078,6 +2452,22 @@ interface UsageEvent {
|
|
|
2078
2452
|
*/
|
|
2079
2453
|
resetsAt: string;
|
|
2080
2454
|
} | null;
|
|
2455
|
+
/** Balance consumption on a plan with a plan balance limit: the limit after this event. Omitted for credits and for plans without a limit. */
|
|
2456
|
+
planBalanceLimit?: {
|
|
2457
|
+
/** The most plan balance the subscription spends per window, in rate scale (10000 = 1.00 of the subscription currency). */
|
|
2458
|
+
amount: number;
|
|
2459
|
+
/** The window length: 24 hours for `day`, 7 days for `week`. */
|
|
2460
|
+
interval: "day" | "week";
|
|
2461
|
+
/** Plan balance spent in the current window, in rate scale. */
|
|
2462
|
+
spent: number;
|
|
2463
|
+
/** Plan balance the subscription can still spend in the current window, in rate scale. Purchased balance is not limited. */
|
|
2464
|
+
remaining: number;
|
|
2465
|
+
/**
|
|
2466
|
+
* When the next window starts and spending resets.
|
|
2467
|
+
* @format date-time
|
|
2468
|
+
*/
|
|
2469
|
+
resetsAt: string;
|
|
2470
|
+
} | null;
|
|
2081
2471
|
};
|
|
2082
2472
|
object: "usage_event";
|
|
2083
2473
|
livemode: boolean;
|
|
@@ -2124,7 +2514,14 @@ interface WebhookAddonRef {
|
|
|
2124
2514
|
name: string;
|
|
2125
2515
|
}
|
|
2126
2516
|
interface WebhookBalance {
|
|
2517
|
+
/** The available balance, plan plus purchased, in rate scale. Equal to totalBalance. */
|
|
2127
2518
|
currentBalance: number;
|
|
2519
|
+
/** The plan part in rate scale: spent first, replaced or rolled over at each reset, negative while overage is owed. */
|
|
2520
|
+
planBalance: number;
|
|
2521
|
+
/** The purchased part in rate scale: top-ups and manual adjustments, spent after the plan part and kept until the subscription ends. */
|
|
2522
|
+
purchasedBalance: number;
|
|
2523
|
+
/** planBalance plus purchasedBalance, in rate scale. */
|
|
2524
|
+
totalBalance: number;
|
|
2128
2525
|
}
|
|
2129
2526
|
interface WebhookBankRef {
|
|
2130
2527
|
bankName: string | null;
|
|
@@ -2230,6 +2627,8 @@ interface UpdateAddonParams {
|
|
|
2230
2627
|
basePrice?: number;
|
|
2231
2628
|
includedUnits?: number;
|
|
2232
2629
|
overageRate?: number;
|
|
2630
|
+
/** 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. */
|
|
2631
|
+
planIds?: Array<string>;
|
|
2233
2632
|
}
|
|
2234
2633
|
interface DeleteAddonParams {
|
|
2235
2634
|
id: string;
|
|
@@ -2243,12 +2642,16 @@ type CreateAddonParams = {
|
|
|
2243
2642
|
description?: string;
|
|
2244
2643
|
basePrice: number;
|
|
2245
2644
|
featureId: string;
|
|
2645
|
+
/** Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2646
|
+
planIds?: Array<string>;
|
|
2246
2647
|
consumptionModel: "boolean";
|
|
2247
2648
|
} | {
|
|
2248
2649
|
name: string;
|
|
2249
2650
|
description?: string;
|
|
2250
2651
|
basePrice: number;
|
|
2251
2652
|
featureId: string;
|
|
2653
|
+
/** Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2654
|
+
planIds?: Array<string>;
|
|
2252
2655
|
consumptionModel: "metered";
|
|
2253
2656
|
includedUnits: number;
|
|
2254
2657
|
overageRate: number;
|
|
@@ -2257,6 +2660,8 @@ type CreateAddonParams = {
|
|
|
2257
2660
|
description?: string;
|
|
2258
2661
|
basePrice: number;
|
|
2259
2662
|
featureId: string;
|
|
2663
|
+
/** Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2664
|
+
planIds?: Array<string>;
|
|
2260
2665
|
consumptionModel: "credits";
|
|
2261
2666
|
creditCost: number;
|
|
2262
2667
|
} | {
|
|
@@ -2264,6 +2669,8 @@ type CreateAddonParams = {
|
|
|
2264
2669
|
description?: string;
|
|
2265
2670
|
basePrice: number;
|
|
2266
2671
|
featureId: string;
|
|
2672
|
+
/** Plans that sell the add-on. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2673
|
+
planIds?: Array<string>;
|
|
2267
2674
|
consumptionModel: "balance";
|
|
2268
2675
|
overageRate: number;
|
|
2269
2676
|
};
|
|
@@ -2279,7 +2686,7 @@ declare class AddonsResource {
|
|
|
2279
2686
|
}>;
|
|
2280
2687
|
/** Retrieve an add-on by its public ID or slug. */
|
|
2281
2688
|
get(params: GetAddonParams, options?: RequestOptions): Promise<Addon>;
|
|
2282
|
-
/** Update an add-on's name, description, or
|
|
2689
|
+
/** Update an add-on's name, description, pricing, or the plans that sell it. */
|
|
2283
2690
|
update(params: UpdateAddonParams, options?: RequestOptions): Promise<Addon>;
|
|
2284
2691
|
/** Soft-delete an add-on. Fails if the add-on has active subscriptions. */
|
|
2285
2692
|
delete(params: DeleteAddonParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
@@ -2349,6 +2756,8 @@ interface UpdateCreditPackParams {
|
|
|
2349
2756
|
credits?: number;
|
|
2350
2757
|
price?: number;
|
|
2351
2758
|
isActive?: boolean;
|
|
2759
|
+
/** Plans that sell the credit pack, replacing the current ones. Empty means every plan; omitted keeps them. */
|
|
2760
|
+
planIds?: Array<string>;
|
|
2352
2761
|
}
|
|
2353
2762
|
interface DeleteCreditPackParams {
|
|
2354
2763
|
id: string;
|
|
@@ -2359,11 +2768,13 @@ interface CreateCreditPackParams {
|
|
|
2359
2768
|
credits: number;
|
|
2360
2769
|
price: number;
|
|
2361
2770
|
isActive?: boolean;
|
|
2771
|
+
/** Plans that sell the credit pack. Omitted or empty, every plan sells it. Plans created later sell it too. */
|
|
2772
|
+
planIds?: Array<string>;
|
|
2362
2773
|
}
|
|
2363
2774
|
declare class CreditPacksResource {
|
|
2364
2775
|
private httpClient;
|
|
2365
2776
|
constructor(httpClient: CommetHTTPClient);
|
|
2366
|
-
/** Update a credit pack's name, description, credits, price, or
|
|
2777
|
+
/** Update a credit pack's name, description, credits, price, active status, or the plans that sell it. */
|
|
2367
2778
|
update(params: UpdateCreditPackParams, options?: RequestOptions): Promise<CreditPack>;
|
|
2368
2779
|
/** Soft-delete a credit pack. */
|
|
2369
2780
|
delete(params: DeleteCreditPackParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
@@ -2450,6 +2861,8 @@ interface UpdateCustomerParams {
|
|
|
2450
2861
|
email?: string;
|
|
2451
2862
|
fullName?: string;
|
|
2452
2863
|
taxDocument?: string;
|
|
2864
|
+
/** Business tax ID, such as an EU VAT number or a Peruvian RUC, for the country of the customer's address. Accepted only where Commet collects tax; a valid ID replaces consumer tax with the business treatment. Send null to remove it. */
|
|
2865
|
+
businessTaxId?: string | null;
|
|
2453
2866
|
externalId?: string;
|
|
2454
2867
|
timezone?: Timezone;
|
|
2455
2868
|
metadata?: Record<string, unknown>;
|
|
@@ -2495,6 +2908,8 @@ interface CreateCustomerParams {
|
|
|
2495
2908
|
externalId?: string;
|
|
2496
2909
|
fullName?: string;
|
|
2497
2910
|
taxDocument?: string;
|
|
2911
|
+
/** Business tax ID, such as an EU VAT number or a Peruvian RUC, for the country of the customer's address. Accepted only where Commet collects tax; a valid ID replaces consumer tax with the business treatment. */
|
|
2912
|
+
businessTaxId?: string;
|
|
2498
2913
|
address?: {
|
|
2499
2914
|
line1: string;
|
|
2500
2915
|
line2?: string;
|
|
@@ -2933,6 +3348,242 @@ declare class PlanGroupsResource {
|
|
|
2933
3348
|
create(params: CreatePlanGroupParams, options?: RequestOptions): Promise<PlanGroup>;
|
|
2934
3349
|
}
|
|
2935
3350
|
|
|
3351
|
+
type PublishPlanDraftParams = {
|
|
3352
|
+
id: string;
|
|
3353
|
+
draftId: string;
|
|
3354
|
+
/** current sells the draft to every new buyer. */
|
|
3355
|
+
publishAs: "current";
|
|
3356
|
+
/** 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. */
|
|
3357
|
+
move?: "keep" | "period_end" | "now";
|
|
3358
|
+
/** Per-subscriber changes that make each one fit, applied at its renewal. */
|
|
3359
|
+
changes?: Array<{
|
|
3360
|
+
subscriptionId: string;
|
|
3361
|
+
/** Leave this subscriber on its version. */
|
|
3362
|
+
keepOnVersion?: true;
|
|
3363
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
3364
|
+
/** Lower its seats to the version's limit at renewal. */
|
|
3365
|
+
seatLimit?: true;
|
|
3366
|
+
/** Add-ons it stops paying at renewal. */
|
|
3367
|
+
removeAddonIds?: Array<string>;
|
|
3368
|
+
}>;
|
|
3369
|
+
/** Check everything without publishing. */
|
|
3370
|
+
preview?: boolean;
|
|
3371
|
+
} | {
|
|
3372
|
+
id: string;
|
|
3373
|
+
draftId: string;
|
|
3374
|
+
/** experiment starts an experiment with experimentCode, sold with planCode plan:code. Starting an experiment moves nobody, so it takes no move or changes. */
|
|
3375
|
+
publishAs: "experiment";
|
|
3376
|
+
/** The experiment's own code, after the plan's code. */
|
|
3377
|
+
experimentCode: string;
|
|
3378
|
+
/** Check everything without publishing. */
|
|
3379
|
+
preview?: boolean;
|
|
3380
|
+
} | {
|
|
3381
|
+
id: string;
|
|
3382
|
+
draftId: string;
|
|
3383
|
+
/** experiment_version publishes the next version of the experiment the draft started from. */
|
|
3384
|
+
publishAs: "experiment_version";
|
|
3385
|
+
/** 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. */
|
|
3386
|
+
move?: "keep" | "period_end" | "now";
|
|
3387
|
+
/** Per-subscriber changes that make each one fit, applied at its renewal. */
|
|
3388
|
+
changes?: Array<{
|
|
3389
|
+
subscriptionId: string;
|
|
3390
|
+
/** Leave this subscriber on its version. */
|
|
3391
|
+
keepOnVersion?: true;
|
|
3392
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
3393
|
+
/** Lower its seats to the version's limit at renewal. */
|
|
3394
|
+
seatLimit?: true;
|
|
3395
|
+
/** Add-ons it stops paying at renewal. */
|
|
3396
|
+
removeAddonIds?: Array<string>;
|
|
3397
|
+
}>;
|
|
3398
|
+
/** Check everything without publishing. */
|
|
3399
|
+
preview?: boolean;
|
|
3400
|
+
};
|
|
3401
|
+
interface GetPlanDraftParams {
|
|
3402
|
+
id: string;
|
|
3403
|
+
draftId: string;
|
|
3404
|
+
}
|
|
3405
|
+
interface UpdatePlanDraftParams {
|
|
3406
|
+
id: string;
|
|
3407
|
+
draftId: string;
|
|
3408
|
+
/** Every interval the draft sells. An interval the draft sold and this list leaves out is removed from the draft. */
|
|
3409
|
+
prices?: Array<{
|
|
3410
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3411
|
+
/** USD price in cents. */
|
|
3412
|
+
price: number;
|
|
3413
|
+
includedCredits?: number | null;
|
|
3414
|
+
includedBalance?: number | null;
|
|
3415
|
+
/** Days of trial on this price. Null removes the trial. */
|
|
3416
|
+
trialDays?: number | null;
|
|
3417
|
+
trialRequiresPaymentMethod?: boolean;
|
|
3418
|
+
/** Show this interval first at checkout and in pricing tables. */
|
|
3419
|
+
isDefault?: boolean;
|
|
3420
|
+
}>;
|
|
3421
|
+
/** Every country with its own currency or prices. A country the draft sold and this list leaves out is removed. A country missing a price blocks publishing. */
|
|
3422
|
+
countries?: Array<{
|
|
3423
|
+
/** ISO country code. */
|
|
3424
|
+
country: string;
|
|
3425
|
+
/** The currency the country pays in, USD included. */
|
|
3426
|
+
currency: string;
|
|
3427
|
+
/** Local units per USD for prices that follow the USD base. USD defaults to 1. */
|
|
3428
|
+
exchangeRate?: number | null;
|
|
3429
|
+
prices: Array<{
|
|
3430
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3431
|
+
/** The price set by hand, in the currency's minor unit. */
|
|
3432
|
+
price: number;
|
|
3433
|
+
/** The balance included each period in this country, in the currency's minor unit. Required when the plan's price includes a balance. */
|
|
3434
|
+
includedBalance?: number;
|
|
3435
|
+
} | {
|
|
3436
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3437
|
+
/** Follow the USD base at the exchange rate. */
|
|
3438
|
+
followBase: true;
|
|
3439
|
+
}>;
|
|
3440
|
+
/** 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. */
|
|
3441
|
+
topUpMinimum?: number | null;
|
|
3442
|
+
/** Most unused plan balance that rolls over in this country. Null follows the USD cap at the exchange rate; left out keeps it. */
|
|
3443
|
+
maxPlanBalance?: number | null;
|
|
3444
|
+
/** Most plan balance spent per limit interval in this country. Null follows the USD limit at the exchange rate; left out keeps it. */
|
|
3445
|
+
planBalanceLimit?: number | null;
|
|
3446
|
+
/** 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. */
|
|
3447
|
+
addonPrices?: Array<{
|
|
3448
|
+
addonId: string;
|
|
3449
|
+
/** The add-on's price set by hand, in the currency's minor unit. */
|
|
3450
|
+
price: number;
|
|
3451
|
+
} | {
|
|
3452
|
+
addonId: string;
|
|
3453
|
+
/** Follow the add-on's USD price at the exchange rate. */
|
|
3454
|
+
followBase: true;
|
|
3455
|
+
}>;
|
|
3456
|
+
/** 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. */
|
|
3457
|
+
creditPackPrices?: Array<{
|
|
3458
|
+
creditPackId: string;
|
|
3459
|
+
/** The pack's price set by hand, in the currency's minor unit. */
|
|
3460
|
+
price: number;
|
|
3461
|
+
} | {
|
|
3462
|
+
creditPackId: string;
|
|
3463
|
+
/** Follow the pack's USD price at the exchange rate. */
|
|
3464
|
+
followBase: true;
|
|
3465
|
+
}>;
|
|
3466
|
+
}>;
|
|
3467
|
+
/** Credit or balance rules; fields left out stay as they are. */
|
|
3468
|
+
rules?: {
|
|
3469
|
+
/** Credits a free plan includes each month. */
|
|
3470
|
+
freeIncludedCredits?: number | null;
|
|
3471
|
+
/** Balance a free plan includes each month, in cents. */
|
|
3472
|
+
freeIncludedBalance?: number | null;
|
|
3473
|
+
unusedPlanCredits?: "expire" | "roll_over";
|
|
3474
|
+
maxPlanCredits?: number | null;
|
|
3475
|
+
planCreditLimit?: number | null;
|
|
3476
|
+
planCreditLimitInterval?: "day" | "week" | null;
|
|
3477
|
+
unusedPlanBalance?: "expire" | "roll_over";
|
|
3478
|
+
maxPlanBalance?: number | null;
|
|
3479
|
+
planBalanceLimit?: number | null;
|
|
3480
|
+
planBalanceLimitInterval?: "day" | "week" | null;
|
|
3481
|
+
blockOnExhaustion?: boolean;
|
|
3482
|
+
purchasesEnabled?: boolean;
|
|
3483
|
+
creditPurchaseUnitPrice?: number | null;
|
|
3484
|
+
creditPurchaseMinimum?: number | null;
|
|
3485
|
+
topUpMinimum?: number | null;
|
|
3486
|
+
};
|
|
3487
|
+
/** Change keys to put back as the version the draft started from had them. */
|
|
3488
|
+
undo?: Array<string>;
|
|
3489
|
+
}
|
|
3490
|
+
interface DeletePlanDraftParams {
|
|
3491
|
+
id: string;
|
|
3492
|
+
draftId: string;
|
|
3493
|
+
}
|
|
3494
|
+
interface ListPlanDraftsParams {
|
|
3495
|
+
id: string;
|
|
3496
|
+
}
|
|
3497
|
+
interface CreatePlanDraftParams {
|
|
3498
|
+
id: string;
|
|
3499
|
+
/** The version to start from: the current version, an experiment's version or an older version. Defaults to the current version. */
|
|
3500
|
+
fromVersionId?: string;
|
|
3501
|
+
}
|
|
3502
|
+
interface ArchivePlanExperimentParams {
|
|
3503
|
+
id: string;
|
|
3504
|
+
code: string;
|
|
3505
|
+
/** What happens to the experiment's subscribers: keep them on its versions, move them to the plan's current version at their next renewal, or move them now. Nobody moves, and the experiment keeps running, unless every one of them fits or has a change. */
|
|
3506
|
+
subscribers?: "keep" | "period_end" | "now";
|
|
3507
|
+
/** Per-subscriber changes that make each one fit, applied at its renewal. */
|
|
3508
|
+
changes?: Array<{
|
|
3509
|
+
subscriptionId: string;
|
|
3510
|
+
/** Leave this subscriber on its version. */
|
|
3511
|
+
keepOnVersion?: true;
|
|
3512
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
3513
|
+
/** Lower its seats to the version's limit at renewal. */
|
|
3514
|
+
seatLimit?: true;
|
|
3515
|
+
/** Add-ons it stops paying at renewal. */
|
|
3516
|
+
removeAddonIds?: Array<string>;
|
|
3517
|
+
}>;
|
|
3518
|
+
/** Check the archive and the move without changing anything. */
|
|
3519
|
+
preview?: boolean;
|
|
3520
|
+
}
|
|
3521
|
+
interface MakePlanExperimentCurrentParams {
|
|
3522
|
+
id: string;
|
|
3523
|
+
code: string;
|
|
3524
|
+
}
|
|
3525
|
+
interface GetPlanExperimentParams {
|
|
3526
|
+
id: string;
|
|
3527
|
+
code: string;
|
|
3528
|
+
}
|
|
3529
|
+
interface CreatePlanExperimentVersionParams {
|
|
3530
|
+
id: string;
|
|
3531
|
+
code: string;
|
|
3532
|
+
prices?: Array<{
|
|
3533
|
+
/** An interval the plan already sells. Prices not listed are copied unchanged from the current version. */
|
|
3534
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3535
|
+
/** USD price in the currency's minor unit (cents). */
|
|
3536
|
+
price: number;
|
|
3537
|
+
includedCredits?: number | null;
|
|
3538
|
+
includedBalance?: number | null;
|
|
3539
|
+
/** Per-currency amounts. A currency the current version does not sell also needs its exchangeRate in currencies; its amounts not listed here are derived from the USD price. */
|
|
3540
|
+
regionalPrices?: Array<{
|
|
3541
|
+
currency: string;
|
|
3542
|
+
price: number;
|
|
3543
|
+
includedBalance?: number | null;
|
|
3544
|
+
}>;
|
|
3545
|
+
}>;
|
|
3546
|
+
/** Currencies the current version does not sell, with the exchange rate (local units per USD) used for the amounts not listed, credit purchases, add-ons and overage. */
|
|
3547
|
+
currencies?: Array<{
|
|
3548
|
+
currency: string;
|
|
3549
|
+
exchangeRate: number;
|
|
3550
|
+
}>;
|
|
3551
|
+
/** Credits plans that roll over unused credits: the most plan credits a subscription can hold. Null removes the cap. */
|
|
3552
|
+
maxPlanCredits?: number | null;
|
|
3553
|
+
/** Balance plans that roll over unused balance: the most plan balance a subscription can hold, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. Null removes the cap. */
|
|
3554
|
+
maxPlanBalance?: number | null;
|
|
3555
|
+
}
|
|
3556
|
+
interface ListPlanExperimentsParams {
|
|
3557
|
+
id: string;
|
|
3558
|
+
}
|
|
3559
|
+
interface CreatePlanExperimentParams {
|
|
3560
|
+
id: string;
|
|
3561
|
+
prices?: Array<{
|
|
3562
|
+
/** An interval the plan already sells. Prices not listed are copied unchanged from the current version. */
|
|
3563
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3564
|
+
/** USD price in the currency's minor unit (cents). */
|
|
3565
|
+
price: number;
|
|
3566
|
+
includedCredits?: number | null;
|
|
3567
|
+
includedBalance?: number | null;
|
|
3568
|
+
/** Per-currency amounts. A currency the current version does not sell also needs its exchangeRate in currencies; its amounts not listed here are derived from the USD price. */
|
|
3569
|
+
regionalPrices?: Array<{
|
|
3570
|
+
currency: string;
|
|
3571
|
+
price: number;
|
|
3572
|
+
includedBalance?: number | null;
|
|
3573
|
+
}>;
|
|
3574
|
+
}>;
|
|
3575
|
+
/** Currencies the current version does not sell, with the exchange rate (local units per USD) used for the amounts not listed, credit purchases, add-ons and overage. */
|
|
3576
|
+
currencies?: Array<{
|
|
3577
|
+
currency: string;
|
|
3578
|
+
exchangeRate: number;
|
|
3579
|
+
}>;
|
|
3580
|
+
/** Credits plans that roll over unused credits: the most plan credits a subscription can hold. Null removes the cap. */
|
|
3581
|
+
maxPlanCredits?: number | null;
|
|
3582
|
+
/** Balance plans that roll over unused balance: the most plan balance a subscription can hold, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. Null removes the cap. */
|
|
3583
|
+
maxPlanBalance?: number | null;
|
|
3584
|
+
/** The experiment's own code: lowercase letters, numbers, hyphens and underscores. It is sold as planCode `<plan code>:<code>` and is never reused in the plan. */
|
|
3585
|
+
code: string;
|
|
3586
|
+
}
|
|
2936
3587
|
interface UpdatePlanFeatureParams {
|
|
2937
3588
|
id: string;
|
|
2938
3589
|
featureId: string;
|
|
@@ -2963,6 +3614,72 @@ interface AddPlanFeatureParams {
|
|
|
2963
3614
|
pricingMode?: "fixed" | "ai_model";
|
|
2964
3615
|
margin?: number | null;
|
|
2965
3616
|
}
|
|
3617
|
+
interface CancelPlanMoveParams {
|
|
3618
|
+
id: string;
|
|
3619
|
+
moveId: string;
|
|
3620
|
+
}
|
|
3621
|
+
interface GetPlanMoveParams {
|
|
3622
|
+
id: string;
|
|
3623
|
+
moveId: string;
|
|
3624
|
+
}
|
|
3625
|
+
interface CancelPlanMoveSubscriptionParams {
|
|
3626
|
+
id: string;
|
|
3627
|
+
moveId: string;
|
|
3628
|
+
subscriptionId: string;
|
|
3629
|
+
}
|
|
3630
|
+
interface ListPlanMovesParams {
|
|
3631
|
+
id: string;
|
|
3632
|
+
}
|
|
3633
|
+
type CreatePlanMoveParams = {
|
|
3634
|
+
id: string;
|
|
3635
|
+
/** Public IDs of the subscriptions to move. */
|
|
3636
|
+
subscriptionIds: Array<string>;
|
|
3637
|
+
/** The version subscribers move to. */
|
|
3638
|
+
toVersionId: string;
|
|
3639
|
+
/** now changes features and the included amount today and the price at renewal; period_end moves each subscriber at its next renewal. */
|
|
3640
|
+
effective: "now" | "period_end";
|
|
3641
|
+
/** Per-subscriber changes that make each one fit, applied at its renewal. */
|
|
3642
|
+
changes?: Array<{
|
|
3643
|
+
subscriptionId: string;
|
|
3644
|
+
/** Leave this subscriber on its version. */
|
|
3645
|
+
keepOnVersion?: true;
|
|
3646
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
3647
|
+
/** Lower its seats to the version's limit at renewal. */
|
|
3648
|
+
seatLimit?: true;
|
|
3649
|
+
/** Add-ons it stops paying at renewal. */
|
|
3650
|
+
removeAddonIds?: Array<string>;
|
|
3651
|
+
}>;
|
|
3652
|
+
/** Check every subscriber without moving anyone. */
|
|
3653
|
+
preview?: boolean;
|
|
3654
|
+
} | {
|
|
3655
|
+
id: string;
|
|
3656
|
+
/** Move every active, trialing and past due subscription on this version of the plan. */
|
|
3657
|
+
fromVersionId: string;
|
|
3658
|
+
/** The version subscribers move to. */
|
|
3659
|
+
toVersionId: string;
|
|
3660
|
+
/** now changes features and the included amount today and the price at renewal; period_end moves each subscriber at its next renewal. */
|
|
3661
|
+
effective: "now" | "period_end";
|
|
3662
|
+
/** Per-subscriber changes that make each one fit, applied at its renewal. */
|
|
3663
|
+
changes?: Array<{
|
|
3664
|
+
subscriptionId: string;
|
|
3665
|
+
/** Leave this subscriber on its version. */
|
|
3666
|
+
keepOnVersion?: true;
|
|
3667
|
+
billingInterval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
|
|
3668
|
+
/** Lower its seats to the version's limit at renewal. */
|
|
3669
|
+
seatLimit?: true;
|
|
3670
|
+
/** Add-ons it stops paying at renewal. */
|
|
3671
|
+
removeAddonIds?: Array<string>;
|
|
3672
|
+
}>;
|
|
3673
|
+
/** Check every subscriber without moving anyone. */
|
|
3674
|
+
preview?: boolean;
|
|
3675
|
+
};
|
|
3676
|
+
interface KeepPlanSubscriberOnVersionParams {
|
|
3677
|
+
id: string;
|
|
3678
|
+
subscriptionId: string;
|
|
3679
|
+
}
|
|
3680
|
+
interface ListPlanSubscribersNeedingAChangeParams {
|
|
3681
|
+
id: string;
|
|
3682
|
+
}
|
|
2966
3683
|
interface SetDefaultPlanPriceParams {
|
|
2967
3684
|
id: string;
|
|
2968
3685
|
priceId: string;
|
|
@@ -3058,7 +3775,7 @@ interface UpdatePlanParams {
|
|
|
3058
3775
|
description?: string | null;
|
|
3059
3776
|
metadata?: Record<string, unknown>;
|
|
3060
3777
|
isPublic?: boolean;
|
|
3061
|
-
/** Credits plans only. What happens to unused plan credits at each reset.
|
|
3778
|
+
/** 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. */
|
|
3062
3779
|
unusedPlanCredits?: {
|
|
3063
3780
|
type: "expire";
|
|
3064
3781
|
} | {
|
|
@@ -3066,19 +3783,76 @@ interface UpdatePlanParams {
|
|
|
3066
3783
|
/** The most plan credits a subscription holds after a reset, including the credits that reset grants; credits above it expire. At least the included credits of every price. null means no limit other than the largest storable balance, 2,147,483,647 plan credits. */
|
|
3067
3784
|
maxPlanCredits: number | null;
|
|
3068
3785
|
};
|
|
3069
|
-
/** Credits plans only. The most plan credits a subscription spends per day or per week; null removes the limit.
|
|
3786
|
+
/** Credits plans only. The most plan credits a subscription spends per day or per week; null removes the limit. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
|
|
3070
3787
|
planCreditLimit?: {
|
|
3071
3788
|
/** The most plan credits a subscription spends in one window. */
|
|
3072
3789
|
credits: number;
|
|
3073
3790
|
/** The window length: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. */
|
|
3074
3791
|
interval: "day" | "week";
|
|
3075
3792
|
} | null;
|
|
3793
|
+
/** 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. */
|
|
3794
|
+
unusedPlanBalance?: {
|
|
3795
|
+
type: "expire";
|
|
3796
|
+
} | {
|
|
3797
|
+
type: "roll_over";
|
|
3798
|
+
/** The most plan balance a subscription holds after a reset, in USD cents, including the balance that reset grants; balance above it expires. At least the included balance of every price. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. null means no limit other than the largest storable amount, 2,147,483,647 cents. */
|
|
3799
|
+
maxPlanBalance: number | null;
|
|
3800
|
+
};
|
|
3801
|
+
/** Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; null removes the limit. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
|
|
3802
|
+
planBalanceLimit?: {
|
|
3803
|
+
/** The most plan balance a subscription spends in one window, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. */
|
|
3804
|
+
amount: number;
|
|
3805
|
+
/** The window length: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. */
|
|
3806
|
+
interval: "day" | "week";
|
|
3807
|
+
} | null;
|
|
3808
|
+
/** 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. */
|
|
3809
|
+
blockOnExhaustion?: boolean;
|
|
3076
3810
|
/** Make this plan the default plan of its plan group: customers created with that planGroupId start on it, and a paid plan of the group that ends from the customer portal, a revoked payment authorization or exhausted dunning moves to it instead of canceling. Requires a free plan in a plan group; replaces the group's previous default plan. false unmarks it. */
|
|
3077
3811
|
isDefault?: boolean;
|
|
3078
3812
|
}
|
|
3079
3813
|
interface DeletePlanParams {
|
|
3080
3814
|
id: string;
|
|
3081
3815
|
}
|
|
3816
|
+
interface ComparePlanVersionsParams {
|
|
3817
|
+
id: string;
|
|
3818
|
+
versionId: string;
|
|
3819
|
+
against: string;
|
|
3820
|
+
}
|
|
3821
|
+
interface GetPlanVersionParams {
|
|
3822
|
+
id: string;
|
|
3823
|
+
versionId: string;
|
|
3824
|
+
}
|
|
3825
|
+
interface ListPlanVersionsParams {
|
|
3826
|
+
id: string;
|
|
3827
|
+
cursor?: string;
|
|
3828
|
+
limit?: number;
|
|
3829
|
+
}
|
|
3830
|
+
interface CreatePlanVersionParams {
|
|
3831
|
+
id: string;
|
|
3832
|
+
prices?: Array<{
|
|
3833
|
+
/** An interval the plan already sells. Prices not listed are copied unchanged from the current version. */
|
|
3834
|
+
billingInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time";
|
|
3835
|
+
/** USD price in the currency's minor unit (cents). */
|
|
3836
|
+
price: number;
|
|
3837
|
+
includedCredits?: number | null;
|
|
3838
|
+
includedBalance?: number | null;
|
|
3839
|
+
/** Per-currency amounts. A currency the current version does not sell also needs its exchangeRate in currencies; its amounts not listed here are derived from the USD price. */
|
|
3840
|
+
regionalPrices?: Array<{
|
|
3841
|
+
currency: string;
|
|
3842
|
+
price: number;
|
|
3843
|
+
includedBalance?: number | null;
|
|
3844
|
+
}>;
|
|
3845
|
+
}>;
|
|
3846
|
+
/** Currencies the current version does not sell, with the exchange rate (local units per USD) used for the amounts not listed, credit purchases, add-ons and overage. */
|
|
3847
|
+
currencies?: Array<{
|
|
3848
|
+
currency: string;
|
|
3849
|
+
exchangeRate: number;
|
|
3850
|
+
}>;
|
|
3851
|
+
/** Credits plans that roll over unused credits: the most plan credits a subscription can hold. Null removes the cap. */
|
|
3852
|
+
maxPlanCredits?: number | null;
|
|
3853
|
+
/** Balance plans that roll over unused balance: the most plan balance a subscription can hold, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. Null removes the cap. */
|
|
3854
|
+
maxPlanBalance?: number | null;
|
|
3855
|
+
}
|
|
3082
3856
|
interface SetPlanVisibilityParams {
|
|
3083
3857
|
id: string;
|
|
3084
3858
|
isPublic: boolean;
|
|
@@ -3093,6 +3867,7 @@ interface CreatePlanParams {
|
|
|
3093
3867
|
consumptionModel?: "metered" | "credits" | "balance";
|
|
3094
3868
|
isPublic?: boolean;
|
|
3095
3869
|
isFree?: boolean;
|
|
3870
|
+
/** Credits and balance plans. Omitted, credits plans and free plans stop usage when the plan and purchased amounts run out, and paid balance plans bill the missing balance as overage. A new credits plan always stops usage: it allows overage only with a price per credit, which is set after creation, and then `PATCH /v1/plans/{id}` turns overage on. */
|
|
3096
3871
|
blockOnExhaustion?: boolean;
|
|
3097
3872
|
/** Credits plans only. What happens to unused plan credits at each reset; omitted means they expire. */
|
|
3098
3873
|
unusedPlanCredits?: {
|
|
@@ -3109,6 +3884,21 @@ interface CreatePlanParams {
|
|
|
3109
3884
|
/** The window length: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. */
|
|
3110
3885
|
interval: "day" | "week";
|
|
3111
3886
|
} | null;
|
|
3887
|
+
/** Balance plans only. What happens to unused plan balance at each reset; omitted means it expires. */
|
|
3888
|
+
unusedPlanBalance?: {
|
|
3889
|
+
type: "expire";
|
|
3890
|
+
} | {
|
|
3891
|
+
type: "roll_over";
|
|
3892
|
+
/** The most plan balance a subscription holds after a reset, in USD cents, including the balance that reset grants; balance above it expires. At least the included balance of every price. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. null means no limit other than the largest storable amount, 2,147,483,647 cents. */
|
|
3893
|
+
maxPlanBalance: number | null;
|
|
3894
|
+
};
|
|
3895
|
+
/** Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; omitted or null means no limit. */
|
|
3896
|
+
planBalanceLimit?: {
|
|
3897
|
+
/** The most plan balance a subscription spends in one window, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. */
|
|
3898
|
+
amount: number;
|
|
3899
|
+
/** The window length: `day` is 24 hours and `week` is 7 days, starting at the time of day of the subscription's billing anchor. */
|
|
3900
|
+
interval: "day" | "week";
|
|
3901
|
+
} | null;
|
|
3112
3902
|
planGroupId?: string;
|
|
3113
3903
|
/** Make this plan the default plan of its plan group: customers created with that planGroupId start on it, and a paid plan of the group that ends from the customer portal, a revoked payment authorization or exhausted dunning moves to it instead of canceling. Requires a free plan with a planGroupId; replaces the group's previous default plan. */
|
|
3114
3904
|
isDefault?: boolean;
|
|
@@ -3117,12 +3907,70 @@ interface CreatePlanParams {
|
|
|
3117
3907
|
declare class PlansResource {
|
|
3118
3908
|
private httpClient;
|
|
3119
3909
|
constructor(httpClient: CommetHTTPClient);
|
|
3910
|
+
/** Publish a draft as the plan's current version, as a new experiment with its own code, or as the next version of the experiment it started from. A country missing a price, or removing the signup trial of the plan's group from the current version, stops the publication. With move, subscribers of earlier versions move at their renewal or now; if any of them does not fit the new version, nothing is published and the response lists each one with what would make it fit, to send back in changes. Paused subscribers stay where they are. Send preview to check without publishing. */
|
|
3911
|
+
publishDraft(params: PublishPlanDraftParams, options?: RequestOptions): Promise<PlanDraftPublication>;
|
|
3912
|
+
/** Retrieve a draft with the version it started from and what it changes. */
|
|
3913
|
+
getDraft(params: GetPlanDraftParams, options?: RequestOptions): Promise<PlanDraft>;
|
|
3914
|
+
/** Change a draft's prices per interval, trials, the interval shown first, countries with their currency and prices, and credit or balance rules, or undo single changes. Each block sent replaces that block; blocks left out stay as they are. Buyers and subscribers see nothing until the draft is published. */
|
|
3915
|
+
updateDraft(params: UpdatePlanDraftParams, options?: RequestOptions): Promise<PlanDraft>;
|
|
3916
|
+
/** Discard a draft. Nothing it changed was ever sold. */
|
|
3917
|
+
deleteDraft(params: DeletePlanDraftParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
3918
|
+
/** List the plan's open drafts, oldest first, each with the version it started from and what it changes. Drafts sell nothing until published. */
|
|
3919
|
+
listDrafts(params: ListPlanDraftsParams, options?: RequestOptions): Promise<{
|
|
3920
|
+
object: "list";
|
|
3921
|
+
data: Array<PlanDraft>;
|
|
3922
|
+
hasMore: boolean;
|
|
3923
|
+
nextCursor?: string;
|
|
3924
|
+
}>;
|
|
3925
|
+
/** Start a draft from a version of the plan: the current one, an experiment's version or an older one. A plan can have any number of drafts. Edit it, then publish it as the current version, as an experiment or as an experiment's next version; nothing changes for buyers or subscribers until then. */
|
|
3926
|
+
createDraft(params: CreatePlanDraftParams, options?: RequestOptions): Promise<PlanDraft>;
|
|
3927
|
+
/** Stop selling the experiment. Its code sells the plan's current version from then on, so links already shared keep working. Choose what happens to its subscribers: keep them on its versions, or move them to the current version at their renewal or now. If any of them does not fit, nothing changes and the response lists each one with what would make it fit, to send back in changes. */
|
|
3928
|
+
archiveExperiment(params: ArchivePlanExperimentParams, options?: RequestOptions): Promise<PlanExperimentArchive>;
|
|
3929
|
+
/** Make the experiment's latest version the plan's current version, with exactly its content and the next version number. New buyers get it; its subscribers are already on it. The experiment closes, and its code sells the plan's current version from then on. Nobody else moves. */
|
|
3930
|
+
makeExperimentCurrent(params: MakePlanExperimentCurrentParams, options?: RequestOptions): Promise<PlanVersion>;
|
|
3931
|
+
/** Get one experiment of a plan by its own code, with the version it sells and how many subscriptions are on it. */
|
|
3932
|
+
getExperiment(params: GetPlanExperimentParams, options?: RequestOptions): Promise<PlanExperiment>;
|
|
3933
|
+
/** Publish the experiment's next version from its latest version with the changes given. Its code sells the new version from now on; subscribers on its earlier versions stay where they are until moved. */
|
|
3934
|
+
createExperimentVersion(params: CreatePlanExperimentVersionParams, options?: RequestOptions): Promise<PlanVersion>;
|
|
3935
|
+
/** List a plan's experiments, newest first, with the version each one sells and how many subscriptions are on them. */
|
|
3936
|
+
listExperiments(params: ListPlanExperimentsParams, options?: RequestOptions): Promise<{
|
|
3937
|
+
object: "list";
|
|
3938
|
+
data: Array<PlanExperiment>;
|
|
3939
|
+
hasMore: boolean;
|
|
3940
|
+
nextCursor?: string;
|
|
3941
|
+
}>;
|
|
3942
|
+
/** Start an experiment from the plan's current version with the changes given. It is sold only through its code (planCode `<plan code>:<code>`); new buyers of the plan keep getting the current version. */
|
|
3943
|
+
createExperiment(params: CreatePlanExperimentParams, options?: RequestOptions): Promise<PlanExperiment>;
|
|
3120
3944
|
/** Update limits, overage, or enabled status of a feature on a plan. */
|
|
3121
3945
|
updateFeature(params: UpdatePlanFeatureParams, options?: RequestOptions): Promise<PlanFeature>;
|
|
3122
3946
|
/** Detach a feature from a plan. */
|
|
3123
3947
|
removeFeature(params: RemovePlanFeatureParams, options?: RequestOptions): Promise<RemovedPlanFeature>;
|
|
3124
3948
|
/** Attach a feature to a plan with limits, overage, and credits configuration. */
|
|
3125
3949
|
addFeature(params: AddPlanFeatureParams, options?: RequestOptions): Promise<PlanFeature>;
|
|
3950
|
+
/** Cancel a move for every subscriber who has not moved yet. They stay on their version; those already moved stay moved. */
|
|
3951
|
+
cancelMove(params: CancelPlanMoveParams, options?: RequestOptions): Promise<PlanMove>;
|
|
3952
|
+
/** Read a move of subscribers between plan versions with each subscriber's status: moving, moved, needs a change, left out, canceled or kept on its version. */
|
|
3953
|
+
getMove(params: GetPlanMoveParams, options?: RequestOptions): Promise<PlanMove>;
|
|
3954
|
+
/** Cancel a move for one subscriber who has not moved yet. It stays on its version; the rest of the move continues. */
|
|
3955
|
+
cancelMoveSubscription(params: CancelPlanMoveSubscriptionParams, options?: RequestOptions): Promise<PlanMove>;
|
|
3956
|
+
/** List a plan's latest moves of subscribers between versions, newest first, including the change of a single subscription, with how many are moving, moved, need a change, were left out, canceled or kept on their version. */
|
|
3957
|
+
listMoves(params: ListPlanMovesParams, options?: RequestOptions): Promise<{
|
|
3958
|
+
object: "list";
|
|
3959
|
+
data: Array<PlanMove>;
|
|
3960
|
+
hasMore: boolean;
|
|
3961
|
+
nextCursor?: string;
|
|
3962
|
+
}>;
|
|
3963
|
+
/** Move a list of subscriptions, or every subscription of another version, to a newer version of the plan, at their next renewal or now. Nobody moves unless every one of them fits or has a change in changes; otherwise the response lists each one with what would make it fit. Only active, trialing and past due subscriptions move. Paused ones, and listed subscriptions in another status or already on the destination, are left out. Send preview to check without moving anyone. */
|
|
3964
|
+
createMove(params: CreatePlanMoveParams, options?: RequestOptions): Promise<PlanMove>;
|
|
3965
|
+
/** Leave a subscriber that needs a change on its version. It stops appearing among the subscribers that need a change; move it later like any other subscriber. */
|
|
3966
|
+
keepSubscriberOnVersion(params: KeepPlanSubscriberOnVersionParams, options?: RequestOptions): Promise<KeptOnVersion>;
|
|
3967
|
+
/** List the plan's subscribers whose move could not complete, with the version they stay on, the one they could not move to and why. Move them again with a change, or keep them on their version so they leave this list. */
|
|
3968
|
+
listSubscribersNeedingAChange(params: ListPlanSubscribersNeedingAChangeParams, options?: RequestOptions): Promise<{
|
|
3969
|
+
object: "list";
|
|
3970
|
+
data: Array<SubscriberNeedingAChange>;
|
|
3971
|
+
hasMore: boolean;
|
|
3972
|
+
nextCursor?: string;
|
|
3973
|
+
}>;
|
|
3126
3974
|
/** Set a specific price as the default and return the updated plan price. */
|
|
3127
3975
|
setDefaultPrice(params: SetDefaultPlanPriceParams, options?: RequestOptions): Promise<PlanPrice>;
|
|
3128
3976
|
/** Create or update regional currency price overrides for a plan price. */
|
|
@@ -3131,7 +3979,7 @@ declare class PlansResource {
|
|
|
3131
3979
|
deleteRegionalPrices(params: DeleteRegionalPricesParams, options?: RequestOptions): Promise<DeletedPlanRegionalPricing>;
|
|
3132
3980
|
/** Update a base price or market price variant. Removing a base market override is rejected while a variant depends on it. Offer terms are managed through Offers. */
|
|
3133
3981
|
updatePrice(params: UpdatePlanPriceParams, options?: RequestOptions): Promise<PlanPrice>;
|
|
3134
|
-
/** Archive a price for new subscriptions.
|
|
3982
|
+
/** Archive a price for new subscriptions. This publishes a new version of the plan; existing subscriptions that selected the price keep paying it on their version until moved. */
|
|
3135
3983
|
deletePrice(params: DeletePlanPriceParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
3136
3984
|
/** Add a base price or a selectable market price variant. Variants inherit their base price outside the markets they override. Configure introductory and promotional benefits through Offers. */
|
|
3137
3985
|
addPrice(params: AddPlanPriceParams, options?: RequestOptions): Promise<PlanPrice>;
|
|
@@ -3139,10 +3987,23 @@ declare class PlansResource {
|
|
|
3139
3987
|
setRegionalPricing(params: SetPlanRegionalPricingParams, options?: RequestOptions): Promise<PlanRegionalPricingResult>;
|
|
3140
3988
|
/** Get a plan with public price IDs and their automatic introductory offer IDs. */
|
|
3141
3989
|
get(params: GetPlanParams, options?: RequestOptions): Promise<Plan>;
|
|
3142
|
-
/** Update a plan's name, description, visibility, default status, metadata, what happens to its unused plan credits, or its plan credit limit. */
|
|
3990
|
+
/** Update a plan's name, description, visibility, default status, metadata, overage behavior, what happens to its unused plan credits or plan balance, or its plan credit or plan balance limit. */
|
|
3143
3991
|
update(params: UpdatePlanParams, options?: RequestOptions): Promise<Plan>;
|
|
3144
3992
|
/** Soft-delete a plan. */
|
|
3145
3993
|
delete(params: DeletePlanParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
3994
|
+
/** List what changes from one version of a plan to another: prices, trials, features, rules, add-ons, credit packs and countries. */
|
|
3995
|
+
compareVersions(params: ComparePlanVersionsParams, options?: RequestOptions): Promise<PlanVersionComparison>;
|
|
3996
|
+
/** Get one published version of a plan with its prices and how many subscriptions are on it. */
|
|
3997
|
+
getVersion(params: GetPlanVersionParams, options?: RequestOptions): Promise<PlanVersion>;
|
|
3998
|
+
/** List a plan's published versions, newest first, with their prices and how many subscriptions are on each. Versions published before Commet recorded every term are not listed. */
|
|
3999
|
+
listVersions(params: ListPlanVersionsParams, options?: RequestOptions): Promise<{
|
|
4000
|
+
object: "list";
|
|
4001
|
+
data: Array<PlanVersion>;
|
|
4002
|
+
hasMore: boolean;
|
|
4003
|
+
nextCursor?: string;
|
|
4004
|
+
}>;
|
|
4005
|
+
/** Publish a new current version of the plan from its current version, changing prices per interval, included credits or balance, per-currency amounts and the rollover cap. New buyers get it; every subscriber stays on its version until moved. To try changes without selling them to everyone, create an experiment instead. */
|
|
4006
|
+
createVersion(params: CreatePlanVersionParams, options?: RequestOptions): Promise<PlanVersion>;
|
|
3146
4007
|
/** Set a plan's public visibility and return the updated plan. */
|
|
3147
4008
|
setVisibility(params: SetPlanVisibilityParams, options?: RequestOptions): Promise<Plan>;
|
|
3148
4009
|
/** List plans with public price IDs and their automatic introductory offer IDs. */
|
|
@@ -3152,7 +4013,7 @@ declare class PlansResource {
|
|
|
3152
4013
|
hasMore: boolean;
|
|
3153
4014
|
nextCursor?: string;
|
|
3154
4015
|
}>;
|
|
3155
|
-
/** Create a new plan with optional consumption model, visibility, and plan
|
|
4016
|
+
/** Create a new plan with optional consumption model, visibility, plan group assignment, overage behavior, and the rollover and spend limit of its plan credits or plan balance. */
|
|
3156
4017
|
create(params: CreatePlanParams, options?: RequestOptions): Promise<Plan>;
|
|
3157
4018
|
}
|
|
3158
4019
|
|
|
@@ -3340,7 +4201,10 @@ interface UpdateSubscriptionAutoTopUpParams {
|
|
|
3340
4201
|
id: string;
|
|
3341
4202
|
enabled?: boolean;
|
|
3342
4203
|
threshold?: number;
|
|
4204
|
+
/** Credits each top-up buys. Credits plans only. */
|
|
3343
4205
|
quantity?: number;
|
|
4206
|
+
/** Minor units of the subscription currency each top-up adds. Balance plans only. */
|
|
4207
|
+
amount?: number;
|
|
3344
4208
|
maxPerPeriod?: number;
|
|
3345
4209
|
}
|
|
3346
4210
|
interface AdjustBalanceParams {
|
|
@@ -3351,6 +4215,7 @@ interface AdjustBalanceParams {
|
|
|
3351
4215
|
}
|
|
3352
4216
|
interface TopupBalanceParams {
|
|
3353
4217
|
id: string;
|
|
4218
|
+
/** The amount to add, in minor units of the subscription currency (cents; whole units for zero-decimal currencies). */
|
|
3354
4219
|
amount: number;
|
|
3355
4220
|
}
|
|
3356
4221
|
interface CancelSubscriptionParams {
|
|
@@ -3374,6 +4239,13 @@ type ChangePlanParams = {
|
|
|
3374
4239
|
/** Promo code whose Offer prices the change, validated with the checkout's rules: a code the checkout would refuse returns 400 validation_error with the checkout's reason in details.reason. Cannot be combined with offerId. */
|
|
3375
4240
|
promoCode: string;
|
|
3376
4241
|
};
|
|
4242
|
+
interface ChangeSubscriptionVersionParams {
|
|
4243
|
+
id: string;
|
|
4244
|
+
/** A published version of the subscription's plan. */
|
|
4245
|
+
planVersionId: string;
|
|
4246
|
+
/** now changes features, limits and the included credits or balance at once (the included difference is added to or subtracted from the plan credits or plan balance: an increase first pays any plan-part debt, a decrease never creates new debt, and purchased credits and purchased balance are untouched) and charges the new price from the next renewal. period_end changes everything at the next renewal. There is never a proration charge or refund. */
|
|
4247
|
+
effective: "now" | "period_end";
|
|
4248
|
+
}
|
|
3377
4249
|
type PurchaseCreditsParams = {
|
|
3378
4250
|
id: string;
|
|
3379
4251
|
creditPackId: string;
|
|
@@ -3445,6 +4317,9 @@ interface GetSubscriptionParams {
|
|
|
3445
4317
|
interface RevokeScheduledPlanChangeParams {
|
|
3446
4318
|
id: string;
|
|
3447
4319
|
}
|
|
4320
|
+
interface RevokeScheduledVersionChangeParams {
|
|
4321
|
+
id: string;
|
|
4322
|
+
}
|
|
3448
4323
|
interface UncancelSubscriptionParams {
|
|
3449
4324
|
id: string;
|
|
3450
4325
|
}
|
|
@@ -3454,6 +4329,7 @@ interface GetActiveSubscriptionParams {
|
|
|
3454
4329
|
interface ListSubscriptionsParams {
|
|
3455
4330
|
customerId?: string;
|
|
3456
4331
|
status?: SubscriptionStatus;
|
|
4332
|
+
planVersionId?: string;
|
|
3457
4333
|
}
|
|
3458
4334
|
type CreateSubscriptionParams = {
|
|
3459
4335
|
customerId: string;
|
|
@@ -3463,6 +4339,8 @@ type CreateSubscriptionParams = {
|
|
|
3463
4339
|
initialSeats?: Record<string, number>;
|
|
3464
4340
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
3465
4341
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4342
|
+
/** 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. */
|
|
4343
|
+
paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
|
|
3466
4344
|
name?: string;
|
|
3467
4345
|
/** @format date-time */
|
|
3468
4346
|
startDate?: string;
|
|
@@ -3471,6 +4349,8 @@ type CreateSubscriptionParams = {
|
|
|
3471
4349
|
prepaidPeriods?: number;
|
|
3472
4350
|
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
3473
4351
|
cancelAtPeriodEnd?: boolean;
|
|
4352
|
+
/** 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. */
|
|
4353
|
+
planVersionId?: string;
|
|
3474
4354
|
offerId?: never;
|
|
3475
4355
|
promoCode?: string;
|
|
3476
4356
|
/** 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. */
|
|
@@ -3485,6 +4365,8 @@ type CreateSubscriptionParams = {
|
|
|
3485
4365
|
initialSeats?: Record<string, number>;
|
|
3486
4366
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
3487
4367
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4368
|
+
/** 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. */
|
|
4369
|
+
paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
|
|
3488
4370
|
name?: string;
|
|
3489
4371
|
/** @format date-time */
|
|
3490
4372
|
startDate?: string;
|
|
@@ -3493,11 +4375,14 @@ type CreateSubscriptionParams = {
|
|
|
3493
4375
|
prepaidPeriods?: number;
|
|
3494
4376
|
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
3495
4377
|
cancelAtPeriodEnd?: boolean;
|
|
4378
|
+
/** 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. */
|
|
4379
|
+
planVersionId?: string;
|
|
3496
4380
|
offerId?: never;
|
|
3497
4381
|
promoCode?: string;
|
|
3498
4382
|
/** 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. */
|
|
3499
4383
|
customTrialDays?: number;
|
|
3500
4384
|
skipTrial?: boolean;
|
|
4385
|
+
/** The plan code, or an experiment code as `<plan code>:<experiment code>` to sell the version the experiment sells. */
|
|
3501
4386
|
planCode: string;
|
|
3502
4387
|
} | {
|
|
3503
4388
|
customerId: string;
|
|
@@ -3507,6 +4392,8 @@ type CreateSubscriptionParams = {
|
|
|
3507
4392
|
initialSeats?: Record<string, number>;
|
|
3508
4393
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
3509
4394
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4395
|
+
/** 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. */
|
|
4396
|
+
paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
|
|
3510
4397
|
name?: string;
|
|
3511
4398
|
/** @format date-time */
|
|
3512
4399
|
startDate?: string;
|
|
@@ -3515,6 +4402,8 @@ type CreateSubscriptionParams = {
|
|
|
3515
4402
|
prepaidPeriods?: number;
|
|
3516
4403
|
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
3517
4404
|
cancelAtPeriodEnd?: boolean;
|
|
4405
|
+
/** 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. */
|
|
4406
|
+
planVersionId?: string;
|
|
3518
4407
|
offerId: string;
|
|
3519
4408
|
promoCode?: never;
|
|
3520
4409
|
/** 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. */
|
|
@@ -3529,6 +4418,8 @@ type CreateSubscriptionParams = {
|
|
|
3529
4418
|
initialSeats?: Record<string, number>;
|
|
3530
4419
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
3531
4420
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4421
|
+
/** 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. */
|
|
4422
|
+
paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
|
|
3532
4423
|
name?: string;
|
|
3533
4424
|
/** @format date-time */
|
|
3534
4425
|
startDate?: string;
|
|
@@ -3537,11 +4428,14 @@ type CreateSubscriptionParams = {
|
|
|
3537
4428
|
prepaidPeriods?: number;
|
|
3538
4429
|
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
3539
4430
|
cancelAtPeriodEnd?: boolean;
|
|
4431
|
+
/** 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. */
|
|
4432
|
+
planVersionId?: string;
|
|
3540
4433
|
offerId: string;
|
|
3541
4434
|
promoCode?: never;
|
|
3542
4435
|
/** Trial length in days, replacing the price's trial. A customer who already had this plan, in a trial or paying, gets no trial and goes through the regular checkout. */
|
|
3543
4436
|
customTrialDays?: number;
|
|
3544
4437
|
skipTrial?: boolean;
|
|
4438
|
+
/** The plan code, or an experiment code as `<plan code>:<experiment code>` to sell the version the experiment sells. */
|
|
3545
4439
|
planCode: string;
|
|
3546
4440
|
} | {
|
|
3547
4441
|
customerId: string;
|
|
@@ -3551,6 +4445,8 @@ type CreateSubscriptionParams = {
|
|
|
3551
4445
|
initialSeats?: Record<string, number>;
|
|
3552
4446
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
3553
4447
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4448
|
+
/** 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. */
|
|
4449
|
+
paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
|
|
3554
4450
|
name?: string;
|
|
3555
4451
|
/** @format date-time */
|
|
3556
4452
|
startDate?: string;
|
|
@@ -3559,6 +4455,8 @@ type CreateSubscriptionParams = {
|
|
|
3559
4455
|
prepaidPeriods?: number;
|
|
3560
4456
|
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
3561
4457
|
cancelAtPeriodEnd?: boolean;
|
|
4458
|
+
/** 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. */
|
|
4459
|
+
planVersionId?: string;
|
|
3562
4460
|
offerId?: never;
|
|
3563
4461
|
/** Public card promotion ID. The offer is shown immediately and remains conditional on card eligibility until checkout confirmation. */
|
|
3564
4462
|
cardPromotionId: string;
|
|
@@ -3574,6 +4472,8 @@ type CreateSubscriptionParams = {
|
|
|
3574
4472
|
initialSeats?: Record<string, number>;
|
|
3575
4473
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
3576
4474
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4475
|
+
/** 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. */
|
|
4476
|
+
paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
|
|
3577
4477
|
name?: string;
|
|
3578
4478
|
/** @format date-time */
|
|
3579
4479
|
startDate?: string;
|
|
@@ -3582,12 +4482,15 @@ type CreateSubscriptionParams = {
|
|
|
3582
4482
|
prepaidPeriods?: number;
|
|
3583
4483
|
/** Schedules the cancellation from creation so the subscription ends after its last paid period and never renews with any payment method. */
|
|
3584
4484
|
cancelAtPeriodEnd?: boolean;
|
|
4485
|
+
/** 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. */
|
|
4486
|
+
planVersionId?: string;
|
|
3585
4487
|
offerId?: never;
|
|
3586
4488
|
/** Public card promotion ID. The offer is shown immediately and remains conditional on card eligibility until checkout confirmation. */
|
|
3587
4489
|
cardPromotionId: string;
|
|
3588
4490
|
promoCode?: never;
|
|
3589
4491
|
customTrialDays?: never;
|
|
3590
4492
|
skipTrial?: false;
|
|
4493
|
+
/** The plan code, or an experiment code as `<plan code>:<experiment code>` to sell the version the experiment sells. */
|
|
3591
4494
|
planCode: string;
|
|
3592
4495
|
};
|
|
3593
4496
|
declare class SubscriptionsResource {
|
|
@@ -3595,21 +4498,23 @@ declare class SubscriptionsResource {
|
|
|
3595
4498
|
constructor(httpClient: CommetHTTPClient);
|
|
3596
4499
|
/** Deactivate an add-on from a subscription. */
|
|
3597
4500
|
deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<DeletedSubscriptionAddon>;
|
|
3598
|
-
/** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
|
|
4501
|
+
/** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable. */
|
|
3599
4502
|
activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<SubscriptionAddon>;
|
|
3600
|
-
/** Read whether the subscription
|
|
4503
|
+
/** 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. */
|
|
3601
4504
|
getAutoTopUp(params: GetSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
3602
|
-
/** Turn automatic
|
|
4505
|
+
/** Turn automatic top-ups on or off and set the threshold, the size of each top-up and the maximum top-ups per period. Send only the fields that change. On a credits plan each top-up buys `quantity` credits; on a balance plan it adds `amount` in minor units of the subscription currency, plus tax, and `threshold` is in the same minor units. Enabling requires a plan that sells credits or has balance top-ups on. The size must be at least the plan's minimum when auto top-up is enabled or when the size changes, so turning it off keeps working after the minimum rises. Saving it enabled resumes a paused auto top-up. */
|
|
3603
4506
|
updateAutoTopUp(params: UpdateSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
3604
4507
|
/** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
|
|
3605
4508
|
adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<BalanceAdjustment>;
|
|
3606
|
-
/** Top up a subscription
|
|
4509
|
+
/** Top up a balance subscription. Charges the customer's payment method for the amount plus tax, adds it to the subscription's purchased balance (after paying back any overage owed on the plan balance), creates its invoice and emits `balance.topped_up`. Purchased balance is spent after the plan balance and is kept until the subscription ends. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge. */
|
|
3607
4510
|
topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<BalanceTopup>;
|
|
3608
4511
|
/** Cancel immediately or at period end and return the updated subscription. */
|
|
3609
4512
|
cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
3610
4513
|
/** 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. */
|
|
3611
4514
|
changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<PlanChange>;
|
|
3612
|
-
/**
|
|
4515
|
+
/** Move a subscription to a newer published version of its plan, now or at the end of the period, without proration; an older version is rejected with version_not_newer, and a subscription on a running experiment moves only to a later version of that experiment. The subscription keeps its currency and its price: a destination that does not sell its currency is rejected with missing_regional_price, and one that does not sell the price it pays with price_not_found. A free version moves only to a free version and a paid one only to a paid one (validation_error). A subscription whose usage does not fit the destination, or with an active add-on the destination does not sell, is not moved either, and the error says why. Each change is recorded as a move of this one subscription in the plan's moves. Repeating the same request changes nothing; a new one replaces the pending move. */
|
|
4516
|
+
changeVersion(params: ChangeSubscriptionVersionParams, options?: RequestOptions): Promise<Subscription>;
|
|
4517
|
+
/** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Charges the saved payment method and adds purchased credits. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
|
|
3613
4518
|
purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
|
|
3614
4519
|
/** 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. */
|
|
3615
4520
|
applyOffer(params: ApplySubscriptionOfferParams, options?: RequestOptions): Promise<Subscription>;
|
|
@@ -3637,6 +4542,8 @@ declare class SubscriptionsResource {
|
|
|
3637
4542
|
get(params: GetSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
3638
4543
|
/** Revoke the plan or interval change scheduled for the end of the period, so the subscription stays on its current plan. Returns the updated subscription. */
|
|
3639
4544
|
revokeScheduledPlanChange(params: RevokeScheduledPlanChangeParams, options?: RequestOptions): Promise<Subscription>;
|
|
4545
|
+
/** 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. */
|
|
4546
|
+
revokeScheduledVersionChange(params: RevokeScheduledVersionChangeParams, options?: RequestOptions): Promise<Subscription>;
|
|
3640
4547
|
/** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. */
|
|
3641
4548
|
uncancel(params: UncancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
3642
4549
|
/** Get the active subscription for a customer. Returns null if none. */
|
|
@@ -3786,7 +4693,7 @@ declare class GeneratedResources {
|
|
|
3786
4693
|
protected initResources(http: CommetHTTPClient): void;
|
|
3787
4694
|
}
|
|
3788
4695
|
|
|
3789
|
-
type WebhookEvent = "subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.pause_scheduled" | "subscription.pause_updated" | "subscription.pause_revoked" | "subscription.paused" | "subscription.resumed" | "subscription.resume_failed" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "plan_grant.created" | "plan_grant.updated" | "plan_grant.expired" | "plan_grant.revoked" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed";
|
|
4696
|
+
type WebhookEvent = "subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.pause_scheduled" | "subscription.pause_updated" | "subscription.pause_revoked" | "subscription.paused" | "subscription.resumed" | "subscription.resume_failed" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.version_changed" | "subscription.version_change_canceled" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "payment_method.detached" | "customer.created" | "customer.updated" | "customer.state_changed" | "plan_grant.created" | "plan_grant.updated" | "plan_grant.expired" | "plan_grant.revoked" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.granted" | "balance.topped_up" | "balance.low" | "balance.depleted" | "balance.expired" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed";
|
|
3790
4697
|
/** Fired when a subscription record is created, usually with status pending_payment: the first charge has not been confirmed yet — do NOT grant access here; wait for subscription.activated. A trial whose price requires no payment method is created already trialing, together with trial.started. */
|
|
3791
4698
|
interface SubscriptionCreatedData {
|
|
3792
4699
|
/** The subscription ID. */
|
|
@@ -4060,6 +4967,32 @@ interface SubscriptionPlanChangeRevokedData {
|
|
|
4060
4967
|
/** The previously scheduled billing interval, if the revoked change included one. */
|
|
4061
4968
|
revokedBillingInterval: string | null;
|
|
4062
4969
|
}
|
|
4970
|
+
/** Fired when a subscription moves to another version of its plan: a move applied now or a scheduled move that took effect at renewal. Making an experiment current moves nobody, so it sends none. The plan stays the same; the version's prices and features apply from now on. */
|
|
4971
|
+
interface SubscriptionVersionChangedData {
|
|
4972
|
+
/** The subscription ID. */
|
|
4973
|
+
subscriptionId: string;
|
|
4974
|
+
/** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
|
|
4975
|
+
customerId: string;
|
|
4976
|
+
/** The version the subscription left. */
|
|
4977
|
+
fromVersionId: string;
|
|
4978
|
+
/** The version the subscription is on now. */
|
|
4979
|
+
toVersionId: string;
|
|
4980
|
+
/** The currency the subscription pays in. */
|
|
4981
|
+
currency: string;
|
|
4982
|
+
/** The billing interval the subscription pays. */
|
|
4983
|
+
billingInterval: string;
|
|
4984
|
+
}
|
|
4985
|
+
/** Fired when a scheduled move to another plan version will no longer take effect because the subscription no longer fit the version at its renewal, or because the merchant revoked the scheduled version change or canceled the plan move. A new move that replaces it, a move made now, a plan change or an immediate cancellation sends none. The subscription stays on its version; reason says why. */
|
|
4986
|
+
interface SubscriptionVersionChangeCanceledData {
|
|
4987
|
+
/** The subscription ID. */
|
|
4988
|
+
subscriptionId: string;
|
|
4989
|
+
/** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
|
|
4990
|
+
customerId: string;
|
|
4991
|
+
/** The version the subscription was going to move to. */
|
|
4992
|
+
toVersionId: string;
|
|
4993
|
+
/** Why the move was canceled: canceled_by_merchant, version_change_failed when the move could not be applied at renewal, or the code of what the subscription no longer fits (addon_unavailable, seat_limit_exceeded, price_not_found, missing_regional_price). */
|
|
4994
|
+
reason: string;
|
|
4995
|
+
}
|
|
4063
4996
|
/** Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. past_due is a grace window, not a cutoff: usage and seats keep working while new purchases are blocked, and dunning retries the charge — use this to notify the customer and recover the payment. */
|
|
4064
4997
|
interface SubscriptionPastDueData {
|
|
4065
4998
|
/** The subscription ID. */
|
|
@@ -4578,6 +5511,17 @@ interface PaymentMethodUpdatedData {
|
|
|
4578
5511
|
/** Card display metadata for the new method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved. */
|
|
4579
5512
|
card: WebhookCardInfo | null;
|
|
4580
5513
|
}
|
|
5514
|
+
/** Fired when a saved payment method is removed from a customer: the customer unlinked it at the payment provider (for example, revoking a Mercado Pago authorization), or removed it through the customer portal. Removing a method never changes the customer's subscriptions; a renewal that finds no usable method follows the usual failed-payment recovery. */
|
|
5515
|
+
interface PaymentMethodDetachedData {
|
|
5516
|
+
/** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
|
|
5517
|
+
customerId: string;
|
|
5518
|
+
/** The payment method: card, oxxo, or mercado_pago. Null when unknown. */
|
|
5519
|
+
paymentMethod: PaymentMethod | null;
|
|
5520
|
+
/** Card display metadata of the removed method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved. */
|
|
5521
|
+
card: WebhookCardInfo | null;
|
|
5522
|
+
/** Why the method was removed: `unlinked_at_provider` when the customer revoked it at the payment provider, `removed_by_customer` when the customer removed it through the customer portal. */
|
|
5523
|
+
reason: "unlinked_at_provider" | "removed_by_customer";
|
|
5524
|
+
}
|
|
4581
5525
|
/** Fired when a customer is created, via the API (including batch create), SDK, or dashboard. The payload is the customer resource exactly as GET /customers returns it. */
|
|
4582
5526
|
interface CustomerCreatedData {
|
|
4583
5527
|
/** The Commet customer ID (cus_...). */
|
|
@@ -4592,6 +5536,15 @@ interface CustomerCreatedData {
|
|
|
4592
5536
|
taxDocument: string | null;
|
|
4593
5537
|
/** The local tax document type label inferred from the customer's country (e.g. CUIT, RFC, RUT), or null when no tax document was provided. */
|
|
4594
5538
|
documentType: string | null;
|
|
5539
|
+
/** The business tax ID saved for the customer (EU VAT number, Peruvian RUC), or null when the customer has none. */
|
|
5540
|
+
businessTaxId: {
|
|
5541
|
+
/** ISO-2 country the tax ID belongs to. */
|
|
5542
|
+
country: string;
|
|
5543
|
+
/** Tax ID type (e.g. eu_vat, pe_ruc). */
|
|
5544
|
+
type: string;
|
|
5545
|
+
/** The normalized tax ID. */
|
|
5546
|
+
value: string;
|
|
5547
|
+
} | null;
|
|
4595
5548
|
/** The customer's timezone. */
|
|
4596
5549
|
timezone: string | null;
|
|
4597
5550
|
/** Custom key-value metadata you attached to the customer. */
|
|
@@ -4615,6 +5568,15 @@ interface CustomerUpdatedData {
|
|
|
4615
5568
|
taxDocument: string | null;
|
|
4616
5569
|
/** The local tax document type label inferred from the customer's country (e.g. CUIT, RFC, RUT), or null when no tax document was provided. */
|
|
4617
5570
|
documentType: string | null;
|
|
5571
|
+
/** The business tax ID saved for the customer (EU VAT number, Peruvian RUC), or null when the customer has none. */
|
|
5572
|
+
businessTaxId: {
|
|
5573
|
+
/** ISO-2 country the tax ID belongs to. */
|
|
5574
|
+
country: string;
|
|
5575
|
+
/** Tax ID type (e.g. eu_vat, pe_ruc). */
|
|
5576
|
+
type: string;
|
|
5577
|
+
/** The normalized tax ID. */
|
|
5578
|
+
value: string;
|
|
5579
|
+
} | null;
|
|
4618
5580
|
/** The customer's timezone. */
|
|
4619
5581
|
timezone: string | null;
|
|
4620
5582
|
/** Custom key-value metadata you attached to the customer. */
|
|
@@ -4866,7 +5828,7 @@ interface CustomerStateChangedData {
|
|
|
4866
5828
|
seats: Array<WebhookSeatSummary>;
|
|
4867
5829
|
/** For credits plans: planCredits, purchasedCredits, totalCredits. Null otherwise. */
|
|
4868
5830
|
credits: WebhookCreditsBalance | null;
|
|
4869
|
-
/** For balance plans
|
|
5831
|
+
/** For balance plans, in rate scale (10000 = 1.00 of the subscription currency): currentBalance (the available total), planBalance, purchasedBalance and totalBalance. Null otherwise. */
|
|
4870
5832
|
balance: WebhookBalance | null;
|
|
4871
5833
|
}
|
|
4872
5834
|
/** Fired after a plan grant is durably created. The payload is the grant snapshot at creation. */
|
|
@@ -5079,7 +6041,7 @@ interface CreditsPurchasedData {
|
|
|
5079
6041
|
/** The number of credits purchased. */
|
|
5080
6042
|
credits: number;
|
|
5081
6043
|
}
|
|
5082
|
-
/** Fired when a subscription's
|
|
6044
|
+
/** Fired when a subscription's available credits (plan plus purchased) cross below 10% of their last refill: a period reset, a purchase or a manual adjustment. Emitted once per crossing, the same rule as balance.low. */
|
|
5083
6045
|
interface CreditsLowData {
|
|
5084
6046
|
/** The subscription ID. */
|
|
5085
6047
|
subscriptionId: string;
|
|
@@ -5087,12 +6049,12 @@ interface CreditsLowData {
|
|
|
5087
6049
|
customerId: string;
|
|
5088
6050
|
/** Total credits remaining (plan plus purchased). */
|
|
5089
6051
|
remainingCredits: number;
|
|
5090
|
-
/** The low-credit threshold that was crossed: 10% of the
|
|
6052
|
+
/** The low-credit threshold that was crossed: 10% of the last refill. */
|
|
5091
6053
|
thresholdCredits: number;
|
|
5092
|
-
/** The
|
|
6054
|
+
/** The credits added by the last refill: a period reset, a purchase or a manual adjustment. */
|
|
5093
6055
|
periodCredits: number;
|
|
5094
6056
|
}
|
|
5095
|
-
/** Fired
|
|
6057
|
+
/** Fired each time a subscription's available credits cross to zero or below. Usage that needs more credits than remain is rejected from this point, unless the plan allows overage, which is billed at its price per credit at the next renewal. Also fires customer.state_changed with trigger credits_depleted. */
|
|
5096
6058
|
interface CreditsDepletedData {
|
|
5097
6059
|
/** The subscription ID. */
|
|
5098
6060
|
subscriptionId: string;
|
|
@@ -5110,7 +6072,20 @@ interface CreditsExpiredData {
|
|
|
5110
6072
|
/** The plan credits that were discarded. */
|
|
5111
6073
|
expiredCredits: number;
|
|
5112
6074
|
}
|
|
5113
|
-
/** Fired when
|
|
6075
|
+
/** Fired when non-purchase balance is granted to a subscription: the plan balance at the start of each billing period, or a manual adjustment from the dashboard or the API, which goes to the purchased balance. Balance top-ups fire balance.topped_up instead. */
|
|
6076
|
+
interface BalanceGrantedData {
|
|
6077
|
+
/** The subscription ID. */
|
|
6078
|
+
subscriptionId: string;
|
|
6079
|
+
/** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
|
|
6080
|
+
customerId: string;
|
|
6081
|
+
/** The balance granted in rate scale (10000 = 1.00 of the subscription currency). */
|
|
6082
|
+
amount: number;
|
|
6083
|
+
/** The subscription currency. */
|
|
6084
|
+
currency: string;
|
|
6085
|
+
/** Why the balance was granted: period_reset or manual_adjustment. */
|
|
6086
|
+
reason: string;
|
|
6087
|
+
}
|
|
6088
|
+
/** Fired when a balance top-up succeeds: through the API, an automatic top-up or the customer portal. The amount goes to the purchased balance, which is spent after the plan balance and kept until the subscription ends. */
|
|
5114
6089
|
interface BalanceToppedUpData {
|
|
5115
6090
|
/** The subscription ID. */
|
|
5116
6091
|
subscriptionId: string;
|
|
@@ -5149,6 +6124,17 @@ interface BalanceDepletedData {
|
|
|
5149
6124
|
/** The subscription currency. */
|
|
5150
6125
|
currency: string;
|
|
5151
6126
|
}
|
|
6127
|
+
/** Fired at a reset when unused plan balance is discarded. On a plan whose unused plan balance expires, all of it expires at each reset. On a plan that rolls it over, a reset keeps it, up to the plan's maxPlanBalance when it has one, and only the excess expires. An overage debt invoiced at the renewal counts as nothing left over. Purchased balance never expires and is not affected. */
|
|
6128
|
+
interface BalanceExpiredData {
|
|
6129
|
+
/** The subscription ID. */
|
|
6130
|
+
subscriptionId: string;
|
|
6131
|
+
/** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
|
|
6132
|
+
customerId: string;
|
|
6133
|
+
/** The plan balance that was discarded, in rate scale (10000 = 1.00 of the subscription currency). */
|
|
6134
|
+
expiredAmount: number;
|
|
6135
|
+
/** The subscription currency. */
|
|
6136
|
+
currency: string;
|
|
6137
|
+
}
|
|
5152
6138
|
/** Fired when a metered feature's usage crosses 80% of its included quantity for the current period. Emitted once per feature per billing period, when the crossing happens. */
|
|
5153
6139
|
interface QuotaThresholdReachedData {
|
|
5154
6140
|
/** The subscription ID. */
|
|
@@ -5325,7 +6311,7 @@ interface WebhookEventEnvelope<E extends WebhookEvent, D> {
|
|
|
5325
6311
|
apiVersion: string;
|
|
5326
6312
|
data: D;
|
|
5327
6313
|
}
|
|
5328
|
-
type WebhookEventPayload = WebhookEventEnvelope<"subscription.created", SubscriptionCreatedData> | WebhookEventEnvelope<"subscription.activated", SubscriptionActivatedData> | WebhookEventEnvelope<"subscription.reactivated", SubscriptionReactivatedData> | WebhookEventEnvelope<"subscription.pause_scheduled", SubscriptionPauseScheduledData> | WebhookEventEnvelope<"subscription.pause_updated", SubscriptionPauseUpdatedData> | WebhookEventEnvelope<"subscription.pause_revoked", SubscriptionPauseRevokedData> | WebhookEventEnvelope<"subscription.paused", SubscriptionPausedData> | WebhookEventEnvelope<"subscription.resumed", SubscriptionResumedData> | WebhookEventEnvelope<"subscription.resume_failed", SubscriptionResumeFailedData> | WebhookEventEnvelope<"subscription.canceled", SubscriptionCanceledData> | WebhookEventEnvelope<"subscription.updated", SubscriptionUpdatedData> | WebhookEventEnvelope<"subscription.plan_changed", SubscriptionPlanChangedData> | WebhookEventEnvelope<"subscription.cancellation_scheduled", SubscriptionCancellationScheduledData> | WebhookEventEnvelope<"subscription.cancellation_revoked", SubscriptionCancellationRevokedData> | WebhookEventEnvelope<"subscription.plan_change_scheduled", SubscriptionPlanChangeScheduledData> | WebhookEventEnvelope<"subscription.plan_change_revoked", SubscriptionPlanChangeRevokedData> | WebhookEventEnvelope<"subscription.past_due", SubscriptionPastDueData> | WebhookEventEnvelope<"trial.started", TrialStartedData> | WebhookEventEnvelope<"trial.converted", TrialConvertedData> | WebhookEventEnvelope<"trial.expired", TrialExpiredData> | WebhookEventEnvelope<"trial.will_end", TrialWillEndData> | WebhookEventEnvelope<"trial.checkout_ready", TrialCheckoutReadyData> | WebhookEventEnvelope<"checkout.ready", CheckoutReadyData> | WebhookEventEnvelope<"payment.received", PaymentReceivedData> | WebhookEventEnvelope<"payment.failed", PaymentFailedData> | WebhookEventEnvelope<"payment.recovered", PaymentRecoveredData> | WebhookEventEnvelope<"payment.retry_failed", PaymentRetryFailedData> | WebhookEventEnvelope<"payment.refunded", PaymentRefundedData> | WebhookEventEnvelope<"payment.disputed", PaymentDisputedData> | WebhookEventEnvelope<"payment.dispute_resolved", PaymentDisputeResolvedData> | WebhookEventEnvelope<"payment_link.created", PaymentLinkCreatedData> | WebhookEventEnvelope<"payment_link.completed", PaymentLinkCompletedData> | WebhookEventEnvelope<"payment_link.failed", PaymentLinkFailedData> | WebhookEventEnvelope<"payment_link.canceled", PaymentLinkCanceledData> | WebhookEventEnvelope<"invoice.created", InvoiceCreatedData> | WebhookEventEnvelope<"invoice.voided", InvoiceVoidedData> | WebhookEventEnvelope<"invoice.overdue", InvoiceOverdueData> | WebhookEventEnvelope<"invoice.upcoming", InvoiceUpcomingData> | WebhookEventEnvelope<"payment_method.attached", PaymentMethodAttachedData> | WebhookEventEnvelope<"payment_method.updated", PaymentMethodUpdatedData> | WebhookEventEnvelope<"customer.created", CustomerCreatedData> | WebhookEventEnvelope<"customer.updated", CustomerUpdatedData> | WebhookEventEnvelope<"customer.state_changed", CustomerStateChangedData> | WebhookEventEnvelope<"plan_grant.created", PlanGrantCreatedData> | WebhookEventEnvelope<"plan_grant.updated", PlanGrantUpdatedData> | WebhookEventEnvelope<"plan_grant.expired", PlanGrantExpiredData> | WebhookEventEnvelope<"plan_grant.revoked", PlanGrantRevokedData> | WebhookEventEnvelope<"credits.granted", CreditsGrantedData> | WebhookEventEnvelope<"credits.purchased", CreditsPurchasedData> | WebhookEventEnvelope<"credits.low", CreditsLowData> | WebhookEventEnvelope<"credits.depleted", CreditsDepletedData> | WebhookEventEnvelope<"credits.expired", CreditsExpiredData> | WebhookEventEnvelope<"balance.topped_up", BalanceToppedUpData> | WebhookEventEnvelope<"balance.low", BalanceLowData> | WebhookEventEnvelope<"balance.depleted", BalanceDepletedData> | WebhookEventEnvelope<"quota.threshold_reached", QuotaThresholdReachedData> | WebhookEventEnvelope<"quota.exceeded", QuotaExceededData> | WebhookEventEnvelope<"seats.updated", SeatsUpdatedData> | WebhookEventEnvelope<"seats.limit_reached", SeatsLimitReachedData> | WebhookEventEnvelope<"addon.activated", AddonActivatedData> | WebhookEventEnvelope<"addon.deactivated", AddonDeactivatedData> | WebhookEventEnvelope<"usage.recorded", UsageRecordedData> | WebhookEventEnvelope<"payout.available", PayoutAvailableData> | WebhookEventEnvelope<"payout.created", PayoutCreatedData> | WebhookEventEnvelope<"payout.paid", PayoutPaidData> | WebhookEventEnvelope<"payout.failed", PayoutFailedData>;
|
|
6314
|
+
type WebhookEventPayload = WebhookEventEnvelope<"subscription.created", SubscriptionCreatedData> | WebhookEventEnvelope<"subscription.activated", SubscriptionActivatedData> | WebhookEventEnvelope<"subscription.reactivated", SubscriptionReactivatedData> | WebhookEventEnvelope<"subscription.pause_scheduled", SubscriptionPauseScheduledData> | WebhookEventEnvelope<"subscription.pause_updated", SubscriptionPauseUpdatedData> | WebhookEventEnvelope<"subscription.pause_revoked", SubscriptionPauseRevokedData> | WebhookEventEnvelope<"subscription.paused", SubscriptionPausedData> | WebhookEventEnvelope<"subscription.resumed", SubscriptionResumedData> | WebhookEventEnvelope<"subscription.resume_failed", SubscriptionResumeFailedData> | WebhookEventEnvelope<"subscription.canceled", SubscriptionCanceledData> | WebhookEventEnvelope<"subscription.updated", SubscriptionUpdatedData> | WebhookEventEnvelope<"subscription.plan_changed", SubscriptionPlanChangedData> | WebhookEventEnvelope<"subscription.cancellation_scheduled", SubscriptionCancellationScheduledData> | WebhookEventEnvelope<"subscription.cancellation_revoked", SubscriptionCancellationRevokedData> | WebhookEventEnvelope<"subscription.plan_change_scheduled", SubscriptionPlanChangeScheduledData> | WebhookEventEnvelope<"subscription.plan_change_revoked", SubscriptionPlanChangeRevokedData> | WebhookEventEnvelope<"subscription.version_changed", SubscriptionVersionChangedData> | WebhookEventEnvelope<"subscription.version_change_canceled", SubscriptionVersionChangeCanceledData> | WebhookEventEnvelope<"subscription.past_due", SubscriptionPastDueData> | WebhookEventEnvelope<"trial.started", TrialStartedData> | WebhookEventEnvelope<"trial.converted", TrialConvertedData> | WebhookEventEnvelope<"trial.expired", TrialExpiredData> | WebhookEventEnvelope<"trial.will_end", TrialWillEndData> | WebhookEventEnvelope<"trial.checkout_ready", TrialCheckoutReadyData> | WebhookEventEnvelope<"checkout.ready", CheckoutReadyData> | WebhookEventEnvelope<"payment.received", PaymentReceivedData> | WebhookEventEnvelope<"payment.failed", PaymentFailedData> | WebhookEventEnvelope<"payment.recovered", PaymentRecoveredData> | WebhookEventEnvelope<"payment.retry_failed", PaymentRetryFailedData> | WebhookEventEnvelope<"payment.refunded", PaymentRefundedData> | WebhookEventEnvelope<"payment.disputed", PaymentDisputedData> | WebhookEventEnvelope<"payment.dispute_resolved", PaymentDisputeResolvedData> | WebhookEventEnvelope<"payment_link.created", PaymentLinkCreatedData> | WebhookEventEnvelope<"payment_link.completed", PaymentLinkCompletedData> | WebhookEventEnvelope<"payment_link.failed", PaymentLinkFailedData> | WebhookEventEnvelope<"payment_link.canceled", PaymentLinkCanceledData> | WebhookEventEnvelope<"invoice.created", InvoiceCreatedData> | WebhookEventEnvelope<"invoice.voided", InvoiceVoidedData> | WebhookEventEnvelope<"invoice.overdue", InvoiceOverdueData> | WebhookEventEnvelope<"invoice.upcoming", InvoiceUpcomingData> | WebhookEventEnvelope<"payment_method.attached", PaymentMethodAttachedData> | WebhookEventEnvelope<"payment_method.updated", PaymentMethodUpdatedData> | WebhookEventEnvelope<"payment_method.detached", PaymentMethodDetachedData> | WebhookEventEnvelope<"customer.created", CustomerCreatedData> | WebhookEventEnvelope<"customer.updated", CustomerUpdatedData> | WebhookEventEnvelope<"customer.state_changed", CustomerStateChangedData> | WebhookEventEnvelope<"plan_grant.created", PlanGrantCreatedData> | WebhookEventEnvelope<"plan_grant.updated", PlanGrantUpdatedData> | WebhookEventEnvelope<"plan_grant.expired", PlanGrantExpiredData> | WebhookEventEnvelope<"plan_grant.revoked", PlanGrantRevokedData> | WebhookEventEnvelope<"credits.granted", CreditsGrantedData> | WebhookEventEnvelope<"credits.purchased", CreditsPurchasedData> | WebhookEventEnvelope<"credits.low", CreditsLowData> | WebhookEventEnvelope<"credits.depleted", CreditsDepletedData> | WebhookEventEnvelope<"credits.expired", CreditsExpiredData> | WebhookEventEnvelope<"balance.granted", BalanceGrantedData> | WebhookEventEnvelope<"balance.topped_up", BalanceToppedUpData> | WebhookEventEnvelope<"balance.low", BalanceLowData> | WebhookEventEnvelope<"balance.depleted", BalanceDepletedData> | WebhookEventEnvelope<"balance.expired", BalanceExpiredData> | WebhookEventEnvelope<"quota.threshold_reached", QuotaThresholdReachedData> | WebhookEventEnvelope<"quota.exceeded", QuotaExceededData> | WebhookEventEnvelope<"seats.updated", SeatsUpdatedData> | WebhookEventEnvelope<"seats.limit_reached", SeatsLimitReachedData> | WebhookEventEnvelope<"addon.activated", AddonActivatedData> | WebhookEventEnvelope<"addon.deactivated", AddonDeactivatedData> | WebhookEventEnvelope<"usage.recorded", UsageRecordedData> | WebhookEventEnvelope<"payout.available", PayoutAvailableData> | WebhookEventEnvelope<"payout.created", PayoutCreatedData> | WebhookEventEnvelope<"payout.paid", PayoutPaidData> | WebhookEventEnvelope<"payout.failed", PayoutFailedData>;
|
|
5329
6315
|
interface WebhookEventDataMap {
|
|
5330
6316
|
"subscription.created": SubscriptionCreatedData;
|
|
5331
6317
|
"subscription.activated": SubscriptionActivatedData;
|
|
@@ -5343,6 +6329,8 @@ interface WebhookEventDataMap {
|
|
|
5343
6329
|
"subscription.cancellation_revoked": SubscriptionCancellationRevokedData;
|
|
5344
6330
|
"subscription.plan_change_scheduled": SubscriptionPlanChangeScheduledData;
|
|
5345
6331
|
"subscription.plan_change_revoked": SubscriptionPlanChangeRevokedData;
|
|
6332
|
+
"subscription.version_changed": SubscriptionVersionChangedData;
|
|
6333
|
+
"subscription.version_change_canceled": SubscriptionVersionChangeCanceledData;
|
|
5346
6334
|
"subscription.past_due": SubscriptionPastDueData;
|
|
5347
6335
|
"trial.started": TrialStartedData;
|
|
5348
6336
|
"trial.converted": TrialConvertedData;
|
|
@@ -5367,6 +6355,7 @@ interface WebhookEventDataMap {
|
|
|
5367
6355
|
"invoice.upcoming": InvoiceUpcomingData;
|
|
5368
6356
|
"payment_method.attached": PaymentMethodAttachedData;
|
|
5369
6357
|
"payment_method.updated": PaymentMethodUpdatedData;
|
|
6358
|
+
"payment_method.detached": PaymentMethodDetachedData;
|
|
5370
6359
|
"customer.created": CustomerCreatedData;
|
|
5371
6360
|
"customer.updated": CustomerUpdatedData;
|
|
5372
6361
|
"customer.state_changed": CustomerStateChangedData;
|
|
@@ -5379,9 +6368,11 @@ interface WebhookEventDataMap {
|
|
|
5379
6368
|
"credits.low": CreditsLowData;
|
|
5380
6369
|
"credits.depleted": CreditsDepletedData;
|
|
5381
6370
|
"credits.expired": CreditsExpiredData;
|
|
6371
|
+
"balance.granted": BalanceGrantedData;
|
|
5382
6372
|
"balance.topped_up": BalanceToppedUpData;
|
|
5383
6373
|
"balance.low": BalanceLowData;
|
|
5384
6374
|
"balance.depleted": BalanceDepletedData;
|
|
6375
|
+
"balance.expired": BalanceExpiredData;
|
|
5385
6376
|
"quota.threshold_reached": QuotaThresholdReachedData;
|
|
5386
6377
|
"quota.exceeded": QuotaExceededData;
|
|
5387
6378
|
"seats.updated": SeatsUpdatedData;
|
|
@@ -5425,7 +6416,7 @@ interface GetWebhookEndpointParams {
|
|
|
5425
6416
|
interface UpdateWebhookEndpointParams {
|
|
5426
6417
|
id: string;
|
|
5427
6418
|
url?: string;
|
|
5428
|
-
events?: Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.pause_scheduled" | "subscription.pause_updated" | "subscription.pause_revoked" | "subscription.paused" | "subscription.resumed" | "subscription.resume_failed" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "plan_grant.created" | "plan_grant.updated" | "plan_grant.expired" | "plan_grant.revoked" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">;
|
|
6419
|
+
events?: Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.pause_scheduled" | "subscription.pause_updated" | "subscription.pause_revoked" | "subscription.paused" | "subscription.resumed" | "subscription.resume_failed" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.version_changed" | "subscription.version_change_canceled" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "payment_method.detached" | "customer.created" | "customer.updated" | "customer.state_changed" | "plan_grant.created" | "plan_grant.updated" | "plan_grant.expired" | "plan_grant.revoked" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.granted" | "balance.topped_up" | "balance.low" | "balance.depleted" | "balance.expired" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">;
|
|
5429
6420
|
description?: string | null;
|
|
5430
6421
|
isActive?: boolean;
|
|
5431
6422
|
apiVersion?: string;
|
|
@@ -5442,7 +6433,7 @@ interface ListWebhookEndpointsParams {
|
|
|
5442
6433
|
}
|
|
5443
6434
|
interface CreateWebhookEndpointParams {
|
|
5444
6435
|
url: string;
|
|
5445
|
-
events: Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.pause_scheduled" | "subscription.pause_updated" | "subscription.pause_revoked" | "subscription.paused" | "subscription.resumed" | "subscription.resume_failed" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "customer.created" | "customer.updated" | "customer.state_changed" | "plan_grant.created" | "plan_grant.updated" | "plan_grant.expired" | "plan_grant.revoked" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.topped_up" | "balance.low" | "balance.depleted" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">;
|
|
6436
|
+
events: Array<"subscription.created" | "subscription.activated" | "subscription.reactivated" | "subscription.pause_scheduled" | "subscription.pause_updated" | "subscription.pause_revoked" | "subscription.paused" | "subscription.resumed" | "subscription.resume_failed" | "subscription.canceled" | "subscription.updated" | "subscription.plan_changed" | "subscription.cancellation_scheduled" | "subscription.cancellation_revoked" | "subscription.plan_change_scheduled" | "subscription.plan_change_revoked" | "subscription.version_changed" | "subscription.version_change_canceled" | "subscription.past_due" | "trial.started" | "trial.converted" | "trial.expired" | "trial.will_end" | "trial.checkout_ready" | "checkout.ready" | "payment.received" | "payment.failed" | "payment.recovered" | "payment.retry_failed" | "payment.refunded" | "payment.disputed" | "payment.dispute_resolved" | "payment_link.created" | "payment_link.completed" | "payment_link.failed" | "payment_link.canceled" | "invoice.created" | "invoice.voided" | "invoice.overdue" | "invoice.upcoming" | "payment_method.attached" | "payment_method.updated" | "payment_method.detached" | "customer.created" | "customer.updated" | "customer.state_changed" | "plan_grant.created" | "plan_grant.updated" | "plan_grant.expired" | "plan_grant.revoked" | "credits.granted" | "credits.purchased" | "credits.low" | "credits.depleted" | "credits.expired" | "balance.granted" | "balance.topped_up" | "balance.low" | "balance.depleted" | "balance.expired" | "quota.threshold_reached" | "quota.exceeded" | "seats.updated" | "seats.limit_reached" | "addon.activated" | "addon.deactivated" | "usage.recorded" | "payout.available" | "payout.created" | "payout.paid" | "payout.failed">;
|
|
5446
6437
|
description?: string;
|
|
5447
6438
|
apiVersion?: string;
|
|
5448
6439
|
}
|
|
@@ -5480,4 +6471,4 @@ declare function registerIntegration(name: string, version: string): void;
|
|
|
5480
6471
|
declare const API_VERSION = "2026-08-27";
|
|
5481
6472
|
declare const SDK_VERSION: string;
|
|
5482
6473
|
|
|
5483
|
-
export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApplySubscriptionOfferParams, type BalanceAdjustment, type BalanceDepletedData, type BalanceLowData, type BalanceToppedUpData, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSetSeatsParams, type CancelPaymentParams, type CancelSubscriptionParams, type ChangePlanParams, type ChargePaymentParams, type CheckUsageAvailabilityParams, type CheckoutReadyData, type ClaimLink, Commet, CommetAPIError, type CommetClientOptions, CommetError, type CommetErrorContext, CommetValidationError, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerCreditParams, type CreateCustomerParams, type CreateFeatureParams, type CreateMarketParams, type CreateOfferParams, type CreatePaymentParams, type CreatePlanGrantParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePrepaidPeriodsCheckoutParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, type CreateWebhookEndpointParams, type CreatedApiKey, type CreatedSubscription, type CreatedWebhook, type CreditGrant, type CreditPack, type CreditPackListItem, type CreditsDepletedData, type CreditsExpiredData, type CreditsGrantedData, type CreditsLowData, type CreditsPurchasedData, type Customer, type CustomerBatch, type CustomerCreatedData, type CustomerCredit, type CustomerCreditRevocation, type CustomerStateChangedData, type CustomerUpdatedData, type DeactivateAddonParams, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeleteMarketParams, type DeleteOfferParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookEndpointParams, type DeletedObject, type DeletedOffer, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DownloadInvoiceParams, type Feature, type FeatureAccess, type FeatureDef, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetFeatureParams, type GetInvoiceParams, type GetMarketParams, type GetOfferParams, type GetPaymentParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionAutoTopUpParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookEndpointParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceCreatedData, type InvoiceDownload, type InvoiceListItem, type InvoiceOverdueData, type InvoiceType, type InvoiceUpcomingData, type InvoiceVoidedData, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomerCreditsParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListOffersParams, type ListPaymentsParams, type ListPlanGrantsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhookEndpointsParams, type ManagedBy, type Market, type Offer, type PauseSubscriptionParams, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethod, type PaymentMethodAttachedData, type PaymentMethodUpdateCheckout, type PaymentMethodUpdatedData, type PaymentProvider, type PaymentReceivedData, type PaymentRecoveredData, type PaymentRefundedData, type PaymentRetryFailedData, type Payout, type PayoutAvailableData, type PayoutBankAccount, type PayoutCreatedData, type PayoutFailedData, type PayoutPaidData, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGrant, type PlanGrantCreatedData, type PlanGrantExpiredData, type PlanGrantRevokedData, type PlanGrantUpdatedData, type PlanGroup, type PlanGroupDetail, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PortalAccess, type PrepaidPeriodsCheckout, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type QuotaExceededData, type QuotaThresholdReachedData, type ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, type Refund, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemoveSubscriptionOfferParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type ResumeSubscriptionParams, type RetryTransactionParams, type RevokeCustomerCreditParams, type RevokePlanGrantParams, type RevokeScheduledPlanChangeParams, type RevokeSubscriptionPauseParams, SDK_VERSION, type SeatBalance, type SeatBalanceCollection, type SeatEvent, type SeatsLimitReachedData, type SeatsUpdatedData, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type SetUsageParams, type SubPaymentMethod, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionAutoTopUp, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionOfferApplication, type SubscriptionOfferApplicationPhase, type SubscriptionPastDueData, type SubscriptionPauseRevokedData, type SubscriptionPauseScheduledData, type SubscriptionPauseUpdatedData, type SubscriptionPausedData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionResume, type SubscriptionResumeFailedData, type SubscriptionResumedData, type SubscriptionStatus, type SubscriptionSummary, type SubscriptionUpdatedData, type TestClock, type TestClockRun, type TestWebhookEndpointParams, type Timezone, type TopupBalanceParams, type TrackUsageParams, type Transaction, type TransactionListItem, type TransactionRetry, type TransactionStatus, type TrialCheckoutReadyData, type TrialConvertedData, type TrialExpiredData, type TrialStartedData, type TrialWillEndData, type UncancelSubscriptionParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdateMarketParams, type UpdateOfferParams, type UpdatePaymentMethodParams, type UpdatePlanFeatureParams, type UpdatePlanGrantParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateSubscriptionAutoTopUpParams, type UpdateSubscriptionPauseParams, type UpdateWebhookEndpointParams, type UpsertRegionalPricesParams, type UsageAdjustment, type UsageCheck, type UsageEvent, type UsageQuota, type UsageQuotaEvent, type UsageRecordedData, type Webhook, type WebhookAddonRef, type WebhookBalance, type WebhookBankRef, type WebhookCardInfo, type WebhookCreditsBalance, type WebhookData, type WebhookEvent, type WebhookEventDataMap, type WebhookEventEnvelope, type WebhookEventHandler, type WebhookEventPayload, type WebhookPayload, type WebhookPlanGrantTimelineEvent, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTest, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
|
|
6474
|
+
export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApplySubscriptionOfferParams, type ArchivePlanExperimentParams, type BalanceAdjustment, type BalanceDepletedData, type BalanceExpiredData, type BalanceGrantedData, type BalanceLowData, type BalanceToppedUpData, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSetSeatsParams, type BusinessTaxId, type CancelPaymentParams, type CancelPlanMoveParams, type CancelPlanMoveSubscriptionParams, type CancelSubscriptionParams, type ChangePlanParams, type ChangeSubscriptionVersionParams, type ChargePaymentParams, type CheckUsageAvailabilityParams, type CheckoutReadyData, type ClaimLink, Commet, CommetAPIError, type CommetClientOptions, CommetError, type CommetErrorContext, CommetValidationError, type ComparePlanVersionsParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerCreditParams, type CreateCustomerParams, type CreateFeatureParams, type CreateMarketParams, type CreateOfferParams, type CreatePaymentParams, type CreatePlanDraftParams, type CreatePlanExperimentParams, type CreatePlanExperimentVersionParams, type CreatePlanGrantParams, type CreatePlanGroupParams, type CreatePlanMoveParams, type CreatePlanParams, type CreatePlanVersionParams, type CreatePrepaidPeriodsCheckoutParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, type CreateWebhookEndpointParams, type CreatedApiKey, type CreatedSubscription, type CreatedWebhook, type CreditGrant, type CreditPack, type CreditPackListItem, type CreditsDepletedData, type CreditsExpiredData, type CreditsGrantedData, type CreditsLowData, type CreditsPurchasedData, type Customer, type CustomerBatch, type CustomerCreatedData, type CustomerCredit, type CustomerCreditRevocation, type CustomerStateChangedData, type CustomerUpdatedData, type DeactivateAddonParams, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeleteMarketParams, type DeleteOfferParams, type DeletePlanDraftParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookEndpointParams, type DeletedObject, type DeletedOffer, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DownloadInvoiceParams, type Feature, type FeatureAccess, type FeatureDef, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetFeatureParams, type GetInvoiceParams, type GetMarketParams, type GetOfferParams, type GetPaymentParams, type GetPlanDraftParams, type GetPlanExperimentParams, type GetPlanGroupParams, type GetPlanMoveParams, type GetPlanParams, type GetPlanVersionParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionAutoTopUpParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookEndpointParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceCreatedData, type InvoiceDownload, type InvoiceListItem, type InvoiceOverdueData, type InvoiceType, type InvoiceUpcomingData, type InvoiceVoidedData, type KeepPlanSubscriberOnVersionParams, type KeptOnVersion, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomerCreditsParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListOffersParams, type ListPaymentsParams, type ListPlanDraftsParams, type ListPlanExperimentsParams, type ListPlanGrantsParams, type ListPlanGroupsParams, type ListPlanMovesParams, type ListPlanSubscribersNeedingAChangeParams, type ListPlanVersionsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhookEndpointsParams, type MakePlanExperimentCurrentParams, type ManagedBy, type Market, type Offer, type PauseSubscriptionParams, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethod, type PaymentMethodAttachedData, type PaymentMethodDetachedData, type PaymentMethodUpdateCheckout, type PaymentMethodUpdatedData, type PaymentProvider, type PaymentReceivedData, type PaymentRecoveredData, type PaymentRefundedData, type PaymentRetryFailedData, type Payout, type PayoutAvailableData, type PayoutBankAccount, type PayoutCreatedData, type PayoutFailedData, type PayoutPaidData, type Plan, type PlanChange, type PlanDef, type PlanDraft, type PlanDraftPublication, type PlanExperiment, type PlanExperimentArchive, type PlanFeature, type PlanFeatureValue, type PlanGrant, type PlanGrantCreatedData, type PlanGrantExpiredData, type PlanGrantRevokedData, type PlanGrantUpdatedData, type PlanGroup, type PlanGroupDetail, type PlanMove, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PlanVersion, type PlanVersionComparison, type PortalAccess, type PrepaidPeriodsCheckout, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PublishPlanDraftParams, type PurchaseCreditsParams, type QuotaExceededData, type QuotaThresholdReachedData, type ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, type Refund, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemoveSubscriptionOfferParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type ResumeSubscriptionParams, type RetryTransactionParams, type RevokeCustomerCreditParams, type RevokePlanGrantParams, type RevokeScheduledPlanChangeParams, type RevokeScheduledVersionChangeParams, type RevokeSubscriptionPauseParams, SDK_VERSION, type SeatBalance, type SeatBalanceCollection, type SeatEvent, type SeatsLimitReachedData, type SeatsUpdatedData, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type SetUsageParams, type SubPaymentMethod, type SubscriberNeedingAChange, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionAutoTopUp, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionOfferApplication, type SubscriptionOfferApplicationPhase, type SubscriptionPastDueData, type SubscriptionPauseRevokedData, type SubscriptionPauseScheduledData, type SubscriptionPauseUpdatedData, type SubscriptionPausedData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionResume, type SubscriptionResumeFailedData, type SubscriptionResumedData, type SubscriptionStatus, type SubscriptionSummary, type SubscriptionUpdatedData, type SubscriptionVersionChangeCanceledData, type SubscriptionVersionChangedData, type TestClock, type TestClockRun, type TestWebhookEndpointParams, type Timezone, type TopupBalanceParams, type TrackUsageParams, type Transaction, type TransactionListItem, type TransactionRetry, type TransactionStatus, type TrialCheckoutReadyData, type TrialConvertedData, type TrialExpiredData, type TrialStartedData, type TrialWillEndData, type UncancelSubscriptionParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdateMarketParams, type UpdateOfferParams, type UpdatePaymentMethodParams, type UpdatePlanDraftParams, type UpdatePlanFeatureParams, type UpdatePlanGrantParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateSubscriptionAutoTopUpParams, type UpdateSubscriptionPauseParams, type UpdateWebhookEndpointParams, type UpsertRegionalPricesParams, type UsageAdjustment, type UsageCheck, type UsageEvent, type UsageQuota, type UsageQuotaEvent, type UsageRecordedData, type Webhook, type WebhookAddonRef, type WebhookBalance, type WebhookBankRef, type WebhookCardInfo, type WebhookCreditsBalance, type WebhookData, type WebhookEvent, type WebhookEventDataMap, type WebhookEventEnvelope, type WebhookEventHandler, type WebhookEventPayload, type WebhookPayload, type WebhookPlanGrantTimelineEvent, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTest, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
|