@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/docs/schemas.md CHANGED
@@ -168,7 +168,7 @@ Generated from Commet API version `2026-08-27`.
168
168
  ### BalanceTopup
169
169
 
170
170
  - `amount` (`number`, required)
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`.
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 `successUrl` was sent and the subscription has no saved payment method or the saved one was declined: the balance is added once the customer pays at `checkoutUrl`.
172
172
  - `checkoutUrl` (`string`, optional) — Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`.
173
173
  - `object` (`"balance_topup"`, required)
174
174
  - `livemode` (`boolean`, required)
@@ -243,7 +243,7 @@ Generated from Commet API version `2026-08-27`.
243
243
  ### CreditGrant
244
244
 
245
245
  - `credits` (`number`, required)
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`.
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 `successUrl` was sent and the subscription has no saved payment method or the saved one was declined: the credits are added once the customer pays at `checkoutUrl`.
247
247
  - `checkoutUrl` (`string`, optional) — Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`.
248
248
  - `object` (`"credit_grant"`, required)
249
249
  - `livemode` (`boolean`, required)
@@ -465,6 +465,8 @@ Variants:
465
465
  - `startsAt` (`string | null`, required)
466
466
  - `endsAt` (`string | null`, required)
467
467
  - `active` (`boolean`, required)
468
+ - `planIds` (`Array<string>`, required) — Plans the offer is limited to. Empty when it applies to any plan.
469
+ - `billingInterval` (`"weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null`, required) — Billing interval the offer is limited to. Null when it applies to any interval.
468
470
  - `managedBy` (`ManagedBy`, required) — Integration that manages this record, or null when the merchant does. While an integration manages it, its terms change only in that integration and edits answer 409 managed_by_integration.
469
471
  - `createdAt` (`string`, required)
470
472
  - `updatedAt` (`string`, required)
@@ -561,10 +563,10 @@ Variants:
561
563
 
562
564
  Variants:
563
565
 
564
- - `{ outcome: "processing"; invoiceId: string; object: "plan_change"; livemode: boolean }`
565
566
  - `{ 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 }`
566
567
  - `{ 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 }`
567
568
  - `{ 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 }`
569
+ - `{ outcome: "processing"; invoiceId: string; object: "plan_change"; livemode: boolean }`
568
570
 
569
571
  ### PlanDraft
570
572
 
@@ -915,7 +917,7 @@ Variants:
915
917
  ### SubscriptionAddon
916
918
 
917
919
  - `addonId` (`string`, required)
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`.
920
+ - `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 `successUrl` was sent and the subscription has no saved payment method or the saved one was declined: the add-on is activated once the customer pays at `checkoutUrl`.
919
921
  - `proratedCharge` (`number`, required)
920
922
  - `checkoutUrl` (`string`, optional) — Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`.
921
923
  - `object` (`"subscription_addon"`, required)
package/docs/webhooks.md CHANGED
@@ -167,6 +167,7 @@ Fired when a subscription changes from one plan to another, including upgrades,
167
167
  - `credit` (`number`, required) — Prorated credit in cents from the previous plan.
168
168
  - `charge` (`number`, required) — Prorated charge in cents for the new plan.
169
169
  - `totalCharged` (`number`, required) — Total amount charged in cents.
170
+ - `cancelReason` (`string | null`, required) — The cancellation reason when a cancellation moved the subscription to its group's default plan instead of ending it. Null for any other plan change.
170
171
 
171
172
  ## subscription.cancellation_scheduled
172
173
 
@@ -206,6 +207,7 @@ Fired when a plan change (downgrade or shorter interval) is scheduled for the en
206
207
  - `billingInterval` (`string | null`, required) — The current billing interval.
207
208
  - `scheduledBillingInterval` (`string | null`, required) — The new billing interval, if the change includes one. Null when only the plan changes.
208
209
  - `effectiveAt` (`string`, required) — ISO 8601 datetime when the change executes (the billing period end).
210
+ - `cancelReason` (`string | null`, required) — The cancellation reason when a cancellation scheduled the move to the group's default plan instead of ending the subscription. Null for any other scheduled change.
209
211
 
210
212
  ## subscription.plan_change_revoked
211
213
 
@@ -1532,6 +1532,13 @@
1532
1532
  "totalCharged": {
1533
1533
  "type": "number",
1534
1534
  "description": "Total amount charged in cents."
1535
+ },
1536
+ "cancelReason": {
1537
+ "description": "The cancellation reason when a cancellation moved the subscription to its group's default plan instead of ending it. Null for any other plan change.",
1538
+ "type": [
1539
+ "string",
1540
+ "null"
1541
+ ]
1535
1542
  }
1536
1543
  },
1537
1544
  "required": [
@@ -1542,7 +1549,8 @@
1542
1549
  "billingInterval",
1543
1550
  "credit",
1544
1551
  "charge",
1545
- "totalCharged"
1552
+ "totalCharged",
1553
+ "cancelReason"
1546
1554
  ],
1547
1555
  "additionalProperties": false
1548
1556
  }
@@ -1578,7 +1586,8 @@
1578
1586
  "billingInterval": "monthly",
1579
1587
  "credit": 1500,
1580
1588
  "charge": 4900,
1581
- "totalCharged": 3400
1589
+ "totalCharged": 3400,
1590
+ "cancelReason": null
1582
1591
  }
1583
1592
  }
1584
1593
  }
@@ -1908,6 +1917,13 @@
1908
1917
  "effectiveAt": {
1909
1918
  "type": "string",
1910
1919
  "description": "ISO 8601 datetime when the change executes (the billing period end)."
1920
+ },
1921
+ "cancelReason": {
1922
+ "description": "The cancellation reason when a cancellation scheduled the move to the group's default plan instead of ending the subscription. Null for any other scheduled change.",
1923
+ "type": [
1924
+ "string",
1925
+ "null"
1926
+ ]
1911
1927
  }
1912
1928
  },
1913
1929
  "required": [
@@ -1918,7 +1934,8 @@
1918
1934
  "scheduledPlan",
1919
1935
  "billingInterval",
1920
1936
  "scheduledBillingInterval",
1921
- "effectiveAt"
1937
+ "effectiveAt",
1938
+ "cancelReason"
1922
1939
  ],
1923
1940
  "additionalProperties": false
1924
1941
  }
@@ -1954,7 +1971,8 @@
1954
1971
  },
1955
1972
  "billingInterval": "monthly",
1956
1973
  "scheduledBillingInterval": null,
1957
- "effectiveAt": "2026-04-25T00:00:00.000Z"
1974
+ "effectiveAt": "2026-04-25T00:00:00.000Z",
1975
+ "cancelReason": null
1958
1976
  }
1959
1977
  }
1960
1978
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commet/node",
3
- "version": "9.12.0",
3
+ "version": "9.13.0",
4
4
  "description": "Commet SDK for Node.js - Billing and usage tracking",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",