@commet/node 9.11.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.
Files changed (47) hide show
  1. package/dist/index.d.mts +329 -507
  2. package/dist/index.d.ts +329 -507
  3. package/dist/index.js +12 -12
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +12 -12
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/api-reference/addons.md +8 -15
  8. package/docs/api-reference/api-keys.md +1 -1
  9. package/docs/api-reference/credit-packs.md +2 -2
  10. package/docs/api-reference/customers.md +7 -19
  11. package/docs/api-reference/features.md +1 -1
  12. package/docs/api-reference/offers.md +9 -5
  13. package/docs/api-reference/payments.md +1 -1
  14. package/docs/api-reference/plan-groups.md +2 -2
  15. package/docs/api-reference/plans.md +28 -44
  16. package/docs/api-reference/portal.md +3 -8
  17. package/docs/api-reference/promo-codes.md +3 -3
  18. package/docs/api-reference/quota.md +6 -21
  19. package/docs/api-reference/subscriptions.md +38 -52
  20. package/docs/api-reference/test-clock.md +3 -8
  21. package/docs/api-reference/usage.md +6 -11
  22. package/docs/documentation/create-api-key.md +4 -2
  23. package/docs/documentation/error-handling.md +11 -0
  24. package/docs/documentation/invoicing/handle-failed-payments.md +12 -3
  25. package/docs/documentation/plans/add-ons.md +2 -0
  26. package/docs/documentation/plans/balance-and-top-ups.md +2 -0
  27. package/docs/documentation/plans/consumption-models.md +9 -1
  28. package/docs/documentation/plans/credit-packs.md +24 -6
  29. package/docs/documentation/plans/one-time-payments.md +1 -0
  30. package/docs/documentation/sales/offers.md +21 -3
  31. package/docs/documentation/sales/promo-codes.md +2 -2
  32. package/docs/documentation/sales/promotional-offers.md +2 -2
  33. package/docs/documentation/subscriptions/manage-subscriptions.md +3 -3
  34. package/docs/documentation/subscriptions/pay-in-advance.md +6 -4
  35. package/docs/documentation/subscriptions/plan-grants.md +22 -6
  36. package/docs/errors/already_has_active_subscription.md +1 -1
  37. package/docs/errors/charge_failed.md +1 -1
  38. package/docs/errors/no_payment_method.md +1 -1
  39. package/docs/errors/payment_failed.md +1 -1
  40. package/docs/errors/subscription_not_active.md +1 -1
  41. package/docs/errors/validation_error.md +1 -1
  42. package/docs/knowledge-base/how-do-discounts-work.md +20 -2
  43. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +6 -6
  44. package/docs/schemas.md +13 -5
  45. package/docs/webhooks.md +16 -14
  46. package/docs/webhooks.openapi.json +85 -41
  47. 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 if the feature is attached to active plans or has an active add-on. */
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);
@@ -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 without assigning a plan, price, eligibility rule, or distribution channel. */
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. 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. */
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. 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. */
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. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
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. 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 all subscriptions. Filter by customer ID or status. */
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 provider, and an organization that cannot charge yet receives 403. */
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.11.0";
1296
+ var SDK_VERSION = "9.13.0";
1297
1297
 
1298
1298
  // src/utils/telemetry.ts
1299
1299
  var registeredIntegrations = /* @__PURE__ */ new Set();