@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.
Files changed (40) hide show
  1. package/dist/index.d.mts +298 -495
  2. package/dist/index.d.ts +298 -495
  3. package/dist/index.js +11 -11
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +11 -11
  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/offers.md +9 -5
  12. package/docs/api-reference/payments.md +1 -1
  13. package/docs/api-reference/plan-groups.md +2 -2
  14. package/docs/api-reference/plans.md +28 -44
  15. package/docs/api-reference/portal.md +3 -8
  16. package/docs/api-reference/promo-codes.md +3 -3
  17. package/docs/api-reference/quota.md +6 -21
  18. package/docs/api-reference/subscriptions.md +38 -55
  19. package/docs/api-reference/test-clock.md +3 -8
  20. package/docs/api-reference/usage.md +6 -11
  21. package/docs/documentation/create-api-key.md +4 -2
  22. package/docs/documentation/invoicing/handle-failed-payments.md +12 -3
  23. package/docs/documentation/plans/one-time-payments.md +1 -0
  24. package/docs/documentation/sales/offers.md +21 -3
  25. package/docs/documentation/sales/promo-codes.md +2 -2
  26. package/docs/documentation/sales/promotional-offers.md +1 -1
  27. package/docs/documentation/subscriptions/manage-subscriptions.md +3 -3
  28. package/docs/documentation/subscriptions/pay-in-advance.md +6 -4
  29. package/docs/errors/already_has_active_subscription.md +1 -1
  30. package/docs/errors/charge_failed.md +1 -1
  31. package/docs/errors/no_payment_method.md +1 -1
  32. package/docs/errors/payment_failed.md +1 -1
  33. package/docs/errors/subscription_not_active.md +1 -1
  34. package/docs/errors/validation_error.md +1 -1
  35. package/docs/knowledge-base/how-do-discounts-work.md +3 -3
  36. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +6 -6
  37. package/docs/schemas.md +6 -4
  38. package/docs/webhooks.md +2 -0
  39. package/docs/webhooks.openapi.json +22 -4
  40. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -295,7 +295,7 @@ var OffersResource = class {
295
295
  async list(params, options) {
296
296
  return this.httpClient.get("/offers", params, options);
297
297
  }
298
- /** Create reusable offer terms without assigning a plan, price, eligibility rule, or distribution channel. */
298
+ /** Create reusable offer terms. An offer applies to any plan and billing interval unless `planIds` or `billingInterval` limit it. */
299
299
  async create(params, options) {
300
300
  return this.httpClient.post("/offers", params, options);
301
301
  }
@@ -709,7 +709,7 @@ var PromoCodesResource = class {
709
709
  constructor(httpClient) {
710
710
  this.httpClient = httpClient;
711
711
  }
712
- /** Retrieve a promo code by its public ID. */
712
+ /** Retrieve a promo code by its public ID or by the code customers enter, in any letter case. */
713
713
  async get(params, options) {
714
714
  const { id } = params;
715
715
  return this.httpClient.get(`/promo-codes/${id}`, void 0, options);
@@ -812,7 +812,7 @@ var SubscriptionsResource = class {
812
812
  options
813
813
  );
814
814
  }
815
- /** 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. */
815
+ /** 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. */
816
816
  async activateAddon(params, options) {
817
817
  const { id, ...rest } = params;
818
818
  return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
@@ -844,7 +844,7 @@ var SubscriptionsResource = class {
844
844
  options
845
845
  );
846
846
  }
847
- /** 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. */
847
+ /** 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. */
848
848
  async topupBalance(params, options) {
849
849
  const { id, ...rest } = params;
850
850
  return this.httpClient.post(
@@ -853,7 +853,7 @@ var SubscriptionsResource = class {
853
853
  options
854
854
  );
855
855
  }
856
- /** Cancel immediately or at period end and return the updated subscription. */
856
+ /** 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. */
857
857
  async cancel(params, options) {
858
858
  const { id, ...rest } = params;
859
859
  return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
@@ -876,7 +876,7 @@ var SubscriptionsResource = class {
876
876
  options
877
877
  );
878
878
  }
879
- /** 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. */
879
+ /** 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. */
880
880
  async purchaseCredits(params, options) {
881
881
  const { id, ...rest } = params;
882
882
  return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
@@ -941,7 +941,7 @@ var SubscriptionsResource = class {
941
941
  options
942
942
  );
943
943
  }
944
- /** 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. */
944
+ /** 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. */
945
945
  async reactivate(params, options) {
946
946
  const { id, ...rest } = params;
947
947
  return this.httpClient.post(
@@ -987,7 +987,7 @@ var SubscriptionsResource = class {
987
987
  options
988
988
  );
989
989
  }
990
- /** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. */
990
+ /** 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. */
991
991
  async uncancel(params, options) {
992
992
  const { id } = params;
993
993
  return this.httpClient.post(`/subscriptions/${id}/uncancel`, {}, options);
@@ -996,11 +996,11 @@ var SubscriptionsResource = class {
996
996
  async getActive(params, options) {
997
997
  return this.httpClient.get("/subscriptions/active", params, options);
998
998
  }
999
- /** List all subscriptions. Filter by customer ID or status. */
999
+ /** 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. */
1000
1000
  async list(params, options) {
1001
1001
  return this.httpClient.get("/subscriptions", params, options);
1002
1002
  }
1003
- /** 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. */
1003
+ /** 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. */
1004
1004
  async create(params, options) {
1005
1005
  return this.httpClient.post("/subscriptions", params, options);
1006
1006
  }
@@ -1247,7 +1247,7 @@ var CommetValidationError = class extends CommetAPIError {
1247
1247
 
1248
1248
  // src/version.ts
1249
1249
  var API_VERSION = "2026-08-27";
1250
- var SDK_VERSION = "9.12.0";
1250
+ var SDK_VERSION = "9.13.0";
1251
1251
 
1252
1252
  // src/utils/telemetry.ts
1253
1253
  var registeredIntegrations = /* @__PURE__ */ new Set();