@commet/node 9.10.0 → 9.12.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 +167 -73
- package/dist/index.d.ts +167 -73
- package/dist/index.js +16 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -13
- package/dist/index.mjs.map +1 -1
- package/docs/api-reference/customers.md +3 -3
- package/docs/api-reference/features.md +1 -1
- package/docs/api-reference/index.md +1 -1
- package/docs/api-reference/invoices.md +4 -3
- package/docs/api-reference/plans.md +8 -4
- package/docs/api-reference/subscriptions.md +10 -6
- package/docs/api-reference/transactions.md +2 -1
- package/docs/documentation/error-handling.md +11 -0
- package/docs/documentation/invoicing/manage-invoices.md +1 -1
- package/docs/documentation/plans/add-ons.md +4 -2
- package/docs/documentation/plans/balance-and-top-ups.md +3 -1
- package/docs/documentation/plans/consumption-models.md +29 -1
- package/docs/documentation/plans/credit-packs.md +28 -8
- package/docs/documentation/plans/plan-versions.md +9 -7
- package/docs/documentation/sales/promotional-offers.md +1 -1
- package/docs/documentation/sales/regional-prices.md +1 -1
- package/docs/documentation/subscriptions/manage-subscriptions.md +1 -1
- package/docs/documentation/subscriptions/plan-grants.md +22 -6
- package/docs/errors/currency_held_by_balance_plan.md +22 -0
- package/docs/errors/currency_held_by_customer_credit.md +22 -0
- package/docs/errors/currency_held_by_fixed_amount_discount.md +22 -0
- package/docs/errors/currency_held_by_payment_method.md +22 -0
- package/docs/errors/currency_held_by_prepaid_period.md +22 -0
- package/docs/errors/currency_held_by_scheduled_pause.md +22 -0
- package/docs/errors/index.md +7 -1
- package/docs/errors/missing_regional_price.md +3 -3
- package/docs/knowledge-base/how-do-discounts-work.md +19 -1
- package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +1 -1
- package/docs/manifest.json +37 -1
- package/docs/schemas.md +30 -16
- package/docs/webhooks.md +18 -17
- package/docs/webhooks.openapi.json +63 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -234,7 +234,7 @@ var FeaturesResource = class {
|
|
|
234
234
|
const { code, ...rest } = params;
|
|
235
235
|
return this.httpClient.patch(`/features/${code}`, rest, options);
|
|
236
236
|
}
|
|
237
|
-
/** Delete a feature. Fails
|
|
237
|
+
/** Delete a feature. Fails while a plan's current version, a running experiment or a draft includes it, or while it has an active add-on. Subscribers whose plan version includes it keep it, and its code can be used by a new feature right away. */
|
|
238
238
|
async delete(params, options) {
|
|
239
239
|
const { code } = params;
|
|
240
240
|
return this.httpClient.delete(`/features/${code}`, void 0, options);
|
|
@@ -269,10 +269,13 @@ var InvoicesResource = class {
|
|
|
269
269
|
const { id } = params;
|
|
270
270
|
return this.httpClient.post(`/invoices/${id}/send`, {}, options);
|
|
271
271
|
}
|
|
272
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* Deprecated. No longer changes the invoice. An invoice is paid when its charge settles: to collect a past-due subscription, reactivate it or send the customer a recovery link.
|
|
274
|
+
* @deprecated
|
|
275
|
+
*/
|
|
273
276
|
async updateStatus(params, options) {
|
|
274
|
-
const { id
|
|
275
|
-
return this.httpClient.patch(`/invoices/${id}/status`,
|
|
277
|
+
const { id } = params;
|
|
278
|
+
return this.httpClient.patch(`/invoices/${id}/status`, {}, options);
|
|
276
279
|
}
|
|
277
280
|
/** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
|
|
278
281
|
async list(params, options) {
|
|
@@ -855,7 +858,7 @@ var SubscriptionsResource = class {
|
|
|
855
858
|
options
|
|
856
859
|
);
|
|
857
860
|
}
|
|
858
|
-
/** Activate an add-on on a subscription.
|
|
861
|
+
/** Activate an add-on on a subscription. Creates the activation invoice and charges a prorated amount for the current billing period; the add-on is active once the payment is confirmed. Without a saved payment method, send successUrl to receive a checkout that charges the activation and saves the method. Rejected with 409 while the add-on is active or an activation of it is still processing. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable. */
|
|
859
862
|
async activateAddon(params, options) {
|
|
860
863
|
const { id, ...rest } = params;
|
|
861
864
|
return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
|
|
@@ -887,7 +890,7 @@ var SubscriptionsResource = class {
|
|
|
887
890
|
options
|
|
888
891
|
);
|
|
889
892
|
}
|
|
890
|
-
/** Top up a balance subscription.
|
|
893
|
+
/** Top up a balance subscription. Creates the top-up invoice and charges the customer's payment method for the amount plus tax. Once the payment is confirmed, adds the amount to the subscription's purchased balance (after paying back any overage owed on the plan balance), marks the invoice paid and emits `balance.topped_up`. Purchased balance is spent after the plan balance and is kept until the subscription ends. Without a saved payment method, send successUrl to receive a checkout that charges the top-up and saves the method. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge. */
|
|
891
894
|
async topupBalance(params, options) {
|
|
892
895
|
const { id, ...rest } = params;
|
|
893
896
|
return this.httpClient.post(
|
|
@@ -910,7 +913,7 @@ var SubscriptionsResource = class {
|
|
|
910
913
|
options
|
|
911
914
|
);
|
|
912
915
|
}
|
|
913
|
-
/** 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. */
|
|
916
|
+
/** Move a subscription to a newer published version of its plan, now or at the end of the period, without proration; an older version is rejected with version_not_newer, and a subscription on a running experiment moves only to a later version of that experiment. The subscription keeps its currency and its price: a destination that does not sell its currency is rejected with missing_regional_price unless currency asks to charge it in USD from its renewal, and one that does not sell the price it pays with price_not_found. A free version moves only to a free version and a paid one only to a paid one (validation_error). A subscription whose usage does not fit the destination, or with an active add-on the destination does not sell, is not moved either, and the error says why. Each change is recorded as a move of this one subscription in the plan's moves. Repeating the same request changes nothing; a new one replaces the pending move. */
|
|
914
917
|
async changeVersion(params, options) {
|
|
915
918
|
const { id, ...rest } = params;
|
|
916
919
|
return this.httpClient.post(
|
|
@@ -919,7 +922,7 @@ var SubscriptionsResource = class {
|
|
|
919
922
|
options
|
|
920
923
|
);
|
|
921
924
|
}
|
|
922
|
-
/** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum.
|
|
925
|
+
/** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Creates the purchase invoice, charges the saved payment method and adds the purchased credits once the payment is confirmed. Without a saved payment method, send successUrl to receive a checkout that charges the purchase and saves the method. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
|
|
923
926
|
async purchaseCredits(params, options) {
|
|
924
927
|
const { id, ...rest } = params;
|
|
925
928
|
return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
|
|
@@ -984,7 +987,7 @@ var SubscriptionsResource = class {
|
|
|
984
987
|
options
|
|
985
988
|
);
|
|
986
989
|
}
|
|
987
|
-
/** 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. */
|
|
990
|
+
/** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period; when that invoice totals zero, for example under an Offer, it is marked paid without a charge and the subscription becomes active at once, still requiring a saved payment method. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply an Offer by offerId; past-due recovery cannot. */
|
|
988
991
|
async reactivate(params, options) {
|
|
989
992
|
const { id, ...rest } = params;
|
|
990
993
|
return this.httpClient.post(
|
|
@@ -1076,10 +1079,10 @@ var TransactionsResource = class {
|
|
|
1076
1079
|
constructor(httpClient) {
|
|
1077
1080
|
this.httpClient = httpClient;
|
|
1078
1081
|
}
|
|
1079
|
-
/**
|
|
1082
|
+
/** Refund a positive amount in the payment currency’s smallest unit, or omit amount to refund the remaining amount. Returns the refund resource with its actual status. */
|
|
1080
1083
|
async refund(params, options) {
|
|
1081
|
-
const { id } = params;
|
|
1082
|
-
return this.httpClient.post(`/transactions/${id}/refund`,
|
|
1084
|
+
const { id, ...rest } = params;
|
|
1085
|
+
return this.httpClient.post(`/transactions/${id}/refund`, rest, options);
|
|
1083
1086
|
}
|
|
1084
1087
|
/** Retry a failed subscription renewal and return an honest retry result. The original failed transaction remains immutable. */
|
|
1085
1088
|
async retry(params, options) {
|
|
@@ -1290,7 +1293,7 @@ var CommetValidationError = class extends CommetAPIError {
|
|
|
1290
1293
|
|
|
1291
1294
|
// src/version.ts
|
|
1292
1295
|
var API_VERSION = "2026-08-27";
|
|
1293
|
-
var SDK_VERSION = "9.
|
|
1296
|
+
var SDK_VERSION = "9.12.0";
|
|
1294
1297
|
|
|
1295
1298
|
// src/utils/telemetry.ts
|
|
1296
1299
|
var registeredIntegrations = /* @__PURE__ */ new Set();
|