@commet/node 9.11.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.
@@ -47,7 +47,7 @@ Update a feature's name, description, or unit name. At least one field must be p
47
47
 
48
48
  `DELETE /features/{code}` · operation `delete-feature`
49
49
 
50
- Delete a feature. Fails if the feature is attached to active plans or has an active add-on.
50
+ 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.
51
51
 
52
52
  ### Parameters
53
53
 
@@ -25,12 +25,13 @@ Deactivate an add-on from a subscription.
25
25
 
26
26
  `POST /subscriptions/{id}/addons` · operation `activate-addon`
27
27
 
28
- 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.
28
+ 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.
29
29
 
30
30
  ### Parameters
31
31
 
32
32
  - `id` (`string`, required)
33
33
  - `addonId` (`string`, required)
34
+ - `successUrl` (`string`, optional) — Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way.
34
35
 
35
36
  ### Request options
36
37
 
@@ -110,12 +111,13 @@ Adjust a subscription's balance or credits by a signed amount. Positive adds, ne
110
111
 
111
112
  `POST /subscriptions/{id}/balance/topup` · operation `topup-balance`
112
113
 
113
- 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.
114
+ 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.
114
115
 
115
116
  ### Parameters
116
117
 
117
118
  - `id` (`string`, required)
118
119
  - `amount` (`number`, required) — The amount to add, in minor units of the subscription currency (cents; whole units for zero-decimal currencies).
120
+ - `successUrl` (`string`, optional) — Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way.
119
121
 
120
122
  ### Request options
121
123
 
@@ -205,13 +207,14 @@ Move a subscription to a newer published version of its plan, now or at the end
205
207
 
206
208
  `POST /subscriptions/{id}/credits` · operation `purchase-credits`
207
209
 
208
- 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.
210
+ 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.
209
211
 
210
212
  ### Parameters
211
213
 
212
214
  - `id` (`string`, required)
213
215
  - `creditPackId` (`string`, optional)
214
216
  - `quantity` (`number`, optional)
217
+ - `successUrl` (`string`, optional) — Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way.
215
218
 
216
219
  ### Valid parameter combinations
217
220
 
@@ -402,7 +405,7 @@ Preview proration details for an immediate plan change without applying it. Free
402
405
 
403
406
  `POST /subscriptions/{id}/reactivate` · operation `reactivate-subscription`
404
407
 
405
- 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.
408
+ 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.
406
409
 
407
410
  ### Parameters
408
411
 
@@ -574,7 +577,7 @@ Create a subscription for a customer. Commet selects the default price when pric
574
577
  - `priceId` (`string`, optional) — Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing.
575
578
  - `initialSeats` (`Record<string, number>`, optional)
576
579
  - `provider` (`"stripe" | "commet" | "dlocal" | string`, optional) — Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present.
577
- - `paymentMethodTypes` (`Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">`, optional) — Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments.
580
+ - `paymentMethodTypes` (`Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">`, optional) — Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments.
578
581
  - `name` (`string`, optional)
579
582
  - `startDate` (`string`, optional)
580
583
  - `successUrl` (`string`, optional)
@@ -109,6 +109,17 @@ Every current API error includes a stable `code` and a version-matched `doc_url`
109
109
 
110
110
  Keep the `x-request-id` response header when logging or reporting an error. Commet records the same identifier in Platform, allowing the request to be correlated without including credentials or customer data.
111
111
 
112
+ ## Rate Limits
113
+
114
+ Each API key, and each person connected through OAuth, has two limits over a sliding 10-second window. Every request counts toward exactly one of them, so a burst of usage checks never uses up the room your other calls need.
115
+
116
+ | Limit | Routes |
117
+ | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
118
+ | 1,000 requests per 10 seconds | `POST /v1/usage/events`, `POST /v1/usage/check`, `GET /v1/feature-access`, `GET /v1/feature-access/{code}`, `GET /v1/features/{code}`, `GET /v1/active-addons`, `GET /v1/addons/active`, `GET /v1/seats/balance`, `GET /v1/seats/balances`, `GET /v1/subscriptions/active`, `GET /v1/subscriptions/{id}` |
119
+ | 300 requests per 10 seconds | Every other route |
120
+
121
+ Every authenticated response carries `RateLimit-Limit`, the limit of the route you called, and `RateLimit-Remaining`. Above the limit the API answers `429` with the code [`rate_limited`](/docs/api-reference/errors/rate_limited.md), plus `RateLimit-Reset` and `Retry-After` in seconds.
122
+
112
123
  ## Automatic Retries
