@commet/node 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/dist/index.d.mts +185 -99
- package/dist/index.d.ts +185 -99
- package/dist/index.js +43 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,6 +97,50 @@ const portal = await commet.portal.getUrl({
|
|
|
97
97
|
});
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
## Offers and selectable pricing
|
|
101
|
+
|
|
102
|
+
Create reusable country Markets and attach market prices to a base price or an inherited selectable variant:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const argentina = await commet.markets.create({
|
|
106
|
+
name: 'Argentina',
|
|
107
|
+
countryCodes: ['AR'],
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const variant = await commet.plans.addPrice({
|
|
111
|
+
id: 'pln_pro',
|
|
112
|
+
billingInterval: 'monthly',
|
|
113
|
+
inheritsFromPriceId: 'pp_monthly',
|
|
114
|
+
marketPrices: [{
|
|
115
|
+
marketGroupId: argentina.id,
|
|
116
|
+
currency: 'ars',
|
|
117
|
+
price: 1_500_000,
|
|
118
|
+
}],
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
await commet.subscriptions.create({
|
|
122
|
+
customerId: 'cus_123',
|
|
123
|
+
planId: 'pln_pro',
|
|
124
|
+
priceId: variant.id,
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Offers own discount phases. Promo Codes reference compatible Offers instead of duplicating discount fields:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
const offer = await commet.offers.create({
|
|
132
|
+
name: 'First three months at 25% off',
|
|
133
|
+
phases: [{ type: 'percentage', percentage: 2500, durationCycles: 3 }],
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
await commet.promoCodes.create({
|
|
137
|
+
code: 'LAUNCH25',
|
|
138
|
+
offerId: offer.id,
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Omitting `priceId` preserves default price resolution and still applies Currency Pricing and Markets. A subscription keeps the selected price identity and renews from that catalog price's current value.
|
|
143
|
+
|
|
100
144
|
## Type Safety
|
|
101
145
|
|
|
102
146
|
Use the [Commet CLI](https://www.npmjs.com/package/commet) to generate TypeScript types from your organization:
|
package/dist/index.d.mts
CHANGED
|
@@ -240,12 +240,6 @@ interface CreatedSubscription {
|
|
|
240
240
|
/** @format date-time */
|
|
241
241
|
scheduledFor: string;
|
|
242
242
|
} | null;
|
|
243
|
-
discount: {
|
|
244
|
-
type: "percentage" | "amount";
|
|
245
|
-
value: number;
|
|
246
|
-
name: string | null;
|
|
247
|
-
endsAt: string | null;
|
|
248
|
-
} | null;
|
|
249
243
|
/** @format date-time */
|
|
250
244
|
startDate: string;
|
|
251
245
|
endDate: string | null;
|
|
@@ -256,6 +250,7 @@ interface CreatedSubscription {
|
|
|
256
250
|
createdAt: string;
|
|
257
251
|
/** @format date-time */
|
|
258
252
|
updatedAt: string;
|
|
253
|
+
offerApplications: Array<SubscriptionOfferApplication>;
|
|
259
254
|
/** Payment provider resolved for this checkout when the subscription response was created. This is an informational snapshot and may differ when the checkout is loaded if its country or the organization's routing changes. */
|
|
260
255
|
checkoutProvider: PaymentProvider | null;
|
|
261
256
|
priceId: string | null;
|
|
@@ -701,7 +696,7 @@ interface InvoiceListItem {
|
|
|
701
696
|
object: "invoice";
|
|
702
697
|
livemode: boolean;
|
|
703
698
|
}
|
|
704
|
-
interface
|
|
699
|
+
interface Market {
|
|
705
700
|
id: string;
|
|
706
701
|
name: string;
|
|
707
702
|
countryCodes: Array<string>;
|
|
@@ -710,25 +705,23 @@ interface MarketGroup {
|
|
|
710
705
|
createdAt: string;
|
|
711
706
|
/** @format date-time */
|
|
712
707
|
updatedAt: string;
|
|
713
|
-
object: "
|
|
708
|
+
object: "market";
|
|
714
709
|
livemode: boolean;
|
|
715
710
|
}
|
|
716
711
|
interface Offer {
|
|
717
712
|
id: string;
|
|
718
713
|
name: string;
|
|
719
|
-
purpose: "introductory" | "promotional";
|
|
720
|
-
planPriceIds: Array<string>;
|
|
721
714
|
phases: Array<{
|
|
722
715
|
type: "free_trial";
|
|
723
716
|
durationDays: number;
|
|
724
717
|
} | {
|
|
725
718
|
type: "percentage";
|
|
726
|
-
durationCycles: number;
|
|
719
|
+
durationCycles: number | null;
|
|
727
720
|
/** Discount in basis points. 5000 means 50%. */
|
|
728
721
|
percentage: number;
|
|
729
722
|
} | {
|
|
730
723
|
type: "amount_off";
|
|
731
|
-
durationCycles: number;
|
|
724
|
+
durationCycles: number | null;
|
|
732
725
|
amounts: Array<{
|
|
733
726
|
currency: string;
|
|
734
727
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
@@ -736,7 +729,7 @@ interface Offer {
|
|
|
736
729
|
}>;
|
|
737
730
|
} | {
|
|
738
731
|
type: "fixed_price";
|
|
739
|
-
durationCycles: number;
|
|
732
|
+
durationCycles: number | null;
|
|
740
733
|
prices: Array<{
|
|
741
734
|
currency: string;
|
|
742
735
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
@@ -918,27 +911,42 @@ type PlanChange = {
|
|
|
918
911
|
/** Total in the currency's minor unit. */
|
|
919
912
|
total: number;
|
|
920
913
|
phases: Array<{
|
|
914
|
+
type: "free_trial";
|
|
915
|
+
durationDays: number;
|
|
916
|
+
startsAt: string | null;
|
|
917
|
+
endsAt: string | null;
|
|
918
|
+
} | {
|
|
921
919
|
type: "percentage";
|
|
922
|
-
durationCycles: number;
|
|
920
|
+
durationCycles: number | null;
|
|
923
921
|
startsAt: string | null;
|
|
924
922
|
endsAt: string | null;
|
|
925
923
|
/** Discount in basis points. 5000 means 50%. */
|
|
926
924
|
percentage: number;
|
|
927
925
|
} | {
|
|
928
926
|
type: "amount_off";
|
|
929
|
-
durationCycles: number;
|
|
927
|
+
durationCycles: number | null;
|
|
930
928
|
startsAt: string | null;
|
|
931
929
|
endsAt: string | null;
|
|
932
930
|
/** Discount in the application currency's minor unit. */
|
|
933
931
|
amount: number;
|
|
934
932
|
} | {
|
|
935
933
|
type: "fixed_price";
|
|
936
|
-
durationCycles: number;
|
|
934
|
+
durationCycles: number | null;
|
|
937
935
|
startsAt: string | null;
|
|
938
936
|
endsAt: string | null;
|
|
939
937
|
/** Fixed price in the application currency's minor unit. */
|
|
940
938
|
price: number;
|
|
941
939
|
}>;
|
|
940
|
+
appliesTo: {
|
|
941
|
+
type: "plan_price";
|
|
942
|
+
id: string;
|
|
943
|
+
} | {
|
|
944
|
+
type: "addon";
|
|
945
|
+
id: string;
|
|
946
|
+
} | {
|
|
947
|
+
type: "credit_pack";
|
|
948
|
+
id: string;
|
|
949
|
+
};
|
|
942
950
|
};
|
|
943
951
|
object: "plan_change";
|
|
944
952
|
livemode: boolean;
|
|
@@ -1001,27 +1009,42 @@ type PlanChange = {
|
|
|
1001
1009
|
/** Total in the currency's minor unit. */
|
|
1002
1010
|
total: number;
|
|
1003
1011
|
phases: Array<{
|
|
1012
|
+
type: "free_trial";
|
|
1013
|
+
durationDays: number;
|
|
1014
|
+
startsAt: string | null;
|
|
1015
|
+
endsAt: string | null;
|
|
1016
|
+
} | {
|
|
1004
1017
|
type: "percentage";
|
|
1005
|
-
durationCycles: number;
|
|
1018
|
+
durationCycles: number | null;
|
|
1006
1019
|
startsAt: string | null;
|
|
1007
1020
|
endsAt: string | null;
|
|
1008
1021
|
/** Discount in basis points. 5000 means 50%. */
|
|
1009
1022
|
percentage: number;
|
|
1010
1023
|
} | {
|
|
1011
1024
|
type: "amount_off";
|
|
1012
|
-
durationCycles: number;
|
|
1025
|
+
durationCycles: number | null;
|
|
1013
1026
|
startsAt: string | null;
|
|
1014
1027
|
endsAt: string | null;
|
|
1015
1028
|
/** Discount in the application currency's minor unit. */
|
|
1016
1029
|
amount: number;
|
|
1017
1030
|
} | {
|
|
1018
1031
|
type: "fixed_price";
|
|
1019
|
-
durationCycles: number;
|
|
1032
|
+
durationCycles: number | null;
|
|
1020
1033
|
startsAt: string | null;
|
|
1021
1034
|
endsAt: string | null;
|
|
1022
1035
|
/** Fixed price in the application currency's minor unit. */
|
|
1023
1036
|
price: number;
|
|
1024
1037
|
}>;
|
|
1038
|
+
appliesTo: {
|
|
1039
|
+
type: "plan_price";
|
|
1040
|
+
id: string;
|
|
1041
|
+
} | {
|
|
1042
|
+
type: "addon";
|
|
1043
|
+
id: string;
|
|
1044
|
+
} | {
|
|
1045
|
+
type: "credit_pack";
|
|
1046
|
+
id: string;
|
|
1047
|
+
};
|
|
1025
1048
|
};
|
|
1026
1049
|
object: "plan_change";
|
|
1027
1050
|
livemode: boolean;
|
|
@@ -1150,27 +1173,42 @@ interface PreviewChange {
|
|
|
1150
1173
|
/** Total in the currency's minor unit. */
|
|
1151
1174
|
total: number;
|
|
1152
1175
|
phases: Array<{
|
|
1176
|
+
type: "free_trial";
|
|
1177
|
+
durationDays: number;
|
|
1178
|
+
startsAt: string | null;
|
|
1179
|
+
endsAt: string | null;
|
|
1180
|
+
} | {
|
|
1153
1181
|
type: "percentage";
|
|
1154
|
-
durationCycles: number;
|
|
1182
|
+
durationCycles: number | null;
|
|
1155
1183
|
startsAt: string | null;
|
|
1156
1184
|
endsAt: string | null;
|
|
1157
1185
|
/** Discount in basis points. 5000 means 50%. */
|
|
1158
1186
|
percentage: number;
|
|
1159
1187
|
} | {
|
|
1160
1188
|
type: "amount_off";
|
|
1161
|
-
durationCycles: number;
|
|
1189
|
+
durationCycles: number | null;
|
|
1162
1190
|
startsAt: string | null;
|
|
1163
1191
|
endsAt: string | null;
|
|
1164
1192
|
/** Discount in the application currency's minor unit. */
|
|
1165
1193
|
amount: number;
|
|
1166
1194
|
} | {
|
|
1167
1195
|
type: "fixed_price";
|
|
1168
|
-
durationCycles: number;
|
|
1196
|
+
durationCycles: number | null;
|
|
1169
1197
|
startsAt: string | null;
|
|
1170
1198
|
endsAt: string | null;
|
|
1171
1199
|
/** Fixed price in the application currency's minor unit. */
|
|
1172
1200
|
price: number;
|
|
1173
1201
|
}>;
|
|
1202
|
+
appliesTo: {
|
|
1203
|
+
type: "plan_price";
|
|
1204
|
+
id: string;
|
|
1205
|
+
} | {
|
|
1206
|
+
type: "addon";
|
|
1207
|
+
id: string;
|
|
1208
|
+
} | {
|
|
1209
|
+
type: "credit_pack";
|
|
1210
|
+
id: string;
|
|
1211
|
+
};
|
|
1174
1212
|
};
|
|
1175
1213
|
object: "plan_change_preview";
|
|
1176
1214
|
livemode: boolean;
|
|
@@ -1207,27 +1245,42 @@ interface ReactivatedSubscription {
|
|
|
1207
1245
|
/** Total in the currency's minor unit. */
|
|
1208
1246
|
total: number;
|
|
1209
1247
|
phases: Array<{
|
|
1248
|
+
type: "free_trial";
|
|
1249
|
+
durationDays: number;
|
|
1250
|
+
startsAt: string | null;
|
|
1251
|
+
endsAt: string | null;
|
|
1252
|
+
} | {
|
|
1210
1253
|
type: "percentage";
|
|
1211
|
-
durationCycles: number;
|
|
1254
|
+
durationCycles: number | null;
|
|
1212
1255
|
startsAt: string | null;
|
|
1213
1256
|
endsAt: string | null;
|
|
1214
1257
|
/** Discount in basis points. 5000 means 50%. */
|
|
1215
1258
|
percentage: number;
|
|
1216
1259
|
} | {
|
|
1217
1260
|
type: "amount_off";
|
|
1218
|
-
durationCycles: number;
|
|
1261
|
+
durationCycles: number | null;
|
|
1219
1262
|
startsAt: string | null;
|
|
1220
1263
|
endsAt: string | null;
|
|
1221
1264
|
/** Discount in the application currency's minor unit. */
|
|
1222
1265
|
amount: number;
|
|
1223
1266
|
} | {
|
|
1224
1267
|
type: "fixed_price";
|
|
1225
|
-
durationCycles: number;
|
|
1268
|
+
durationCycles: number | null;
|
|
1226
1269
|
startsAt: string | null;
|
|
1227
1270
|
endsAt: string | null;
|
|
1228
1271
|
/** Fixed price in the application currency's minor unit. */
|
|
1229
1272
|
price: number;
|
|
1230
1273
|
}>;
|
|
1274
|
+
appliesTo: {
|
|
1275
|
+
type: "plan_price";
|
|
1276
|
+
id: string;
|
|
1277
|
+
} | {
|
|
1278
|
+
type: "addon";
|
|
1279
|
+
id: string;
|
|
1280
|
+
} | {
|
|
1281
|
+
type: "credit_pack";
|
|
1282
|
+
id: string;
|
|
1283
|
+
};
|
|
1231
1284
|
};
|
|
1232
1285
|
object: "subscription_reactivation";
|
|
1233
1286
|
livemode: boolean;
|
|
@@ -1338,12 +1391,6 @@ interface Subscription {
|
|
|
1338
1391
|
/** @format date-time */
|
|
1339
1392
|
scheduledFor: string;
|
|
1340
1393
|
} | null;
|
|
1341
|
-
discount: {
|
|
1342
|
-
type: "percentage" | "amount";
|
|
1343
|
-
value: number;
|
|
1344
|
-
name: string | null;
|
|
1345
|
-
endsAt: string | null;
|
|
1346
|
-
} | null;
|
|
1347
1394
|
/** @format date-time */
|
|
1348
1395
|
startDate: string;
|
|
1349
1396
|
endDate: string | null;
|
|
@@ -1354,6 +1401,7 @@ interface Subscription {
|
|
|
1354
1401
|
createdAt: string;
|
|
1355
1402
|
/** @format date-time */
|
|
1356
1403
|
updatedAt: string;
|
|
1404
|
+
offerApplications: Array<SubscriptionOfferApplication>;
|
|
1357
1405
|
consumptionModel: ConsumptionModel | null;
|
|
1358
1406
|
features: Array<{
|
|
1359
1407
|
code: string;
|
|
@@ -1406,6 +1454,55 @@ interface SubscriptionAddon {
|
|
|
1406
1454
|
object: "subscription_addon";
|
|
1407
1455
|
livemode: boolean;
|
|
1408
1456
|
}
|
|
1457
|
+
interface SubscriptionOfferApplication {
|
|
1458
|
+
id: string;
|
|
1459
|
+
name: string;
|
|
1460
|
+
appliesTo: {
|
|
1461
|
+
type: "plan_price";
|
|
1462
|
+
id: string;
|
|
1463
|
+
} | {
|
|
1464
|
+
type: "addon";
|
|
1465
|
+
id: string;
|
|
1466
|
+
} | {
|
|
1467
|
+
type: "credit_pack";
|
|
1468
|
+
id: string;
|
|
1469
|
+
};
|
|
1470
|
+
offerId: string | null;
|
|
1471
|
+
source: "direct" | "introductory" | "promo_code" | "custom";
|
|
1472
|
+
status: "quoted" | "applied" | "failed" | "expired";
|
|
1473
|
+
currency: string | null;
|
|
1474
|
+
subtotal: number | null;
|
|
1475
|
+
discountAmount: number | null;
|
|
1476
|
+
total: number | null;
|
|
1477
|
+
phases: Array<SubscriptionOfferApplicationPhase>;
|
|
1478
|
+
/** @format date-time */
|
|
1479
|
+
quotedAt: string;
|
|
1480
|
+
appliedAt: string | null;
|
|
1481
|
+
}
|
|
1482
|
+
type SubscriptionOfferApplicationPhase = {
|
|
1483
|
+
type: "free_trial";
|
|
1484
|
+
durationDays: number;
|
|
1485
|
+
startsAt: string | null;
|
|
1486
|
+
endsAt: string | null;
|
|
1487
|
+
} | {
|
|
1488
|
+
type: "percentage";
|
|
1489
|
+
durationCycles: number | null;
|
|
1490
|
+
percentage: number;
|
|
1491
|
+
startsAt: string | null;
|
|
1492
|
+
endsAt: string | null;
|
|
1493
|
+
} | {
|
|
1494
|
+
type: "amount_off";
|
|
1495
|
+
durationCycles: number | null;
|
|
1496
|
+
amount: number;
|
|
1497
|
+
startsAt: string | null;
|
|
1498
|
+
endsAt: string | null;
|
|
1499
|
+
} | {
|
|
1500
|
+
type: "fixed_price";
|
|
1501
|
+
durationCycles: number | null;
|
|
1502
|
+
price: number;
|
|
1503
|
+
startsAt: string | null;
|
|
1504
|
+
endsAt: string | null;
|
|
1505
|
+
};
|
|
1409
1506
|
interface SubscriptionSummary {
|
|
1410
1507
|
id: string;
|
|
1411
1508
|
customerId: string;
|
|
@@ -1441,12 +1538,6 @@ interface SubscriptionSummary {
|
|
|
1441
1538
|
/** @format date-time */
|
|
1442
1539
|
scheduledFor: string;
|
|
1443
1540
|
} | null;
|
|
1444
|
-
discount: {
|
|
1445
|
-
type: "percentage" | "amount";
|
|
1446
|
-
value: number;
|
|
1447
|
-
name: string | null;
|
|
1448
|
-
endsAt: string | null;
|
|
1449
|
-
} | null;
|
|
1450
1541
|
/** @format date-time */
|
|
1451
1542
|
startDate: string;
|
|
1452
1543
|
endDate: string | null;
|
|
@@ -1457,6 +1548,7 @@ interface SubscriptionSummary {
|
|
|
1457
1548
|
createdAt: string;
|
|
1458
1549
|
/** @format date-time */
|
|
1459
1550
|
updatedAt: string;
|
|
1551
|
+
offerApplications: Array<SubscriptionOfferApplication>;
|
|
1460
1552
|
priceId: string | null;
|
|
1461
1553
|
object: "subscription";
|
|
1462
1554
|
livemode: boolean;
|
|
@@ -2062,25 +2154,60 @@ declare class InvoicesResource {
|
|
|
2062
2154
|
createAdjustment(params: CreateAdjustmentInvoiceParams, options?: RequestOptions): Promise<Invoice>;
|
|
2063
2155
|
}
|
|
2064
2156
|
|
|
2157
|
+
interface GetMarketParams {
|
|
2158
|
+
id: string;
|
|
2159
|
+
}
|
|
2160
|
+
interface UpdateMarketParams {
|
|
2161
|
+
id: string;
|
|
2162
|
+
name: string;
|
|
2163
|
+
countryCodes: Array<string>;
|
|
2164
|
+
metadata?: Record<string, unknown>;
|
|
2165
|
+
}
|
|
2166
|
+
interface DeleteMarketParams {
|
|
2167
|
+
id: string;
|
|
2168
|
+
}
|
|
2169
|
+
interface CreateMarketParams {
|
|
2170
|
+
name: string;
|
|
2171
|
+
countryCodes: Array<string>;
|
|
2172
|
+
metadata?: Record<string, unknown>;
|
|
2173
|
+
}
|
|
2174
|
+
declare class MarketsResource {
|
|
2175
|
+
private httpClient;
|
|
2176
|
+
constructor(httpClient: CommetHTTPClient);
|
|
2177
|
+
/** Get one reusable market. */
|
|
2178
|
+
get(params: GetMarketParams, options?: RequestOptions): Promise<Market>;
|
|
2179
|
+
/** Replace the name, countries, and metadata of a market. */
|
|
2180
|
+
update(params: UpdateMarketParams, options?: RequestOptions): Promise<Market>;
|
|
2181
|
+
/** Delete an unused market. Markets referenced by prices or subscriptions cannot be deleted. */
|
|
2182
|
+
delete(params: DeleteMarketParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
2183
|
+
/** List reusable country groups that resolve market-specific prices independently from currency. */
|
|
2184
|
+
list(): Promise<{
|
|
2185
|
+
object: "list";
|
|
2186
|
+
data: Array<Market>;
|
|
2187
|
+
hasMore: boolean;
|
|
2188
|
+
nextCursor?: string;
|
|
2189
|
+
}>;
|
|
2190
|
+
/** Create a reusable market without attaching it to a plan or price. Countries can belong to only one active market. */
|
|
2191
|
+
create(params: CreateMarketParams, options?: RequestOptions): Promise<Market>;
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2065
2194
|
interface GetOfferParams {
|
|
2066
2195
|
id: string;
|
|
2067
2196
|
}
|
|
2068
2197
|
interface UpdateOfferParams {
|
|
2069
2198
|
id: string;
|
|
2070
2199
|
name: string;
|
|
2071
|
-
purpose: "introductory" | "promotional";
|
|
2072
|
-
planPriceIds: Array<string>;
|
|
2073
2200
|
phases: Array<{
|
|
2074
2201
|
type: "free_trial";
|
|
2075
2202
|
durationDays: number;
|
|
2076
2203
|
} | {
|
|
2077
2204
|
type: "percentage";
|
|
2078
|
-
durationCycles: number;
|
|
2205
|
+
durationCycles: number | null;
|
|
2079
2206
|
/** Discount in basis points. 5000 means 50%. */
|
|
2080
2207
|
percentage: number;
|
|
2081
2208
|
} | {
|
|
2082
2209
|
type: "amount_off";
|
|
2083
|
-
durationCycles: number;
|
|
2210
|
+
durationCycles: number | null;
|
|
2084
2211
|
amounts: Array<{
|
|
2085
2212
|
currency: string;
|
|
2086
2213
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
@@ -2088,7 +2215,7 @@ interface UpdateOfferParams {
|
|
|
2088
2215
|
}>;
|
|
2089
2216
|
} | {
|
|
2090
2217
|
type: "fixed_price";
|
|
2091
|
-
durationCycles: number;
|
|
2218
|
+
durationCycles: number | null;
|
|
2092
2219
|
prices: Array<{
|
|
2093
2220
|
currency: string;
|
|
2094
2221
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
@@ -2106,25 +2233,21 @@ interface DeleteOfferParams {
|
|
|
2106
2233
|
interface ListOffersParams {
|
|
2107
2234
|
cursor?: string;
|
|
2108
2235
|
limit?: number;
|
|
2109
|
-
planPriceId?: string;
|
|
2110
|
-
purpose?: "introductory" | "promotional";
|
|
2111
2236
|
active?: boolean;
|
|
2112
2237
|
}
|
|
2113
2238
|
interface CreateOfferParams {
|
|
2114
2239
|
name: string;
|
|
2115
|
-
purpose: "introductory" | "promotional";
|
|
2116
|
-
planPriceIds: Array<string>;
|
|
2117
2240
|
phases: Array<{
|
|
2118
2241
|
type: "free_trial";
|
|
2119
2242
|
durationDays: number;
|
|
2120
2243
|
} | {
|
|
2121
2244
|
type: "percentage";
|
|
2122
|
-
durationCycles: number;
|
|
2245
|
+
durationCycles: number | null;
|
|
2123
2246
|
/** Discount in basis points. 5000 means 50%. */
|
|
2124
2247
|
percentage: number;
|
|
2125
2248
|
} | {
|
|
2126
2249
|
type: "amount_off";
|
|
2127
|
-
durationCycles: number;
|
|
2250
|
+
durationCycles: number | null;
|
|
2128
2251
|
amounts: Array<{
|
|
2129
2252
|
currency: string;
|
|
2130
2253
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
@@ -2132,7 +2255,7 @@ interface CreateOfferParams {
|
|
|
2132
2255
|
}>;
|
|
2133
2256
|
} | {
|
|
2134
2257
|
type: "fixed_price";
|
|
2135
|
-
durationCycles: number;
|
|
2258
|
+
durationCycles: number | null;
|
|
2136
2259
|
prices: Array<{
|
|
2137
2260
|
currency: string;
|
|
2138
2261
|
/** Amount in the currency's minor unit (for example, cents for USD). */
|
|
@@ -2147,20 +2270,20 @@ interface CreateOfferParams {
|
|
|
2147
2270
|
declare class OffersResource {
|
|
2148
2271
|
private httpClient;
|
|
2149
2272
|
constructor(httpClient: CommetHTTPClient);
|
|
2150
|
-
/** Retrieve
|
|
2273
|
+
/** Retrieve reusable offer terms by public ID. */
|
|
2151
2274
|
get(params: GetOfferParams, options?: RequestOptions): Promise<Offer>;
|
|
2152
|
-
/** Replace
|
|
2275
|
+
/** Replace reusable offer terms. Existing applications keep their immutable accepted terms. */
|
|
2153
2276
|
update(params: UpdateOfferParams, options?: RequestOptions): Promise<Offer>;
|
|
2154
|
-
/** Soft-delete an
|
|
2277
|
+
/** Soft-delete an Offer. Existing applications and their accepted terms remain available for billing and audit. */
|
|
2155
2278
|
delete(params: DeleteOfferParams, options?: RequestOptions): Promise<DeletedOffer>;
|
|
2156
|
-
/** List
|
|
2279
|
+
/** List reusable offer terms. Offers are independent from plans, prices, eligibility, and distribution channels. */
|
|
2157
2280
|
list(params?: ListOffersParams, options?: RequestOptions): Promise<{
|
|
2158
2281
|
object: "list";
|
|
2159
2282
|
data: Array<Offer>;
|
|
2160
2283
|
hasMore: boolean;
|
|
2161
2284
|
nextCursor?: string;
|
|
2162
2285
|
}>;
|
|
2163
|
-
/** Create
|
|
2286
|
+
/** Create reusable offer terms without assigning a plan, price, eligibility rule, or distribution channel. */
|
|
2164
2287
|
create(params: CreateOfferParams, options?: RequestOptions): Promise<Offer>;
|
|
2165
2288
|
}
|
|
2166
2289
|
|
|
@@ -2548,43 +2671,6 @@ declare class PortalResource {
|
|
|
2548
2671
|
getUrl(params?: RequestPortalAccessParams, options?: RequestOptions): Promise<PortalAccess>;
|
|
2549
2672
|
}
|
|
2550
2673
|
|
|
2551
|
-
interface GetMarketGroupParams {
|
|
2552
|
-
id: string;
|
|
2553
|
-
}
|
|
2554
|
-
interface UpdateMarketGroupParams {
|
|
2555
|
-
id: string;
|
|
2556
|
-
name: string;
|
|
2557
|
-
countryCodes: Array<string>;
|
|
2558
|
-
metadata?: Record<string, unknown>;
|
|
2559
|
-
}
|
|
2560
|
-
interface DeleteMarketGroupParams {
|
|
2561
|
-
id: string;
|
|
2562
|
-
}
|
|
2563
|
-
interface CreateMarketGroupParams {
|
|
2564
|
-
name: string;
|
|
2565
|
-
countryCodes: Array<string>;
|
|
2566
|
-
metadata?: Record<string, unknown>;
|
|
2567
|
-
}
|
|
2568
|
-
declare class PricingResource {
|
|
2569
|
-
private httpClient;
|
|
2570
|
-
constructor(httpClient: CommetHTTPClient);
|
|
2571
|
-
/** Get one reusable pricing market group. */
|
|
2572
|
-
getMarketGroup(params: GetMarketGroupParams, options?: RequestOptions): Promise<MarketGroup>;
|
|
2573
|
-
/** Replace the name, countries, and metadata of a pricing market group. */
|
|
2574
|
-
updateMarketGroup(params: UpdateMarketGroupParams, options?: RequestOptions): Promise<MarketGroup>;
|
|
2575
|
-
/** Delete an unused pricing market group. Groups referenced by prices or subscriptions cannot be deleted. */
|
|
2576
|
-
deleteMarketGroup(params: DeleteMarketGroupParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
2577
|
-
/** List reusable country groups used to resolve market-specific prices independently from currency. */
|
|
2578
|
-
listMarketGroups(): Promise<{
|
|
2579
|
-
object: "list";
|
|
2580
|
-
data: Array<MarketGroup>;
|
|
2581
|
-
hasMore: boolean;
|
|
2582
|
-
nextCursor?: string;
|
|
2583
|
-
}>;
|
|
2584
|
-
/** Create a reusable country group. Countries can belong to only one active group; each price chooses its currency independently. */
|
|
2585
|
-
createMarketGroup(params: CreateMarketGroupParams, options?: RequestOptions): Promise<MarketGroup>;
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
2674
|
interface GetPromoCodeParams {
|
|
2589
2675
|
id: string;
|
|
2590
2676
|
}
|
|
@@ -2623,7 +2709,7 @@ declare class PromoCodesResource {
|
|
|
2623
2709
|
hasMore: boolean;
|
|
2624
2710
|
nextCursor?: string;
|
|
2625
2711
|
}>;
|
|
2626
|
-
/** Create a distribution code for an existing
|
|
2712
|
+
/** Create a distribution code for an existing Offer. The referenced Offer owns the benefit and duration; the promo code owns redemption restrictions. */
|
|
2627
2713
|
create(params: CreatePromoCodeParams, options?: RequestOptions): Promise<PromoCode>;
|
|
2628
2714
|
}
|
|
2629
2715
|
|
|
@@ -2882,15 +2968,15 @@ declare class SubscriptionsResource {
|
|
|
2882
2968
|
topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<BalanceTopup>;
|
|
2883
2969
|
/** Cancel immediately or at period end and return the updated subscription. */
|
|
2884
2970
|
cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
2885
|
-
/** Upgrade or change billing interval immediately, optionally applying
|
|
2971
|
+
/** Upgrade or change billing interval immediately, optionally applying an Offer. Scheduled changes do not accept offers. */
|
|
2886
2972
|
changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<PlanChange>;
|
|
2887
2973
|
/** Purchase a credit pack for a subscription. Charges the customer and adds credits to their balance. */
|
|
2888
2974
|
purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
|
|
2889
2975
|
/** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
|
|
2890
2976
|
updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<PaymentMethodUpdateCheckout>;
|
|
2891
|
-
/** Preview proration details for an immediate plan change
|
|
2977
|
+
/** Preview proration details for an immediate plan change without applying it. Interval direction takes precedence: a longer interval is immediate and a shorter interval is scheduled. When the interval is unchanged, a higher-sort-order plan is immediate and a lower-sort-order plan is scheduled. A paid-to-free change is always scheduled. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Scheduled changes return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with an Offer. */
|
|
2892
2978
|
previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<PreviewChange>;
|
|
2893
|
-
/** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply
|
|
2979
|
+
/** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply an Offer by offerId; past-due recovery cannot. */
|
|
2894
2980
|
reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ReactivatedSubscription>;
|
|
2895
2981
|
/** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
|
|
2896
2982
|
createRecoveryLink(params: CreateSubscriptionRecoveryLinkParams, options?: RequestOptions): Promise<RecoveryLink>;
|
|
@@ -2907,7 +2993,7 @@ declare class SubscriptionsResource {
|
|
|
2907
2993
|
hasMore: boolean;
|
|
2908
2994
|
nextCursor?: string;
|
|
2909
2995
|
}>;
|
|
2910
|
-
/** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. Without an offer override, Commet applies the price's automatic introductory
|
|
2996
|
+
/** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. Without an offer override, Commet applies the price's automatic introductory Offer. Pass offerId to apply any active compatible Offer directly; the Offer does not need a prior plan-price association. */
|
|
2911
2997
|
create(params: CreateSubscriptionParams, options?: RequestOptions): Promise<CreatedSubscription>;
|
|
2912
2998
|
}
|
|
2913
2999
|
|
|
@@ -3024,13 +3110,13 @@ declare class GeneratedResources {
|
|
|
3024
3110
|
featureAccess: FeatureAccessResource;
|
|
3025
3111
|
features: FeaturesResource;
|
|
3026
3112
|
invoices: InvoicesResource;
|
|
3113
|
+
markets: MarketsResource;
|
|
3027
3114
|
offers: OffersResource;
|
|
3028
3115
|
payments: PaymentsResource;
|
|
3029
3116
|
payouts: PayoutsResource;
|
|
3030
3117
|
planGroups: PlanGroupsResource;
|
|
3031
3118
|
plans: PlansResource;
|
|
3032
3119
|
portal: PortalResource;
|
|
3033
|
-
pricing: PricingResource;
|
|
3034
3120
|
promoCodes: PromoCodesResource;
|
|
3035
3121
|
provisioning: ProvisioningResource;
|
|
3036
3122
|
quota: QuotaResource;
|
|
@@ -4350,7 +4436,7 @@ declare function createCommet<const TConfig extends BillingConfig>(_billingConfi
|
|
|
4350
4436
|
|
|
4351
4437
|
declare function registerIntegration(name: string, version: string): void;
|
|
4352
4438
|
|
|
4353
|
-
declare const API_VERSION = "2026-07-
|
|
4439
|
+
declare const API_VERSION = "2026-07-31";
|
|
4354
4440
|
declare const SDK_VERSION: string;
|
|
4355
4441
|
|
|
4356
|
-
export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type BalanceAdjustment, type BalanceDepletedData, type BalanceLowData, type BalanceToppedUpData, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSetSeatsParams, type CancelPaymentParams, type CancelSubscriptionParams, type ChangePlanParams, type ChargePaymentParams, type CheckUsageAvailabilityParams, type CheckoutReadyData, type ClaimLink, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type
|
|
4442
|
+
export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type BalanceAdjustment, type BalanceDepletedData, type BalanceLowData, type BalanceToppedUpData, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSetSeatsParams, type CancelPaymentParams, type CancelSubscriptionParams, type ChangePlanParams, type ChargePaymentParams, type CheckUsageAvailabilityParams, type CheckoutReadyData, type ClaimLink, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreateMarketParams, type CreateOfferParams, type CreatePaymentParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, type CreateWebhookEndpointParams, type CreatedApiKey, type CreatedSubscription, type CreatedWebhook, type CreditGrant, type CreditPack, type CreditPackListItem, type CreditsDepletedData, type CreditsExpiredData, type CreditsGrantedData, type CreditsLowData, type CreditsPurchasedData, type Customer, type CustomerBatch, type CustomerCreatedData, type CustomerStateChangedData, type CustomerUpdatedData, type DeactivateAddonParams, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeleteMarketParams, type DeleteOfferParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookEndpointParams, type DeletedObject, type DeletedOffer, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DownloadInvoiceParams, type Feature, type FeatureAccess, type FeatureDef, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetFeatureParams, type GetInvoiceParams, type GetMarketParams, type GetOfferParams, type GetPaymentParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookEndpointParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceCreatedData, type InvoiceDownload, type InvoiceListItem, type InvoiceOverdueData, type InvoiceType, type InvoiceUpcomingData, type InvoiceVoidedData, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListOffersParams, type ListPaymentsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhookEndpointsParams, type Market, type Offer, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethodAttachedData, type PaymentMethodUpdateCheckout, type PaymentMethodUpdatedData, type PaymentProvider, type PaymentReceivedData, type PaymentRecoveredData, type PaymentRefundedData, type PaymentRetryFailedData, type Payout, type PayoutAvailableData, type PayoutBankAccount, type PayoutCreatedData, type PayoutFailedData, type PayoutPaidData, type PayoutVerification, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGroup, type PlanGroupDetail, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PortalAccess, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type QuotaExceededData, type QuotaThresholdReachedData, type ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, type Refund, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatBalanceCollection, type SeatEvent, type SeatsLimitReachedData, type SeatsUpdatedData, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type SetUsageParams, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionOfferApplication, type SubscriptionOfferApplicationPhase, type SubscriptionPastDueData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionStatus, type SubscriptionSummary, type SubscriptionUpdatedData, type TestClock, type TestClockBilling, type TestWebhookEndpointParams, type Timezone, type TopupBalanceParams, type TrackUsageParams, type Transaction, type TransactionListItem, type TransactionRetry, type TransactionStatus, type TrialCheckoutReadyData, type TrialConvertedData, type TrialExpiredData, type TrialStartedData, type TrialWillEndData, type UncancelSubscriptionParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdateMarketParams, type UpdateOfferParams, type UpdatePaymentMethodParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookEndpointParams, type UpsertRegionalPricesParams, type UsageAdjustment, type UsageCheck, type UsageEvent, type UsageQuota, type UsageQuotaEvent, type UsageRecordedData, type Webhook, type WebhookAddonRef, type WebhookBalance, type WebhookBankRef, type WebhookCardInfo, type WebhookCreditsBalance, type WebhookData, type WebhookEvent, type WebhookEventDataMap, type WebhookEventEnvelope, type WebhookEventHandler, type WebhookEventPayload, type WebhookPayload, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTest, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
|