@commet/node 9.7.0 → 9.9.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 +413 -52
- package/dist/index.d.ts +413 -52
- package/dist/index.js +39 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -12
- package/dist/index.mjs.map +1 -1
- package/docs/ai-onboarding/mcp-server.md +1 -1
- package/docs/api-reference/customers.md +6 -2
- package/docs/api-reference/generated-webhooks.md +2 -2
- package/docs/api-reference/index.md +2 -2
- package/docs/api-reference/offers.md +2 -2
- package/docs/api-reference/plans.md +16 -3
- package/docs/api-reference/promo-codes.md +3 -1
- package/docs/api-reference/subscriptions.md +84 -9
- package/docs/api-reference/usage.md +0 -4
- package/docs/documentation/cli.md +60 -49
- package/docs/documentation/create-api-key.md +3 -1
- package/docs/documentation/customers/customer-portal.md +10 -2
- package/docs/documentation/customers/manage-customers.md +2 -1
- package/docs/documentation/finance/payouts.md +11 -0
- package/docs/documentation/finance/supported-countries.md +5 -5
- package/docs/documentation/invoicing/handle-failed-payments.md +9 -9
- package/docs/documentation/payments/accept-one-time-payments.md +1 -1
- package/docs/documentation/payments/payment-orchestration.md +2 -0
- package/docs/documentation/payments/payment-providers.md +46 -0
- package/docs/documentation/payments/transactions-refunds-and-retries.md +1 -1
- package/docs/documentation/plans/add-ons.md +1 -1
- package/docs/documentation/plans/consumption-models.md +44 -9
- package/docs/documentation/plans/credit-packs.md +49 -1
- package/docs/documentation/plans/one-time-payments.md +3 -3
- package/docs/documentation/plans/plan-groups.md +46 -10
- package/docs/documentation/platform/dashboard-metrics-and-events.md +40 -9
- package/docs/documentation/sales/connect-dub-affiliates.md +52 -0
- package/docs/documentation/sales/introductory-offers.md +7 -13
- package/docs/documentation/sales/offers.md +10 -6
- package/docs/documentation/sales/promo-codes.md +47 -17
- package/docs/documentation/sales/promotional-offers.md +6 -7
- package/docs/documentation/sales/regional-prices.md +16 -0
- package/docs/documentation/sales/trial-periods.md +67 -40
- package/docs/documentation/subscriptions/manage-subscriptions.md +65 -2
- package/docs/documentation/subscriptions/pay-in-advance.md +4 -7
- package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +20 -2
- package/docs/documentation/testing-sandbox.md +2 -0
- package/docs/documentation/usage/track-usage.md +23 -0
- package/docs/errors/customer_deleted.md +22 -0
- package/docs/errors/index.md +5 -0
- package/docs/errors/managed_by_integration.md +22 -0
- package/docs/errors/no_scheduled_plan_change.md +22 -0
- package/docs/errors/plan_balance_limit_reached.md +22 -0
- package/docs/errors/plan_credit_limit_reached.md +22 -0
- package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +8 -8
- package/docs/knowledge-base/how-do-discounts-work.md +7 -5
- package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +14 -8
- package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +1 -1
- package/docs/knowledge-base/how-do-trial-periods-work.md +30 -24
- package/docs/knowledge-base/how-does-billing-work.md +1 -0
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +11 -9
- package/docs/manifest.json +54 -2
- package/docs/platform-documentation.md +1 -0
- package/docs/schemas.md +51 -9
- package/docs/webhooks/introduction.md +14 -12
- package/docs/webhooks.md +53 -17
- package/docs/webhooks.openapi.json +857 -745
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -189,7 +189,7 @@ var CustomersResource = class {
|
|
|
189
189
|
const { id, ...rest } = params;
|
|
190
190
|
return this.httpClient.patch(`/customers/${id}`, rest, options);
|
|
191
191
|
}
|
|
192
|
-
/** Create up to 100 customers in a single request. */
|
|
192
|
+
/** Create up to 100 customers in a single request. With planGroupId, each customer without an open subscription starts on that group's starting plan (see planGroupId), and the entry of a deleted customer fails with customer_deleted. */
|
|
193
193
|
async createBatch(params, options) {
|
|
194
194
|
return this.httpClient.post("/customers/batch", params, options);
|
|
195
195
|
}
|
|
@@ -197,7 +197,7 @@ var CustomersResource = class {
|
|
|
197
197
|
async list(params, options) {
|
|
198
198
|
return this.httpClient.get("/customers", params, options);
|
|
199
199
|
}
|
|
200
|
-
/** Create a new customer. Idempotent when customerId is provided. */
|
|
200
|
+
/** Create a new customer. Idempotent when customerId is provided. With planGroupId, a customer without an open subscription starts on that group's starting plan (see planGroupId), and the externalId of a deleted customer is rejected. */
|
|
201
201
|
async create(params, options) {
|
|
202
202
|
return this.httpClient.post("/customers", params, options);
|
|
203
203
|
}
|
|
@@ -536,7 +536,7 @@ var PlansResource = class {
|
|
|
536
536
|
const { id } = params;
|
|
537
537
|
return this.httpClient.get(`/plans/${id}`, void 0, options);
|
|
538
538
|
}
|
|
539
|
-
/** Update a plan's name, description, visibility, or
|
|
539
|
+
/** Update a plan's name, description, visibility, default status, metadata, overage behavior, what happens to its unused plan credits or plan balance, or its plan credit or plan balance limit. */
|
|
540
540
|
async update(params, options) {
|
|
541
541
|
const { id, ...rest } = params;
|
|
542
542
|
return this.httpClient.patch(`/plans/${id}`, rest, options);
|
|
@@ -555,7 +555,7 @@ var PlansResource = class {
|
|
|
555
555
|
async list(params, options) {
|
|
556
556
|
return this.httpClient.get("/plans", params, options);
|
|
557
557
|
}
|
|
558
|
-
/** Create a new plan with optional consumption model, visibility, and plan
|
|
558
|
+
/** Create a new plan with optional consumption model, visibility, plan group assignment, overage behavior, and the rollover and spend limit of its plan credits or plan balance. */
|
|
559
559
|
async create(params, options) {
|
|
560
560
|
return this.httpClient.post("/plans", params, options);
|
|
561
561
|
}
|
|
@@ -591,7 +591,7 @@ var PromoCodesResource = class {
|
|
|
591
591
|
async list(params, options) {
|
|
592
592
|
return this.httpClient.get("/promo-codes", params, options);
|
|
593
593
|
}
|
|
594
|
-
/** Create a distribution code for an existing Offer with one or more sequential discount phases
|
|
594
|
+
/** Create a distribution code for an existing Offer with one or more sequential discount phases. The code owns redemption restrictions. */
|
|
595
595
|
async create(params, options) {
|
|
596
596
|
return this.httpClient.post("/promo-codes", params, options);
|
|
597
597
|
}
|
|
@@ -685,6 +685,24 @@ var SubscriptionsResource = class {
|
|
|
685
685
|
const { id, ...rest } = params;
|
|
686
686
|
return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
|
|
687
687
|
}
|
|
688
|
+
/** Read whether the subscription tops up automatically with its saved payment method when its available credits or balance reach a threshold, with the top-ups used this period and the last failure. */
|
|
689
|
+
async getAutoTopUp(params, options) {
|
|
690
|
+
const { id } = params;
|
|
691
|
+
return this.httpClient.get(
|
|
692
|
+
`/subscriptions/${id}/auto-top-up`,
|
|
693
|
+
void 0,
|
|
694
|
+
options
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
/** Turn automatic top-ups on or off and set the threshold, the size of each top-up and the maximum top-ups per period. Send only the fields that change. On a credits plan each top-up buys `quantity` credits; on a balance plan it adds `amount` in minor units of the subscription currency, plus tax, and `threshold` is in the same minor units. Enabling requires a plan that sells credits or has balance top-ups on. The size must be at least the plan's minimum when auto top-up is enabled or when the size changes, so turning it off keeps working after the minimum rises. Saving it enabled resumes a paused auto top-up. */
|
|
698
|
+
async updateAutoTopUp(params, options) {
|
|
699
|
+
const { id, ...rest } = params;
|
|
700
|
+
return this.httpClient.patch(
|
|
701
|
+
`/subscriptions/${id}/auto-top-up`,
|
|
702
|
+
rest,
|
|
703
|
+
options
|
|
704
|
+
);
|
|
705
|
+
}
|
|
688
706
|
/** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
|
|
689
707
|
async adjustBalance(params, options) {
|
|
690
708
|
const { id, ...rest } = params;
|
|
@@ -694,7 +712,7 @@ var SubscriptionsResource = class {
|
|
|
694
712
|
options
|
|
695
713
|
);
|
|
696
714
|
}
|
|
697
|
-
/** Top up a subscription
|
|
715
|
+
/** Top up a balance subscription. Charges the customer's payment method for the amount plus tax, adds it to the subscription's purchased balance (after paying back any overage owed on the plan balance), creates its invoice 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. */
|
|
698
716
|
async topupBalance(params, options) {
|
|
699
717
|
const { id, ...rest } = params;
|
|
700
718
|
return this.httpClient.post(
|
|
@@ -708,7 +726,7 @@ var SubscriptionsResource = class {
|
|
|
708
726
|
const { id, ...rest } = params;
|
|
709
727
|
return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
|
|
710
728
|
}
|
|
711
|
-
/** Upgrade or change billing interval immediately, optionally applying an Offer. Scheduled changes
|
|
729
|
+
/** Upgrade or change billing interval immediately, optionally applying an Offer by offerId or the Offer of a promoCode. Scheduled changes accept neither offerId nor promoCode. From a free plan, a promoCode opens the checkout with the code applied and counts its use when the checkout is paid; without offerId or promoCode, a destination price whose free trial requires no payment method starts that trial right away without checkout. During a trial without a payment method, an immediate change returns 409 no_payment_method; scheduled changes still apply. */
|
|
712
730
|
async changePlan(params, options) {
|
|
713
731
|
const { id, ...rest } = params;
|
|
714
732
|
return this.httpClient.post(
|
|
@@ -717,12 +735,12 @@ var SubscriptionsResource = class {
|
|
|
717
735
|
options
|
|
718
736
|
);
|
|
719
737
|
}
|
|
720
|
-
/** Purchase a credit pack
|
|
738
|
+
/** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Charges the saved payment method and adds purchased credits. */
|
|
721
739
|
async purchaseCredits(params, options) {
|
|
722
740
|
const { id, ...rest } = params;
|
|
723
741
|
return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
|
|
724
742
|
}
|
|
725
|
-
/** Apply a direct Offer to a subscription. On a pending
|
|
743
|
+
/** Apply a direct Offer to a subscription. On a pending checkout it quotes or replaces the checkout discount, which starts after the plan price trial when there is one, and the existing checkout URL remains unchanged. On an active subscription it applies the Offer immediately with its discount phases starting at the next billing cycle; the call is rejected while another applied Offer still has active or upcoming discount phases. */
|
|
726
744
|
async applyOffer(params, options) {
|
|
727
745
|
const { id, ...rest } = params;
|
|
728
746
|
return this.httpClient.put(`/subscriptions/${id}/offer`, rest, options);
|
|
@@ -773,7 +791,7 @@ var SubscriptionsResource = class {
|
|
|
773
791
|
options
|
|
774
792
|
);
|
|
775
793
|
}
|
|
776
|
-
/** Preview proration details for an immediate plan change without applying it. Free-to-paid changes are never scheduled and the change-plan endpoint
|
|
794
|
+
/** Preview proration details for an immediate plan change without applying it. Free-to-paid changes are never scheduled and the change-plan endpoint returns hosted checkout for them, except a change without offerId or promoCode to a price whose free trial needs no payment method, for a customer who never had that plan: it starts the trial at once, so the preview reports nothing due today. For paid plans, 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, or promoCode to quote it with the Offer of a promo code validated with the checkout's rules. */
|
|
777
795
|
async previewChange(params, options) {
|
|
778
796
|
const { id, ...rest } = params;
|
|
779
797
|
return this.httpClient.post(
|
|
@@ -810,6 +828,15 @@ var SubscriptionsResource = class {
|
|
|
810
828
|
const { id } = params;
|
|
811
829
|
return this.httpClient.get(`/subscriptions/${id}`, void 0, options);
|
|
812
830
|
}
|
|
831
|
+
/** Revoke the plan or interval change scheduled for the end of the period, so the subscription stays on its current plan. Returns the updated subscription. */
|
|
832
|
+
async revokeScheduledPlanChange(params, options) {
|
|
833
|
+
const { id } = params;
|
|
834
|
+
return this.httpClient.delete(
|
|
835
|
+
`/subscriptions/${id}/scheduled-plan-change`,
|
|
836
|
+
void 0,
|
|
837
|
+
options
|
|
838
|
+
);
|
|
839
|
+
}
|
|
813
840
|
/** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. */
|
|
814
841
|
async uncancel(params, options) {
|
|
815
842
|
const { id } = params;
|
|
@@ -823,7 +850,7 @@ var SubscriptionsResource = class {
|
|
|
823
850
|
async list(params, options) {
|
|
824
851
|
return this.httpClient.get("/subscriptions", params, options);
|
|
825
852
|
}
|
|
826
|
-
/** 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. */
|
|
853
|
+
/** 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. */
|
|
827
854
|
async create(params, options) {
|
|
828
855
|
return this.httpClient.post("/subscriptions", params, options);
|
|
829
856
|
}
|
|
@@ -1070,7 +1097,7 @@ var CommetValidationError = class extends CommetAPIError {
|
|
|
1070
1097
|
|
|
1071
1098
|
// src/version.ts
|
|
1072
1099
|
var API_VERSION = "2026-08-27";
|
|
1073
|
-
var SDK_VERSION = "9.
|
|
1100
|
+
var SDK_VERSION = "9.9.0";
|
|
1074
1101
|
|
|
1075
1102
|
// src/utils/telemetry.ts
|
|
1076
1103
|
var registeredIntegrations = /* @__PURE__ */ new Set();
|