113
124
 
114
125
  Failed requests retry with exponential backoff (1s → 2s → 4s, max 8s).
@@ -83,6 +83,8 @@ await commet.subscriptions.deactivateAddon({
83
83
  })
84
84
  ```
85
85
 
86
+ Without a saved payment method, activation returns `400`. Send `successUrl` to receive a `status` of `requires_checkout` and a `checkoutUrl` instead: the customer pays the activation there and saves the payment method in one step, and the add-on is active when the payment is confirmed. An activation with nothing to charge opens no checkout.
87
+
86
88
  REST equivalents: `POST /api/v1/subscriptions/{id}/addons` and `DELETE /api/v1/subscriptions/{id}/addons/{addonId}`. Add-ons themselves support full CRUD through the `addons` resource: `commet.addons.list`, `get`, `create`, `update`, and `delete`.
87
89
 
88
90
  ## Feature access
@@ -161,6 +161,8 @@ $balanceTopup = $commet->subscriptions->topupBalance(
161
161
 
162
162
  A top-up creates its invoice and charges the payment method attached to the subscription. The balance is added once the payment is confirmed: the response's `status` is `succeeded`, or `processing` when the payment method confirms later, such as Pix. A declined payment adds nothing and voids the invoice. Customers can also buy balance from the [Customer Portal](/docs/customer-portal).
163
163
 
164
+ Without a saved payment method, the request returns `402`. Send `successUrl` to receive a `status` of `requires_checkout` and a `checkoutUrl` instead: the customer pays the top-up there and saves the payment method in one step, and the balance is added when the payment is confirmed. Don't send the top-up again after the customer returns.
165
+
164
166
  ## Enforce before spending
165
167
 
166
168
  Check usage before work that should not run with insufficient balance, then track only completed work. Use a stable idempotency key so a retry does not deduct twice.
@@ -55,7 +55,15 @@ Month 1: 800 unused → 800 + 1,000 = 1,800
55
55
  Month 2: 1,800 unused → 2,800, capped at 2,500. 300 expire.
56
56
  ```
57
57
 
58
- `{ type: 'expire' }` restores the default. Changing it publishes a new [plan version](/docs/plan-versions); each subscription keeps its version's setting until you move it. A plan change applies the new plan's setting.
58
+ `{ type: 'expire' }` restores the default. Changing it publishes a new [plan version](/docs/plan-versions); each subscription keeps its version's setting until you move it.
59
+
60
+ A plan change applies the new plan's setting to the credits the customer holds. An immediate change cuts the current period short, so the credits the previous plan gave for that period do not pass: only what the customer holds above that allocation carries over, and the new plan adds its own. A change applied at the end of the period carries every unused plan credit.
61
+
62
+ ```
63
+ Pro grants 240 credits per month. The customer holds 400 and upgrades today to Studio, which grants 1,000 and rolls over.
64
+
65
+ 400 − 240 = 160 carried → 160 + 1,000 = 1,160
66
+ ```
59
67
 
60
68
  ### Limit plan credit spending
61
69
 
