@commet/node 9.12.0 → 9.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +298 -495
- package/dist/index.d.ts +298 -495
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/index.mjs.map +1 -1
- package/docs/api-reference/addons.md +8 -15
- package/docs/api-reference/api-keys.md +1 -1
- package/docs/api-reference/credit-packs.md +2 -2
- package/docs/api-reference/customers.md +7 -19
- package/docs/api-reference/offers.md +9 -5
- package/docs/api-reference/payments.md +1 -1
- package/docs/api-reference/plan-groups.md +2 -2
- package/docs/api-reference/plans.md +28 -44
- package/docs/api-reference/portal.md +3 -8
- package/docs/api-reference/promo-codes.md +3 -3
- package/docs/api-reference/quota.md +6 -21
- package/docs/api-reference/subscriptions.md +38 -55
- package/docs/api-reference/test-clock.md +3 -8
- package/docs/api-reference/usage.md +6 -11
- package/docs/documentation/create-api-key.md +4 -2
- package/docs/documentation/invoicing/handle-failed-payments.md +12 -3
- package/docs/documentation/plans/one-time-payments.md +1 -0
- package/docs/documentation/sales/offers.md +21 -3
- package/docs/documentation/sales/promo-codes.md +2 -2
- package/docs/documentation/sales/promotional-offers.md +1 -1
- package/docs/documentation/subscriptions/manage-subscriptions.md +3 -3
- package/docs/documentation/subscriptions/pay-in-advance.md +6 -4
- package/docs/errors/already_has_active_subscription.md +1 -1
- package/docs/errors/charge_failed.md +1 -1
- package/docs/errors/no_payment_method.md +1 -1
- package/docs/errors/payment_failed.md +1 -1
- package/docs/errors/subscription_not_active.md +1 -1
- package/docs/errors/validation_error.md +1 -1
- package/docs/knowledge-base/how-do-discounts-work.md +3 -3
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +6 -6
- package/docs/schemas.md +6 -4
- package/docs/webhooks.md +2 -0
- package/docs/webhooks.openapi.json +22 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -341,7 +341,7 @@ var OffersResource = class {
|
|
|
341
341
|
async list(params, options) {
|
|
342
342
|
return this.httpClient.get("/offers", params, options);
|
|
343
343
|
}
|
|
344
|
-
/** Create reusable offer terms
|
|
344
|
+
/** Create reusable offer terms. An offer applies to any plan and billing interval unless `planIds` or `billingInterval` limit it. */
|
|
345
345
|
async create(params, options) {
|
|
346
346
|
return this.httpClient.post("/offers", params, options);
|
|
347
347
|
}
|
|
@@ -755,7 +755,7 @@ var PromoCodesResource = class {
|
|
|
755
755
|
constructor(httpClient) {
|
|
756
756
|
this.httpClient = httpClient;
|
|
757
757
|
}
|
|
758
|
-
/** Retrieve a promo code by its public ID. */
|
|
758
|
+
/** Retrieve a promo code by its public ID or by the code customers enter, in any letter case. */
|
|
759
759
|
async get(params, options) {
|
|
760
760
|
const { id } = params;
|
|
761
761
|
return this.httpClient.get(`/promo-codes/${id}`, void 0, options);
|
|
@@ -858,7 +858,7 @@ var SubscriptionsResource = class {
|
|
|
858
858
|
options
|
|
859
859
|
);
|
|
860
860
|
}
|
|
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.
|
|
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. Send successUrl to receive, when there is no saved payment method or it is declined, a checkout that charges the activation and saves the method. Rejected with 409 while the add-on is active or an activation of it is still processing. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable. */
|
|
862
862
|
async activateAddon(params, options) {
|
|
863
863
|
const { id, ...rest } = params;
|
|
864
864
|
return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
|
|
@@ -890,7 +890,7 @@ var SubscriptionsResource = class {
|
|
|
890
890
|
options
|
|
891
891
|
);
|
|
892
892
|
}
|
|
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.
|
|
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. Send successUrl to receive, when there is no saved payment method or it is declined, a checkout that charges the top-up and saves the method. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge. */
|
|
894
894
|
async topupBalance(params, options) {
|
|
895
895
|
const { id, ...rest } = params;
|
|
896
896
|
return this.httpClient.post(
|
|
@@ -899,7 +899,7 @@ var SubscriptionsResource = class {
|
|
|
899
899
|
options
|
|
900
900
|
);
|
|
901
901
|
}
|
|
902
|
-
/** Cancel immediately or at period end and return the updated subscription. */
|
|
902
|
+
/** Cancel immediately or at period end and return the updated subscription. When the plan's group has a default free plan, a paid subscription moves to that plan instead of ending: now when `immediate` is true, otherwise at the end of the period or trial as a scheduled plan change that `POST /subscriptions/{id}/uncancel` undoes. The move sends `subscription.plan_change_scheduled` and `subscription.plan_changed` with the `reason` as `cancelReason`, never `subscription.canceled`. Cancelling the default plan itself ends the subscription. */
|
|
903
903
|
async cancel(params, options) {
|
|
904
904
|
const { id, ...rest } = params;
|
|
905
905
|
return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
|
|
@@ -922,7 +922,7 @@ var SubscriptionsResource = class {
|
|
|
922
922
|
options
|
|
923
923
|
);
|
|
924
924
|
}
|
|
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.
|
|
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. Send successUrl to receive, when there is no saved payment method or it is declined, a checkout that charges the purchase and saves the method. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
|
|
926
926
|
async purchaseCredits(params, options) {
|
|
927
927
|
const { id, ...rest } = params;
|
|
928
928
|
return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
|
|
@@ -987,7 +987,7 @@ var SubscriptionsResource = class {
|
|
|
987
987
|
options
|
|
988
988
|
);
|
|
989
989
|
}
|
|
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. */
|
|
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 past_due subscription without a payment method returns no_payment_method with the same recoveryUrl. A canceled subscription may apply an Offer by offerId; past-due recovery cannot. */
|
|
991
991
|
async reactivate(params, options) {
|
|
992
992
|
const { id, ...rest } = params;
|
|
993
993
|
return this.httpClient.post(
|
|
@@ -1033,7 +1033,7 @@ var SubscriptionsResource = class {
|
|
|
1033
1033
|
options
|
|
1034
1034
|
);
|
|
1035
1035
|
}
|
|
1036
|
-
/** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. */
|
|
1036
|
+
/** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. When the cancellation scheduled a move to the group's default plan instead, it reverts that move: the subscription keeps its plan and renews normally. */
|
|
1037
1037
|
async uncancel(params, options) {
|
|
1038
1038
|
const { id } = params;
|
|
1039
1039
|
return this.httpClient.post(`/subscriptions/${id}/uncancel`, {}, options);
|
|
@@ -1042,11 +1042,11 @@ var SubscriptionsResource = class {
|
|
|
1042
1042
|
async getActive(params, options) {
|
|
1043
1043
|
return this.httpClient.get("/subscriptions/active", params, options);
|
|
1044
1044
|
}
|
|
1045
|
-
/** List
|
|
1045
|
+
/** List subscriptions, newest first. Filter by customer ID, status or plan version. Send `limit` or `cursor` to receive them in pages and follow `nextCursor` while `hasMore` is true; without them the response holds every matching subscription, up to 80,000. */
|
|
1046
1046
|
async list(params, options) {
|
|
1047
1047
|
return this.httpClient.get("/subscriptions", params, options);
|
|
1048
1048
|
}
|
|
1049
|
-
/** Create a subscription for a customer. Commet selects the default price when priceId is omitted. The subscription starts at the base USD price; market and currency are resolved from the buyer's request country when the checkout opens. Without an offer override, Commet applies the price's automatic introductory Offer. Pass offerId to apply an active compatible Offer directly, or cardPromotionId to preselect a card-eligible Promotional Offer for the initial checkout when card promotions are enabled for the organization. For the initial checkout, provider accepts either a processor name or an exact payment connection ID. When the price's free trial requires no payment method, the subscription starts trialing right away with no checkout (checkoutUrl null, hasPaymentMethod false); it cannot be combined with offerId, promoCode, cardPromotionId or
|
|
1049
|
+
/** Create a subscription for a customer. Commet selects the default price when priceId is omitted. The subscription starts at the base USD price; market and currency are resolved from the buyer's request country when the checkout opens. Without an offer override, Commet applies the price's automatic introductory Offer. Pass offerId to apply an active compatible Offer directly, or cardPromotionId to preselect a card-eligible Promotional Offer for the initial checkout when card promotions are enabled for the organization. For the initial checkout, provider accepts either a processor name or an exact payment connection ID. When the price's free trial requires no payment method, the subscription starts trialing right away with no checkout (checkoutUrl null, hasPaymentMethod false); it cannot be combined with offerId, promoCode, cardPromotionId, provider or paymentMethodTypes, and an organization that cannot charge yet receives 403. When the customer already has a past_due subscription, the 409 error details carry its subscriptionId, its status and, while its renewal is unpaid, a recoveryUrl where the customer can pay it. */
|
|
1050
1050
|
async create(params, options) {
|
|
1051
1051
|
return this.httpClient.post("/subscriptions", params, options);
|
|
1052
1052
|
}
|
|
@@ -1293,7 +1293,7 @@ var CommetValidationError = class extends CommetAPIError {
|
|
|
1293
1293
|
|
|
1294
1294
|
// src/version.ts
|
|
1295
1295
|
var API_VERSION = "2026-08-27";
|
|
1296
|
-
var SDK_VERSION = "9.
|
|
1296
|
+
var SDK_VERSION = "9.13.0";
|
|
1297
1297
|
|
|
1298
1298
|
// src/utils/telemetry.ts
|
|
1299
1299
|
var registeredIntegrations = /* @__PURE__ */ new Set();
|