@@ -102,12 +102,30 @@ await commet.subscriptions.purchaseCredits({
102
102
 
103
103
  Commet creates the purchase invoice, charges the saved payment method at the price per credit of the subscription's plan version and adds the purchased credits once the payment is confirmed. Send `creditPackId` instead of `quantity` to buy a pack. The response's `status` is `succeeded` when the credits were added, or `processing` when the payment method confirms later, such as Pix: the credits are added and [`credits.purchased`](/docs/webhooks/credits-purchased) fires when the payment is confirmed. A declined payment adds nothing and voids the invoice.
104
104
 
105
- | Response | Cause |
106
- | ----------------------------- | -------------------------------------------------------------------------- |
107
- | `400 validation_error` | The quantity is below the plan's minimum, or the plan doesn't sell credits |
108
- | `402 no_payment_method` | The subscription has no saved payment method Commet can charge |
109
- | `402 payment_failed` | The charge was declined |
110
- | `409 credit_pack_unavailable` | The subscription's plan version doesn't sell the pack |
105
+ | Response | Cause |
106
+ | ----------------------------- | --------------------------------------------------------------------------------------------------- |
107
+ | `400 validation_error` | The quantity is below the plan's minimum, or the plan doesn't sell credits |
108
+ | `402 no_payment_method` | The subscription has no saved payment method Commet can charge, and the request has no `successUrl` |
109
+ | `402 payment_failed` | The charge was declined |
110
+ | `409 credit_pack_unavailable` | The subscription's plan version doesn't sell the pack |
111
+
112
+ ### Customers without a saved payment method
113
+
114
+ Send `successUrl` to let a customer without a saved payment method buy a quantity or a pack. The response's `status` is `requires_checkout`, with a `checkoutUrl` where the customer pays the purchase and saves the payment method in one step:
115
+
116
+ ```typescript
117
+ const purchase = await commet.subscriptions.purchaseCredits({
118
+ id: 'sub_xxx',
119
+ quantity: 500,
120
+ successUrl: 'https://your-app.com/credits',
121
+ })
122
+
123
+ if (purchase.status === 'requires_checkout') {
124
+ redirect(purchase.checkoutUrl)
125
+ }
126
+ ```
127
+
128
+ Nothing is charged until the customer pays. The credits are added and [`credits.purchased`](/docs/webhooks/credits-purchased) fires when the payment is confirmed, so don't send the purchase again after the customer returns. An unpaid checkout expires after 24 hours and leaves nothing owed. A subscription with a saved payment method is charged directly, and a declined charge returns `402` with or without `successUrl`.
111
129
 
112
130
  The effective minimum is the larger of the configured minimum and the smallest quantity that reaches the currency's minimum charge.
113
131
 
@@ -55,7 +55,7 @@ await commet.subscriptions.applyOffer({
55
55
 
56
56
  Only one Offer applies at a time: while an accepted Offer still has active or upcoming discount phases, a new application is rejected. Once its phases are exhausted, the subscription accepts a new Offer. The discount applies to the plan base price only.
57
57
 
58
- The applied Offer belongs to that subscription and plan: it ends with a cancellation and a plan change removes it.
58
+ The applied Offer belongs to that subscription: it ends with a cancellation, and it [keeps going through a plan change](/docs/how-do-discounts-work#plan-changes) with the cycles it had left.
59
59
 
60
60
  The same operation on a subscription with a pending checkout quotes or replaces the checkout discount instead; there it accepts an optional `expiresAt` for the quote. When the price has a trial, the discount starts after it.
61
61
 
@@ -18,18 +18,30 @@ The subscription keeps its immutable base-plan contract. The grant pins an immut
18
18
 
19
19
  When the grant ends, Commet immediately evaluates access against the base subscription again. Existing seats and recorded usage are not deleted. If the customer is already above a base-plan hard limit, further use is blocked until usage resets, capacity falls below the limit, or the subscription is upgraded normally.
20
20
 
21
+ ## Credits and Balance plans
22
+
23
+ On a Credits or Balance plan, the target plan's terms for plan credits or plan balance apply while the grant lasts: the amount included each period, unused credits or balance carried over and their cap, the daily or weekly limit, and unlimited plan credits or balance. What each unit consumes stays the base plan's: credits per unit, the balance price per unit and AI model margins. A feature only the target plan has uses the target plan's.
24
+
25
+ - When the grant starts, the plan credits or plan balance grow at once by the difference between both included amounts. A Free subscription with 50 of its 93 monthly credits left that is granted Pro, which includes 240, holds 197.
26
+ - Each renewal while the grant is active adds the target plan's included amount with the target plan's carry-over rules.
27
+ - When the grant is revoked or expires mid-period, the plan part goes down by the same difference, without going below zero or removing debt, and the base plan's limit applies again. The next renewal gives the base plan's amount. A grant that ends exactly at a renewal leaves that renewal on the base plan's amount.
28
+ - Purchased credits and balance top-ups keep being sold and charged by the base subscription's plan.
29
+
30
+ A subscription on a plan without a consumption model can be granted a Credits or Balance plan. It consumes the target plan's credits or balance while the grant lasts, and when the grant ends it can no longer use those features.
31
+
21
32
  ## Eligibility
22
33
 
23
34
  The base subscription must be active and recurring. The target plan must belong to the same Plan Group and have a higher `sortOrder` than the base plan.
24
35
 
25
- The initial release supports metered plans with boolean features and hard-capped usage, quota, or seat limits. Commet rejects a grant when either plan uses:
36
+ Grants work on Metered, Credits and Balance plans. Both plans must use the same consumption model, with two exceptions: a plan without a consumption model can be granted a plan of any model, and a Metered plan and a plan without a consumption model can be combined either way. Commet rejects a grant when:
26
37
 
27
- - Credits or Balance consumption;
28
- - paid overage;
29
- - AI model pricing; or
30
- - active subscription add-ons.
38
+ - the base and target plans use different consumption models other than those exceptions;
39
+ - either plan bills paid overage: Metered overage or AI model pricing on a Metered plan, or Credits or Balance that can go negative;
40
+ - the subscription has active add-ons;
41
+ - a Credits or Balance target plan does not sell the subscription's billing interval; or
42
+ - a Balance target plan does not sell the subscription's country and currency, or does not price in that country a usage feature the base plan lacks.
31
43
 
32
- The target plan may itself be free or paid. Its prices and billing intervals are irrelevant because the grant does not use them.
44
+ The target plan may itself be free or paid. It never charges anything: on a Credits or Balance plan, Commet only reads the amount included by its price for the subscription's billing interval.
33
45
 
34
46
  ## Choose a duration
35
47
 
@@ -93,6 +105,10 @@ curl -X POST https://commet.co/api/v1/customers/cus_xxx/plan-grants/grt_xxx/revo
93
105
 
94
106
  Revocation does not create a full-price obligation, re-anchor the subscription, or move it to `pending_payment`.
95
107
 
108
+ ## Change plan during a grant
109
+
110
+ A subscription with an active grant can change plan or billing interval. When the change applies, Commet revokes the grant with source `system` and sends `plan_grant.revoked`. On a Credits or Balance plan, the plan part first goes down by the grant's difference, as on any revocation, and then the change gives the new plan's amounts with its carry-over rules.
111
+
96
112
  ## Plan Grants, Offers, trials, and Invoice Credit
97
113
 
98
114
  | Need | Use |
@@ -40,7 +40,25 @@ Trials are not Offer phases. When the price has a [trial](/docs/trial-periods),
40
40
 
41
41
  ## Plan changes
42
42
 
43
- The Offer Application belongs to the price target accepted by the subscription. An immediate plan change ends that application. The change may pass a new `offerId` or a `promoCode`; otherwise the new plan begins at its normal price. Scheduled plan changes accept neither.
43
+ A discount belongs to the subscription, not to the plan. When the customer changes to another paid plan or billing interval, the same Offer Application keeps going on the new plan with the billing periods it still had to discount. The charge for the change is the next of those periods, so no cycle is added and none is lost. A discount without an end keeps applying.
44
+
45
+ ```
46
+ Starter costs $20/month with 50% off for 3 cycles.
47
+ The customer pays cycle 1 and upgrades to Pro ($40/month):
48
+
49
+ Change to Pro: $20.00 (cycle 2), minus the credit for unused Starter time
50
+ Next renewal: $20.00 (cycle 3)
51
+ Renewal after: $40.00
52
+ ```
53
+
54
+ - A percentage is the same percentage of the new price. An amount off is the same amount.
55
+ - A `fixed_price` phase, free cycles included, is the price of the plan it was accepted on: it ends with the change, and the other phases of the Offer continue.
56
+ - When the billing interval changes, the discount keeps the time it had left. With two monthly cycles left, a yearly charge made within those two months is discounted in full and the next yearly renewal is not.
57
+ - A Promo Code or Card Promotion restricted to plans or to a billing interval ends with the change when the new plan or interval is outside its restriction.
58
+ - A change that passes its own `offerId` or `promoCode` applies that Offer with its full duration and ends the previous one. Scheduled plan changes accept neither.
59
+ - A move to a free plan ends the discount.
60
+
61
+ Plan-change previews and the Customer Portal quote the new plan with the discount the change will charge.
44
62
 
45
63
  ## What gets discounted
46
64
 
package/docs/schemas.md CHANGED
@@ -47,6 +47,8 @@ Generated from Commet API version `2026-08-27`.
47
47
  - `"mercado_pago"`
48
48
  - `"google_pay"`
49
49
  - `"smartpix"`
50
+ - `"apple_pay"`
51
+ - `"link"`
50
52
 
51
53
  ### PaymentProvider
52
54
 
@@ -166,7 +168,8 @@ Generated from Commet API version `2026-08-27`.
166
168
  ### BalanceTopup
167
169
 
168
170
  - `amount` (`number`, required)
169
- - `status` (`"succeeded" | "processing"`, required) — `succeeded` when the payment was confirmed and the balance was added. `processing` when the payment method confirms later: the balance is added once the payment is confirmed, and nothing is added if it is declined.
171
+ - `status` (`"succeeded" | "processing" | "requires_checkout"`, required) — `succeeded` when the payment was confirmed and the balance was added. `processing` when the payment method confirms later: the balance is added once the payment is confirmed, and nothing is added if it is declined. `requires_checkout` when the subscription has no saved payment method and `successUrl` was sent: the balance is added once the customer pays at `checkoutUrl`.
172
+ - `checkoutUrl` (`string`, optional) — Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`.
170
173
  - `object` (`"balance_topup"`, required)
171
174
  - `livemode` (`boolean`, required)
172
175
 
@@ -240,7 +243,8 @@ Generated from Commet API version `2026-08-27`.
240
243
  ### CreditGrant
241
244
 
242
245
  - `credits` (`number`, required)
243
- - `status` (`"succeeded" | "processing"`, required) — `succeeded` when the payment was confirmed and the credits were added. `processing` when the payment method confirms later: the credits are added once the payment is confirmed, and nothing is added if it is declined.
246
+ - `status` (`"succeeded" | "processing" | "requires_checkout"`, required) — `succeeded` when the payment was confirmed and the credits were added. `processing` when the payment method confirms later: the credits are added once the payment is confirmed, and nothing is added if it is declined. `requires_checkout` when the subscription has no saved payment method and `successUrl` was sent: the credits are added once the customer pays at `checkoutUrl`.
247
+ - `checkoutUrl` (`string`, optional) — Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`.
244
248
  - `object` (`"credit_grant"`, required)
245
249
  - `livemode` (`boolean`, required)
246
250
 
@@ -557,6 +561,7 @@ Variants:
557
561
 
558
562
  Variants:
559
563
 
564
+ - `{ outcome: "processing"; invoiceId: string; object: "plan_change"; livemode: boolean }`
560
565
  - `{ outcome: "requires_checkout"; requiresCheckout: true; checkoutUrl: string; offerApplication?: { id: string; offerId: string; name: string; currency: string; subtotal: number; discountAmount: number; total: number; phases: Array<{ type: "free_trial"; durationDays: number; startsAt: string | null; endsAt: string | null } | { type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; amount: number } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; price: number }>; appliesTo: { type: "plan_price"; id: string } | { type: "addon"; id: string } | { type: "credit_pack"; id: string } }; object: "plan_change"; livemode: boolean }`
561
566
  - `{ outcome: "scheduled"; id: string; scheduled: true; scheduledFor: string; changeType: "subscription.plan_downgrade" | "subscription.interval_change" | "subscription.cancel"; customerId: string; newPlanId?: string; newPlanName?: string; newBillingInterval?: string; seatLimitWarning?: { featureCode: string; featureName: string; currentSeats: number; included: number; newPlanName: string; effectiveDate: string }; object: "plan_change"; livemode: boolean }`
562
567
  - `{ outcome: "completed"; id: string; scheduled: false; customerId: string; previousPlan: { id: string; name: string }; currentPlan: { id: string; name: string; price: number }; billingInterval: string; billing: { credit: number; creditsApplied: number; charge: number; taxAmount: number; netAmount: number; totalCharged: number; remainingCreditBalance: number }; invoiceId?: string; offerApplication?: { id: string; offerId: string; name: string; currency: string; subtotal: number; discountAmount: number; total: number; phases: Array<{ type: "free_trial"; durationDays: number; startsAt: string | null; endsAt: string | null } | { type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; amount: number } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; price: number }>; appliesTo: { type: "plan_price"; id: string } | { type: "addon"; id: string } | { type: "credit_pack"; id: string } }; object: "plan_change"; livemode: boolean }`
@@ -910,8 +915,9 @@ Variants:
910
915
  ### SubscriptionAddon
911
916
 
912
917
  - `addonId` (`string`, required)
913
- - `status` (`"active" | "processing"`, required) — `active` when the add-on is active. `processing` when the payment method confirms later: the add-on is activated once the payment is confirmed, and stays inactive if it is declined.
918
+ - `status` (`"active" | "processing" | "requires_checkout"`, required) — `active` when the add-on is active. `processing` when the payment method confirms later: the add-on is activated once the payment is confirmed, and stays inactive if it is declined. `requires_checkout` when the subscription has no saved payment method and `successUrl` was sent: the add-on is activated once the customer pays at `checkoutUrl`.
914
919
  - `proratedCharge` (`number`, required)
920
+ - `checkoutUrl` (`string`, optional) — Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`.
915
921
  - `object` (`"subscription_addon"`, required)
916
922
  - `livemode` (`boolean`, required)
917
923
 
@@ -1027,7 +1033,7 @@ Variants:
1027
1033
  - `amountRefunded` (`number`, required) — Cumulative confirmed refunds in the payment currency’s smallest unit.
1028
1034
  - `currency` (`string`, required)
1029
1035
  - `provider` (`PaymentProvider`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
1030
- - `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card, oxxo, or mercado_pago. Null when unknown.
1036
+ - `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
1031
1037
  - `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
1032
1038
  - `status` (`TransactionStatus`, required)
1033
1039
  - `customerEmail` (`string | null`, required)
@@ -1051,7 +1057,7 @@ Variants:
1051
1057
  - `amountRefunded` (`number`, required) — Cumulative confirmed refunds in the payment currency’s smallest unit.
1052
1058
  - `currency` (`string`, required)
1053
1059
  - `provider` (`PaymentProvider`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
1054
- - `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card, oxxo, or mercado_pago. Null when unknown.
1060
+ - `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
1055
1061
  - `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
1056
1062
  - `status` (`TransactionStatus`, required)
1057
1063
  - `customerEmail` (`string | null`, required)
package/docs/webhooks.md CHANGED
@@ -38,7 +38,7 @@ Fired once, when the subscription's first charge succeeds and it becomes active
38
38
 
39
39
  ## subscription.reactivated
40
40
 
41
- Fired when a canceled subscription is reactivated and its reactivation charge succeeds. The subscription returns to active with a fresh invoice and a billing period anchored to the reactivation date. Distinct from subscription.activated (first activation) and payment.recovered (past_due recovery, which keeps the original anchor).
41
+ Fired when a canceled subscription is reactivated: its reactivation charge succeeds, or its reactivation invoice totals zero and is paid without a charge. The subscription returns to active with a fresh invoice and a billing period anchored to the reactivation date. Distinct from subscription.activated (first activation) and payment.recovered (past_due recovery, which keeps the original anchor).
42
42
 
43
43
  ### Data
44
44
 
@@ -52,7 +52,7 @@ Fired when a canceled subscription is reactivated and its reactivation charge su
52
52
  - `invoiceNumber` (`string`, required) — The human-readable invoice number.
53
53
  - `invoiceTotal` (`number`, required) — Invoice total in cents (100 = $1.00).
54
54
  - `invoiceCurrency` (`string`, required) — The invoice currency code.
55
- - `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider that processed the reactivation charge: stripe, commet, or dlocal.
55
+ - `provider` (`"stripe" | "commet" | "dlocal"`, required) — The subscription's payment provider, which processed the reactivation charge: stripe, commet, or dlocal. A reactivation whose invoice totals zero runs no charge and still carries the subscription's provider.
56
56
 
57
57
  ## subscription.pause_scheduled
58
58
 
@@ -297,7 +297,7 @@ Fired when a trial period runs out. With a payment method the billing cycle acti
297
297
 
298
298
  ## trial.will_end
299
299
 
300
- Predictive event fired once, 3 days before a trial ends. Use it to remind the customer that billing starts soon. Emitted by a daily scan with a deterministic idempotency key, so it never fires twice for the same trial end date.
300
+ Predictive event fired once, 3 days before a trial ends. Use it to remind the customer that billing starts soon. Emitted by a recurring scan with a deterministic idempotency key, so it never fires twice for the same trial end date.
301
301
 
302
302
  ### Data
303
303
 
@@ -348,7 +348,7 @@ Fired every time a payment settles successfully — the first payment and every
348
348
  - `subscriptionId` (`string | null`, required) — The subscription ID.
349
349
  - `paymentTransactionId` (`string | null`, required) — The payment transaction ID.
350
350
  - `provider` (`"stripe" | "commet" | "dlocal" | null`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal. Null for billing-only charges with no Commet ledger row.
351
- - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
351
+ - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
352
352
  - `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
353
353
  - `grossAmount` (`number | null`, required) — Gross amount in cents before fees.
354
354
  - `currency` (`string | null`, required) — The payment currency code.
@@ -368,7 +368,7 @@ Fired when an invoice-linked subscription charge fails.
368
368
  - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
369
369
  - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
370
370
  - `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
371
- - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
371
+ - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
372
372
  - `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
373
373
  - `failureCode` (`string`, required) — The failure code from the payment processor.
374
374
  - `failureMessage` (`string`, required) — A human-readable failure message.
@@ -386,7 +386,7 @@ Fired when an outstanding invoice that previously failed is successfully paid
386
386
  - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
387
387
  - `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
388
388
  - `provider` (`"stripe" | "commet" | "dlocal" | null`, required) — The payment provider that recovered the payment, or null when the invoice was recovered without a processor charge.
389
- - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
389
+ - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
390
390
  - `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
391
391
 
392
392
  ## payment.retry_failed
@@ -483,7 +483,7 @@ Fired when a payment link is paid. The charge settled and a one-time invoice was
483
483
  - `invoiceId` (`string`, required) — The one-time invoice generated for this payment.
484
484
  - `invoiceNumber` (`string`, required) — The human-readable invoice number.
485
485
  - `paymentTransactionId` (`string | null`, required) — The payment transaction ID for the settled charge.
486
- - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
486
+ - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
487
487
  - `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
488
488
 
489
489
  ## payment_link.failed
@@ -501,7 +501,7 @@ Fired when a payment link charge attempt is declined. The link stays open and ca
501
501
  - `customerId` (`string | null`, required) — The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
502
502
  - `failureCode` (`string`, required) — The failure code from the payment processor.
503
503
  - `failureMessage` (`string`, required) — A human-readable failure message.
504
- - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
504
+ - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
505
505
  - `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
506
506
 
507
507
  ## payment_link.canceled
@@ -557,7 +557,7 @@ Fired when an invoice is voided — nullified before collection, for example whe
557
557
 
558
558
  ## invoice.overdue
559
559
 
560
- Fired once when an outstanding invoice passes its due date without payment. The invoice keeps its outstanding status — overdue is a fact about the due date, not a new status. Use it to start your own dunning flow.
560
+ Fired once when an invoice is still outstanding 24 hours after its due date. The invoice keeps its outstanding status — overdue is a fact about the due date, not a new status. Use it to start your own dunning flow.
561
561
 
562
562
  ### Data
563
563
 
@@ -576,7 +576,7 @@ Fired once when an outstanding invoice passes its due date without payment. The
576
576
 
577
577
  ## invoice.upcoming
578
578
 
579
- Predictive event fired once, 3 days before an active subscription renews. Use it to notify the customer before they are charged. Carries no amount — usage-based charges are only final at renewal, when invoice.created delivers the actual invoice.
579
+ Predictive event fired once, 3 days before an active subscription renews. A subscription on a free plan issues no renewal invoice and does not fire it. Use it to notify the customer before they are charged. Carries no amount — usage-based charges are only final at renewal, when invoice.created delivers the actual invoice.
580
580
 
581
581
  ### Data
582
582
 
@@ -596,7 +596,7 @@ Fired when Commet records a payment method for a subscription: after a paid chec
596
596
 
597
597
  - `subscriptionId` (`string`, required) — The subscription the payment method was saved for.
598
598
  - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
599
- - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
599
+ - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
600
600
  - `card` (`WebhookCardInfo | null`, required) — Card display metadata: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
601
601
 
602
602
  ## payment_method.updated
@@ -606,7 +606,7 @@ Fired when a customer replaces their default payment method through the customer
606
606
  ### Data
607
607
 
608
608
  - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
609
- - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
609
+ - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
610
610
  - `card` (`WebhookCardInfo | null`, required) — Card display metadata for the new method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
611
611
 
612
612
  ## payment_method.detached
@@ -616,7 +616,7 @@ Fired when a saved payment method is removed from a customer: the customer unlin
616
616
  ### Data
617
617
 
618
618
  - `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
619
- - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, oxxo, or mercado_pago. Null when unknown.
619
+ - `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
620
620
  - `card` (`WebhookCardInfo | null`, required) — Card display metadata of the removed method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
621
621
  - `reason` (`"unlinked_at_provider" | "removed_by_customer"`, required) — Why the method was removed: `unlinked_at_provider` when the customer revoked it at the payment provider, `removed_by_customer` when the customer removed it through the customer portal.
622
622
 
@@ -818,7 +818,7 @@ Fired each time a subscription's available credits cross to zero or below. Usage
818
818
 
819
819
  ## credits.expired
820
820
 
821
- Fired at a reset when unused plan credits are discarded. On a plan whose unused plan credits expire, every unused plan credit expires at each reset. On a plan that rolls them over, a reset keeps them, up to the plan's maxPlanCredits when it has one, and only the excess expires. A change to another credits plan applies the new plan's terms the same way. Purchased credits never expire and are not affected.
821
+ Fired at a reset when unused plan credits are discarded. On a plan whose unused plan credits expire, every unused plan credit expires at each reset. On a plan that rolls them over, a reset keeps them, up to the plan's maxPlanCredits when it has one, and only the excess expires. A change to another credits plan applies the new plan's terms the same way, and an immediate change also discards the credits the previous plan gave for the period it cuts short. Purchased credits never expire and are not affected.
822
822
 
823
823
  ### Data
824
824