@commet/node 8.0.1 → 9.1.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 (294) hide show
  1. package/README.md +4 -4
  2. package/dist/index.d.mts +514 -206
  3. package/dist/index.d.ts +514 -206
  4. package/dist/index.js +202 -88
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +202 -88
  7. package/dist/index.mjs.map +1 -1
  8. package/docs/README.md +20 -0
  9. package/docs/ai-onboarding/ai-onboarding.md +90 -0
  10. package/docs/ai-onboarding/billing-best-practices-skill.md +29 -0
  11. package/docs/ai-onboarding/commet-skill.md +58 -0
  12. package/docs/ai-onboarding/mcp-server.md +207 -0
  13. package/docs/ai-onboarding/meta.json +17 -0
  14. package/docs/ai-onboarding/pricing-models-skill.md +29 -0
  15. package/docs/ai-onboarding/subscription-patterns-skill.md +29 -0
  16. package/docs/api-reference/addons.md +127 -0
  17. package/docs/api-reference/api-keys.md +57 -0
  18. package/docs/api-reference/credit-packs.md +80 -0
  19. package/docs/api-reference/customers.md +274 -0
  20. package/docs/api-reference/feature-access.md +36 -0
  21. package/docs/api-reference/features.md +94 -0
  22. package/docs/api-reference/generated-webhooks.md +120 -0
  23. package/docs/api-reference/index.md +31 -0
  24. package/docs/api-reference/invoices.md +123 -0
  25. package/docs/api-reference/markets.md +92 -0
  26. package/docs/api-reference/meta.json +7 -0
  27. package/docs/api-reference/offers.md +104 -0
  28. package/docs/api-reference/payments.md +106 -0
  29. package/docs/api-reference/payouts.md +66 -0
  30. package/docs/api-reference/plan-groups.md +157 -0
  31. package/docs/api-reference/plans.md +358 -0
  32. package/docs/api-reference/portal.md +30 -0
  33. package/docs/api-reference/promo-codes.md +86 -0
  34. package/docs/api-reference/provisioning.md +19 -0
  35. package/docs/api-reference/quota.md +120 -0
  36. package/docs/api-reference/seats.md +123 -0
  37. package/docs/api-reference/subscriptions.md +387 -0
  38. package/docs/api-reference/test-clock.md +59 -0
  39. package/docs/api-reference/transactions.md +78 -0
  40. package/docs/api-reference/usage.md +83 -0
  41. package/docs/documentation/api-versioning.md +100 -0
  42. package/docs/documentation/better-auth.md +361 -0
  43. package/docs/documentation/choose-a-billing-model.md +38 -0
  44. package/docs/documentation/cli.md +1024 -0
  45. package/docs/documentation/create-api-key.md +47 -0
  46. package/docs/documentation/customers/customer-credits.md +48 -0
  47. package/docs/documentation/customers/customer-portal.md +107 -0
  48. package/docs/documentation/customers/manage-customers.md +346 -0
  49. package/docs/documentation/customers/meta.json +5 -0
  50. package/docs/documentation/error-handling.md +239 -0
  51. package/docs/documentation/examples.md +37 -0
  52. package/docs/documentation/finance/acceptable-use.md +145 -0
  53. package/docs/documentation/finance/finance-overview.md +32 -0
  54. package/docs/documentation/finance/local-currency-taxes.md +40 -0
  55. package/docs/documentation/finance/merchant-of-record.md +48 -0
  56. package/docs/documentation/finance/meta.json +13 -0
  57. package/docs/documentation/finance/payouts-verification.md +186 -0
  58. package/docs/documentation/finance/payouts.md +41 -0
  59. package/docs/documentation/finance/supported-countries.md +28 -0
  60. package/docs/documentation/go/integrate-with-encore.md +229 -0
  61. package/docs/documentation/go/integrate-with-go.md +258 -0
  62. package/docs/documentation/go/meta.json +5 -0
  63. package/docs/documentation/introduction.md +58 -0
  64. package/docs/documentation/invoicing/handle-failed-payments.md +283 -0
  65. package/docs/documentation/invoicing/invoices-and-billing-cycles.md +73 -0
  66. package/docs/documentation/invoicing/manage-invoices.md +340 -0
  67. package/docs/documentation/invoicing/meta.json +9 -0
  68. package/docs/documentation/java/integrate-with-java.md +117 -0
  69. package/docs/documentation/java/meta.json +5 -0
  70. package/docs/documentation/meta.json +36 -0
  71. package/docs/documentation/nodejs/integrate-with-astro.md +129 -0
  72. package/docs/documentation/nodejs/integrate-with-bun.md +113 -0
  73. package/docs/documentation/nodejs/integrate-with-express.md +127 -0
  74. package/docs/documentation/nodejs/integrate-with-hono.md +141 -0
  75. package/docs/documentation/nodejs/integrate-with-nextjs.md +118 -0
  76. package/docs/documentation/nodejs/integrate-with-nuxt.md +125 -0
  77. package/docs/documentation/nodejs/integrate-with-remix.md +136 -0
  78. package/docs/documentation/nodejs/integrate-with-sveltekit.md +127 -0
  79. package/docs/documentation/nodejs/meta.json +14 -0
  80. package/docs/documentation/payments/accept-one-time-payments.md +314 -0
  81. package/docs/documentation/payments/meta.json +10 -0
  82. package/docs/documentation/payments/payment-orchestration.md +43 -0
  83. package/docs/documentation/payments/payment-providers.md +59 -0
  84. package/docs/documentation/payments/transactions-refunds-and-retries.md +199 -0
  85. package/docs/documentation/php/integrate-with-laravel.md +222 -0
  86. package/docs/documentation/php/integrate-with-php.md +103 -0
  87. package/docs/documentation/php/integrate-with-symfony.md +214 -0
  88. package/docs/documentation/php/meta.json +9 -0
  89. package/docs/documentation/plans/add-ons.md +257 -0
  90. package/docs/documentation/plans/balance-and-top-ups.md +169 -0
  91. package/docs/documentation/plans/configure-features.md +335 -0
  92. package/docs/documentation/plans/consumption-models.md +93 -0
  93. package/docs/documentation/plans/create-plans.md +162 -0
  94. package/docs/documentation/plans/credit-packs.md +89 -0
  95. package/docs/documentation/plans/meta.json +14 -0
  96. package/docs/documentation/plans/one-time-payments.md +142 -0
  97. package/docs/documentation/plans/plan-groups.md +31 -0
  98. package/docs/documentation/platform/custom-domains.md +27 -0
  99. package/docs/documentation/platform/dashboard-metrics-and-events.md +25 -0
  100. package/docs/documentation/platform/members-and-permissions.md +21 -0
  101. package/docs/documentation/platform/meta.json +10 -0
  102. package/docs/documentation/platform/organization-settings.md +29 -0
  103. package/docs/documentation/python/integrate-with-django.md +161 -0
  104. package/docs/documentation/python/integrate-with-fastapi.md +164 -0
  105. package/docs/documentation/python/integrate-with-flask.md +153 -0
  106. package/docs/documentation/python/integrate-with-python.md +90 -0
  107. package/docs/documentation/python/meta.json +10 -0
  108. package/docs/documentation/sales/card-promotions.md +41 -0
  109. package/docs/documentation/sales/introductory-offers.md +64 -0
  110. package/docs/documentation/sales/meta.json +13 -0
  111. package/docs/documentation/sales/offers.md +65 -0
  112. package/docs/documentation/sales/promo-codes.md +65 -0
  113. package/docs/documentation/sales/promotional-offers.md +58 -0
  114. package/docs/documentation/sales/regional-prices.md +100 -0
  115. package/docs/documentation/sales/trial-periods.md +88 -0
  116. package/docs/documentation/sdk-reference.md +68 -0
  117. package/docs/documentation/subscriptions/manage-subscriptions.md +505 -0
  118. package/docs/documentation/subscriptions/meta.json +9 -0
  119. package/docs/documentation/subscriptions/plan-grants.md +132 -0
  120. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +35 -0
  121. package/docs/documentation/testing-sandbox.md +251 -0
  122. package/docs/documentation/usage/ai-token-billing.md +294 -0
  123. package/docs/documentation/usage/meta.json +10 -0
  124. package/docs/documentation/usage/quota-management.md +341 -0
  125. package/docs/documentation/usage/seat-management.md +377 -0
  126. package/docs/documentation/usage/track-usage.md +282 -0
  127. package/docs/errors/addon_already_active.md +22 -0
  128. package/docs/errors/addon_has_activations.md +22 -0
  129. package/docs/errors/addon_not_active.md +22 -0
  130. package/docs/errors/addon_not_found.md +22 -0
  131. package/docs/errors/already_has_active_subscription.md +22 -0
  132. package/docs/errors/already_scheduled.md +22 -0
  133. package/docs/errors/api_key_not_found.md +22 -0
  134. package/docs/errors/card_promotions_not_available.md +22 -0
  135. package/docs/errors/charge_failed.md +22 -0
  136. package/docs/errors/charge_in_progress.md +22 -0
  137. package/docs/errors/claim_not_pending.md +22 -0
  138. package/docs/errors/credit_pack_not_found.md +22 -0
  139. package/docs/errors/customer_not_found.md +22 -0
  140. package/docs/errors/duplicate.md +22 -0
  141. package/docs/errors/endpoint_deprecated.md +22 -0
  142. package/docs/errors/endpoint_not_available.md +22 -0
  143. package/docs/errors/feature_already_exists.md +22 -0
  144. package/docs/errors/feature_disabled.md +22 -0
  145. package/docs/errors/feature_in_use.md +22 -0
  146. package/docs/errors/feature_not_found.md +22 -0
  147. package/docs/errors/feature_not_in_plan.md +22 -0
  148. package/docs/errors/forbidden.md +22 -0
  149. package/docs/errors/free_plan_change_not_supported.md +22 -0
  150. package/docs/errors/idempotency_in_progress.md +22 -0
  151. package/docs/errors/idempotency_key_mismatch.md +22 -0
  152. package/docs/errors/idempotency_unavailable.md +22 -0
  153. package/docs/errors/included_limit_reached.md +22 -0
  154. package/docs/errors/index.md +89 -0
  155. package/docs/errors/insufficient_balance.md +22 -0
  156. package/docs/errors/insufficient_credits.md +22 -0
  157. package/docs/errors/insufficient_seats.md +22 -0
  158. package/docs/errors/internal_error.md +22 -0
  159. package/docs/errors/invalid_json.md +22 -0
  160. package/docs/errors/invalid_subscription_status.md +22 -0
  161. package/docs/errors/invoice_not_found.md +22 -0
  162. package/docs/errors/market_group_in_use.md +22 -0
  163. package/docs/errors/market_group_not_found.md +22 -0
  164. package/docs/errors/market_in_use.md +22 -0
  165. package/docs/errors/market_not_found.md +22 -0
  166. package/docs/errors/missing_regional_price.md +22 -0
  167. package/docs/errors/model_not_found.md +22 -0
  168. package/docs/errors/no_active_subscription.md +22 -0
  169. package/docs/errors/no_change_requested.md +22 -0
  170. package/docs/errors/no_outstanding_invoice.md +22 -0
  171. package/docs/errors/no_payment_method.md +22 -0
  172. package/docs/errors/no_prices_configured.md +22 -0
  173. package/docs/errors/not_found.md +22 -0
  174. package/docs/errors/not_scheduled_for_cancellation.md +22 -0
  175. package/docs/errors/offer_not_applicable.md +22 -0
  176. package/docs/errors/offer_not_found.md +22 -0
  177. package/docs/errors/one_time_subscription_not_cancelable.md +22 -0
  178. package/docs/errors/organization_already_claimed.md +22 -0
  179. package/docs/errors/payment_failed.md +22 -0
  180. package/docs/errors/payment_method_not_found.md +22 -0
  181. package/docs/errors/payment_not_cancelable.md +22 -0
  182. package/docs/errors/payment_not_found.md +22 -0
  183. package/docs/errors/payouts_not_available_in_sandbox.md +22 -0
  184. package/docs/errors/plan_change_scheduled.md +22 -0
  185. package/docs/errors/plan_group_not_found.md +22 -0
  186. package/docs/errors/plan_not_found.md +22 -0
  187. package/docs/errors/plan_unavailable.md +22 -0
  188. package/docs/errors/plans_not_in_same_group.md +22 -0
  189. package/docs/errors/price_in_use.md +22 -0
  190. package/docs/errors/price_not_found.md +22 -0
  191. package/docs/errors/pricing_mode_mismatch.md +22 -0
  192. package/docs/errors/promo_code_expired.md +22 -0
  193. package/docs/errors/promo_code_not_found.md +22 -0
  194. package/docs/errors/provider_unsupported.md +22 -0
  195. package/docs/errors/rate_limited.md +22 -0
  196. package/docs/errors/sandbox_only.md +22 -0
  197. package/docs/errors/seat_limit_exceeded.md +22 -0
  198. package/docs/errors/subscription_activation_failed.md +22 -0
  199. package/docs/errors/subscription_already_canceled.md +22 -0
  200. package/docs/errors/subscription_cancel_failed.md +22 -0
  201. package/docs/errors/subscription_creation_failed.md +22 -0
  202. package/docs/errors/subscription_has_open_dispute.md +22 -0
  203. package/docs/errors/subscription_not_active.md +22 -0
  204. package/docs/errors/subscription_not_found.md +22 -0
  205. package/docs/errors/subscription_required.md +22 -0
  206. package/docs/errors/subscription_uncancel_failed.md +22 -0
  207. package/docs/errors/transaction_not_found.md +22 -0
  208. package/docs/errors/unauthorized.md +22 -0
  209. package/docs/errors/validation_error.md +22 -0
  210. package/docs/errors/webhook_not_found.md +22 -0
  211. package/docs/errors.md +34 -0
  212. package/docs/getting-started.md +35 -0
  213. package/docs/knowledge-base/how-do-balance-and-top-ups-work.md +22 -0
  214. package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +20 -0
  215. package/docs/knowledge-base/how-do-discounts-work.md +65 -0
  216. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +88 -0
  217. package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +77 -0
  218. package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +20 -0
  219. package/docs/knowledge-base/how-do-trial-periods-work.md +54 -0
  220. package/docs/knowledge-base/how-does-billing-work.md +73 -0
  221. package/docs/knowledge-base/how-does-payment-routing-work.md +17 -0
  222. package/docs/knowledge-base/how-does-quota-based-billing-work.md +106 -0
  223. package/docs/knowledge-base/how-does-seat-based-billing-work.md +88 -0
  224. package/docs/knowledge-base/how-is-proration-calculated-when-changing-plans.md +89 -0
  225. package/docs/knowledge-base/meta.json +29 -0
  226. package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +110 -0
  227. package/docs/knowledge-base/what-happens-when-a-payment-fails.md +40 -0
  228. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +74 -0
  229. package/docs/knowledge-base/what-happens-when-you-refund-or-retry-a-transaction.md +21 -0
  230. package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +101 -0
  231. package/docs/manifest.json +1677 -0
  232. package/docs/meta.json +11 -0
  233. package/docs/platform-documentation.md +175 -0
  234. package/docs/schemas.md +995 -0
  235. package/docs/webhooks/addon-activated.md +44 -0
  236. package/docs/webhooks/addon-deactivated.md +40 -0
  237. package/docs/webhooks/balance-depleted.md +37 -0
  238. package/docs/webhooks/balance-low.md +39 -0
  239. package/docs/webhooks/balance-topped-up.md +41 -0
  240. package/docs/webhooks/checkout-ready.md +43 -0
  241. package/docs/webhooks/credits-depleted.md +35 -0
  242. package/docs/webhooks/credits-expired.md +35 -0
  243. package/docs/webhooks/credits-granted.md +37 -0
  244. package/docs/webhooks/credits-low.md +39 -0
  245. package/docs/webhooks/credits-purchased.md +41 -0
  246. package/docs/webhooks/customer-created.md +49 -0
  247. package/docs/webhooks/customer-state-changed.md +134 -0
  248. package/docs/webhooks/customer-updated.md +49 -0
  249. package/docs/webhooks/introduction.md +499 -0
  250. package/docs/webhooks/invoice-created.md +45 -0
  251. package/docs/webhooks/invoice-overdue.md +53 -0
  252. package/docs/webhooks/invoice-upcoming.md +43 -0
  253. package/docs/webhooks/invoice-voided.md +53 -0
  254. package/docs/webhooks/meta.json +78 -0
  255. package/docs/webhooks/payment-dispute-resolved.md +52 -0
  256. package/docs/webhooks/payment-disputed.md +49 -0
  257. package/docs/webhooks/payment-failed.md +37 -0
  258. package/docs/webhooks/payment-link-canceled.md +41 -0
  259. package/docs/webhooks/payment-link-completed.md +47 -0
  260. package/docs/webhooks/payment-link-created.md +41 -0
  261. package/docs/webhooks/payment-link-failed.md +45 -0
  262. package/docs/webhooks/payment-method-attached.md +40 -0
  263. package/docs/webhooks/payment-method-updated.md +38 -0
  264. package/docs/webhooks/payment-received.md +45 -0
  265. package/docs/webhooks/payment-recovered.md +39 -0
  266. package/docs/webhooks/payment-refunded.md +47 -0
  267. package/docs/webhooks/payment-retry-failed.md +39 -0
  268. package/docs/webhooks/payout-available.md +33 -0
  269. package/docs/webhooks/payout-created.md +48 -0
  270. package/docs/webhooks/payout-failed.md +52 -0
  271. package/docs/webhooks/payout-paid.md +48 -0
  272. package/docs/webhooks/quota-exceeded.md +44 -0
  273. package/docs/webhooks/quota-threshold-reached.md +41 -0
  274. package/docs/webhooks/seats-limit-reached.md +39 -0
  275. package/docs/webhooks/seats-updated.md +39 -0
  276. package/docs/webhooks/subscription-activated.md +43 -0
  277. package/docs/webhooks/subscription-canceled.md +57 -0
  278. package/docs/webhooks/subscription-cancellation-revoked.md +37 -0
  279. package/docs/webhooks/subscription-cancellation-scheduled.md +45 -0
  280. package/docs/webhooks/subscription-created.md +35 -0
  281. package/docs/webhooks/subscription-past-due.md +43 -0
  282. package/docs/webhooks/subscription-plan-change-revoked.md +50 -0
  283. package/docs/webhooks/subscription-plan-change-scheduled.md +55 -0
  284. package/docs/webhooks/subscription-plan-changed.md +43 -0
  285. package/docs/webhooks/subscription-reactivated.md +53 -0
  286. package/docs/webhooks/subscription-updated.md +39 -0
  287. package/docs/webhooks/trial-checkout-ready.md +39 -0
  288. package/docs/webhooks/trial-converted.md +39 -0
  289. package/docs/webhooks/trial-expired.md +39 -0
  290. package/docs/webhooks/trial-started.md +46 -0
  291. package/docs/webhooks/trial-will-end.md +41 -0
  292. package/docs/webhooks/usage-recorded.md +41 -0
  293. package/docs/webhooks.md +782 -0
  294. package/package.json +2 -1
package/dist/index.d.mts CHANGED
@@ -79,24 +79,30 @@ interface ApiErrorDetail {
79
79
  details?: unknown;
80
80
  doc_url?: string;
81
81
  }
82
+ interface CommetErrorContext {
83
+ type?: string;
84
+ param?: string;
85
+ requestId?: string;
86
+ docUrl?: string;
87
+ }
82
88
  declare class CommetError extends Error {
83
89
  code?: string | undefined;
84
90
  statusCode?: number | undefined;
85
91
  details?: unknown | undefined;
86
- constructor(message: string, code?: string | undefined, statusCode?: number | undefined, details?: unknown | undefined);
87
- }
88
- declare class CommetAPIError extends CommetError {
89
- statusCode: number;
90
- code?: string | undefined;
91
- details?: unknown | undefined;
92
92
  type?: string;
93
93
  param?: string;
94
+ requestId?: string;
94
95
  docUrl?: string;
95
- constructor(message: string, statusCode: number, code?: string | undefined, details?: unknown | undefined, errorDetail?: ApiErrorDetail);
96
+ constructor(message: string, code?: string | undefined, statusCode?: number | undefined, details?: unknown | undefined, context?: CommetErrorContext);
97
+ toJSON(): Record<string, unknown>;
96
98
  }
97
- declare class CommetValidationError extends CommetError {
99
+ declare class CommetAPIError extends CommetError {
100
+ constructor(message: string, statusCode: number, code?: string, details?: unknown, errorDetail?: ApiErrorDetail, responseContext?: Pick<CommetErrorContext, "requestId">);
101
+ }
102
+ declare class CommetValidationError extends CommetAPIError {
98
103
  validationErrors: Record<string, string[]>;
99
- constructor(message: string, validationErrors: Record<string, string[]>);
104
+ constructor(message: string, validationErrors: Record<string, string[]>, statusCode?: number, errorDetail?: ApiErrorDetail, responseContext?: Pick<CommetErrorContext, "requestId">);
105
+ toJSON(): Record<string, unknown>;
100
106
  }
101
107
  interface RequestOptions {
102
108
  apiVersion?: string;
@@ -240,12 +246,6 @@ interface CreatedSubscription {
240
246
  /** @format date-time */
241
247
  scheduledFor: string;
242
248
  } | null;
243
- discount: {
244
- type: "percentage" | "amount";
245
- value: number;
246
- name: string | null;
247
- endsAt: string | null;
248
- } | null;
249
249
  /** @format date-time */
250
250
  startDate: string;
251
251
  endDate: string | null;
@@ -256,6 +256,7 @@ interface CreatedSubscription {
256
256
  createdAt: string;
257
257
  /** @format date-time */
258
258
  updatedAt: string;
259
+ offerApplications: Array<SubscriptionOfferApplication>;
259
260
  /** Payment provider resolved for this checkout when the subscription response was created. This is an informational snapshot and may differ when the checkout is loaded if its country or the organization's routing changes. */
260
261
  checkoutProvider: PaymentProvider | null;
261
262
  priceId: string | null;
@@ -351,6 +352,31 @@ interface CustomerBatch {
351
352
  object: "customer_batch";
352
353
  livemode: boolean;
353
354
  }
355
+ interface CustomerCredit {
356
+ id: string;
357
+ /** Original grant amount in the currency's smallest unit. */
358
+ amount: number;
359
+ appliedAmount: number;
360
+ reversedAmount: number;
361
+ revokedAmount: number;
362
+ remainingAmount: number;
363
+ currency: string;
364
+ reason: string;
365
+ source: "dashboard" | "api" | "plan_change" | "migration";
366
+ expiresAt: string | null;
367
+ /** @format date-time */
368
+ createdAt: string;
369
+ object: "customer_credit";
370
+ livemode: boolean;
371
+ }
372
+ interface CustomerCreditRevocation {
373
+ id: string;
374
+ remainingAmount: number;
375
+ revokedAmount: number;
376
+ currency: string;
377
+ object: "customer_credit";
378
+ livemode: boolean;
379
+ }
354
380
  interface DeletedObject {
355
381
  id: string;
356
382
  deleted: true;
@@ -648,7 +674,7 @@ interface Invoice {
648
674
  poNumber: string | null;
649
675
  reference: string | null;
650
676
  lineItems: Array<{
651
- lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "credit" | "balance_overage" | "addon_base" | "one_time";
677
+ lineType: "plan_base" | "feature_overage" | "feature_seats" | "feature_quota" | "discount" | "promo_code_discount" | "plan_grant" | "credit" | "balance_overage" | "addon_base" | "one_time";
652
678
  featureName: string | null;
653
679
  description: string;
654
680
  quantity: number;
@@ -701,7 +727,7 @@ interface InvoiceListItem {
701
727
  object: "invoice";
702
728
  livemode: boolean;
703
729
  }
704
- interface MarketGroup {
730
+ interface Market {
705
731
  id: string;
706
732
  name: string;
707
733
  countryCodes: Array<string>;
@@ -710,25 +736,27 @@ interface MarketGroup {
710
736
  createdAt: string;
711
737
  /** @format date-time */
712
738
  updatedAt: string;
713
- object: "market_group";
739
+ object: "market";
714
740
  livemode: boolean;
715
741
  }
716
742
  interface Offer {
717
743
  id: string;
718
744
  name: string;
719
- purpose: "introductory" | "promotional";
720
- planPriceIds: Array<string>;
721
745
  phases: Array<{
722
746
  type: "free_trial";
723
747
  durationDays: number;
724
748
  } | {
725
749
  type: "percentage";
726
- durationCycles: number;
750
+ durationCycles: number | null;
751
+ /** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
752
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
727
753
  /** Discount in basis points. 5000 means 50%. */
728
754
  percentage: number;
729
755
  } | {
730
756
  type: "amount_off";
731
- durationCycles: number;
757
+ durationCycles: number | null;
758
+ /** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
759
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
732
760
  amounts: Array<{
733
761
  currency: string;
734
762
  /** Amount in the currency's minor unit (for example, cents for USD). */
@@ -736,7 +764,9 @@ interface Offer {
736
764
  }>;
737
765
  } | {
738
766
  type: "fixed_price";
739
- durationCycles: number;
767
+ durationCycles: number | null;
768
+ /** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
769
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
740
770
  prices: Array<{
741
771
  currency: string;
742
772
  /** Amount in the currency's minor unit (for example, cents for USD). */
@@ -810,23 +840,6 @@ interface PayoutBankAccount {
810
840
  object: "payout_bank_account";
811
841
  livemode: boolean;
812
842
  }
813
- type PayoutVerification = {
814
- providerAccountId: string;
815
- status: "pending_verification" | "verified" | "restricted" | "disabled";
816
- transfersEnabled: boolean;
817
- outcome: "existing";
818
- object: "payout_account";
819
- livemode: boolean;
820
- } | {
821
- providerAccountId: string;
822
- status: "pending_verification" | "verified" | "restricted" | "disabled";
823
- transfersEnabled: boolean;
824
- outcome: "created";
825
- businessType: "individual" | "company";
826
- country: string;
827
- object: "payout_account";
828
- livemode: boolean;
829
- };
830
843
  interface Plan {
831
844
  id: string;
832
845
  name: string;
@@ -918,27 +931,45 @@ type PlanChange = {
918
931
  /** Total in the currency's minor unit. */
919
932
  total: number;
920
933
  phases: Array<{
934
+ type: "free_trial";
935
+ durationDays: number;
936
+ startsAt: string | null;
937
+ endsAt: string | null;
938
+ } | {
921
939
  type: "percentage";
922
- durationCycles: number;
940
+ durationCycles: number | null;
941
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
923
942
  startsAt: string | null;
924
943
  endsAt: string | null;
925
944
  /** Discount in basis points. 5000 means 50%. */
926
945
  percentage: number;
927
946
  } | {
928
947
  type: "amount_off";
929
- durationCycles: number;
948
+ durationCycles: number | null;
949
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
930
950
  startsAt: string | null;
931
951
  endsAt: string | null;
932
952
  /** Discount in the application currency's minor unit. */
933
953
  amount: number;
934
954
  } | {
935
955
  type: "fixed_price";
936
- durationCycles: number;
956
+ durationCycles: number | null;
957
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
937
958
  startsAt: string | null;
938
959
  endsAt: string | null;
939
960
  /** Fixed price in the application currency's minor unit. */
940
961
  price: number;
941
962
  }>;
963
+ appliesTo: {
964
+ type: "plan_price";
965
+ id: string;
966
+ } | {
967
+ type: "addon";
968
+ id: string;
969
+ } | {
970
+ type: "credit_pack";
971
+ id: string;
972
+ };
942
973
  };
943
974
  object: "plan_change";
944
975
  livemode: boolean;
@@ -1001,27 +1032,45 @@ type PlanChange = {
1001
1032
  /** Total in the currency's minor unit. */
1002
1033
  total: number;
1003
1034
  phases: Array<{
1035
+ type: "free_trial";
1036
+ durationDays: number;
1037
+ startsAt: string | null;
1038
+ endsAt: string | null;
1039
+ } | {
1004
1040
  type: "percentage";
1005
- durationCycles: number;
1041
+ durationCycles: number | null;
1042
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1006
1043
  startsAt: string | null;
1007
1044
  endsAt: string | null;
1008
1045
  /** Discount in basis points. 5000 means 50%. */
1009
1046
  percentage: number;
1010
1047
  } | {
1011
1048
  type: "amount_off";
1012
- durationCycles: number;
1049
+ durationCycles: number | null;
1050
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1013
1051
  startsAt: string | null;
1014
1052
  endsAt: string | null;
1015
1053
  /** Discount in the application currency's minor unit. */
1016
1054
  amount: number;
1017
1055
  } | {
1018
1056
  type: "fixed_price";
1019
- durationCycles: number;
1057
+ durationCycles: number | null;
1058
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1020
1059
  startsAt: string | null;
1021
1060
  endsAt: string | null;
1022
1061
  /** Fixed price in the application currency's minor unit. */
1023
1062
  price: number;
1024
1063
  }>;
1064
+ appliesTo: {
1065
+ type: "plan_price";
1066
+ id: string;
1067
+ } | {
1068
+ type: "addon";
1069
+ id: string;
1070
+ } | {
1071
+ type: "credit_pack";
1072
+ id: string;
1073
+ };
1025
1074
  };
1026
1075
  object: "plan_change";
1027
1076
  livemode: boolean;
@@ -1042,6 +1091,42 @@ interface PlanFeature {
1042
1091
  object: "plan_feature";
1043
1092
  livemode: boolean;
1044
1093
  }
1094
+ interface PlanGrant {
1095
+ id: string;
1096
+ customerId: string;
1097
+ subscriptionId: string;
1098
+ planId: string;
1099
+ planPriceId: string;
1100
+ billingInterval: "weekly" | "monthly" | "quarterly" | "yearly";
1101
+ status: "active" | "expired" | "revoked";
1102
+ duration: "cycles" | "until_date" | "until_revoked";
1103
+ durationCycles: number | null;
1104
+ /** @format date-time */
1105
+ startsAt: string;
1106
+ expiresAt: string | null;
1107
+ reason: string;
1108
+ source: "dashboard" | "api";
1109
+ revokedAt: string | null;
1110
+ /** @format date-time */
1111
+ createdAt: string;
1112
+ /** @format date-time */
1113
+ updatedAt: string;
1114
+ events: Array<{
1115
+ id: string;
1116
+ type: "created" | "updated" | "expired" | "revoked";
1117
+ reason: string;
1118
+ source: "dashboard" | "api" | "system";
1119
+ previousExpiresAt: string | null;
1120
+ expiresAt: string | null;
1121
+ duration: "cycles" | "until_date" | "until_revoked" | null;
1122
+ durationCycles: number | null;
1123
+ requestedExpiresAt: string | null;
1124
+ /** @format date-time */
1125
+ createdAt: string;
1126
+ }>;
1127
+ object: "plan_grant";
1128
+ livemode: boolean;
1129
+ }
1045
1130
  interface PlanGroup {
1046
1131
  id: string;
1047
1132
  name: string;
@@ -1150,27 +1235,45 @@ interface PreviewChange {
1150
1235
  /** Total in the currency's minor unit. */
1151
1236
  total: number;
1152
1237
  phases: Array<{
1238
+ type: "free_trial";
1239
+ durationDays: number;
1240
+ startsAt: string | null;
1241
+ endsAt: string | null;
1242
+ } | {
1153
1243
  type: "percentage";
1154
- durationCycles: number;
1244
+ durationCycles: number | null;
1245
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1155
1246
  startsAt: string | null;
1156
1247
  endsAt: string | null;
1157
1248
  /** Discount in basis points. 5000 means 50%. */
1158
1249
  percentage: number;
1159
1250
  } | {
1160
1251
  type: "amount_off";
1161
- durationCycles: number;
1252
+ durationCycles: number | null;
1253
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1162
1254
  startsAt: string | null;
1163
1255
  endsAt: string | null;
1164
1256
  /** Discount in the application currency's minor unit. */
1165
1257
  amount: number;
1166
1258
  } | {
1167
1259
  type: "fixed_price";
1168
- durationCycles: number;
1260
+ durationCycles: number | null;
1261
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1169
1262
  startsAt: string | null;
1170
1263
  endsAt: string | null;
1171
1264
  /** Fixed price in the application currency's minor unit. */
1172
1265
  price: number;
1173
1266
  }>;
1267
+ appliesTo: {
1268
+ type: "plan_price";
1269
+ id: string;
1270
+ } | {
1271
+ type: "addon";
1272
+ id: string;
1273
+ } | {
1274
+ type: "credit_pack";
1275
+ id: string;
1276
+ };
1174
1277
  };
1175
1278
  object: "plan_change_preview";
1176
1279
  livemode: boolean;
@@ -1207,27 +1310,45 @@ interface ReactivatedSubscription {
1207
1310
  /** Total in the currency's minor unit. */
1208
1311
  total: number;
1209
1312
  phases: Array<{
1313
+ type: "free_trial";
1314
+ durationDays: number;
1315
+ startsAt: string | null;
1316
+ endsAt: string | null;
1317
+ } | {
1210
1318
  type: "percentage";
1211
- durationCycles: number;
1319
+ durationCycles: number | null;
1320
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1212
1321
  startsAt: string | null;
1213
1322
  endsAt: string | null;
1214
1323
  /** Discount in basis points. 5000 means 50%. */
1215
1324
  percentage: number;
1216
1325
  } | {
1217
1326
  type: "amount_off";
1218
- durationCycles: number;
1327
+ durationCycles: number | null;
1328
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1219
1329
  startsAt: string | null;
1220
1330
  endsAt: string | null;
1221
1331
  /** Discount in the application currency's minor unit. */
1222
1332
  amount: number;
1223
1333
  } | {
1224
1334
  type: "fixed_price";
1225
- durationCycles: number;
1335
+ durationCycles: number | null;
1336
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1226
1337
  startsAt: string | null;
1227
1338
  endsAt: string | null;
1228
1339
  /** Fixed price in the application currency's minor unit. */
1229
1340
  price: number;
1230
1341
  }>;
1342
+ appliesTo: {
1343
+ type: "plan_price";
1344
+ id: string;
1345
+ } | {
1346
+ type: "addon";
1347
+ id: string;
1348
+ } | {
1349
+ type: "credit_pack";
1350
+ id: string;
1351
+ };
1231
1352
  };
1232
1353
  object: "subscription_reactivation";
1233
1354
  livemode: boolean;
@@ -1338,12 +1459,6 @@ interface Subscription {
1338
1459
  /** @format date-time */
1339
1460
  scheduledFor: string;
1340
1461
  } | null;
1341
- discount: {
1342
- type: "percentage" | "amount";
1343
- value: number;
1344
- name: string | null;
1345
- endsAt: string | null;
1346
- } | null;
1347
1462
  /** @format date-time */
1348
1463
  startDate: string;
1349
1464
  endDate: string | null;
@@ -1354,6 +1469,7 @@ interface Subscription {
1354
1469
  createdAt: string;
1355
1470
  /** @format date-time */
1356
1471
  updatedAt: string;
1472
+ offerApplications: Array<SubscriptionOfferApplication>;
1357
1473
  consumptionModel: ConsumptionModel | null;
1358
1474
  features: Array<{
1359
1475
  code: string;
@@ -1406,6 +1522,60 @@ interface SubscriptionAddon {
1406
1522
  object: "subscription_addon";
1407
1523
  livemode: boolean;
1408
1524
  }
1525
+ interface SubscriptionOfferApplication {
1526
+ id: string;
1527
+ name: string;
1528
+ appliesTo: {
1529
+ type: "plan_price";
1530
+ id: string;
1531
+ } | {
1532
+ type: "addon";
1533
+ id: string;
1534
+ } | {
1535
+ type: "credit_pack";
1536
+ id: string;
1537
+ };
1538
+ offerId: string | null;
1539
+ source: "direct" | "introductory" | "promo_code" | "card_promotion" | "custom";
1540
+ status: "quoted" | "applied" | "failed" | "expired";
1541
+ currency: string | null;
1542
+ subtotal: number | null;
1543
+ discountAmount: number | null;
1544
+ total: number | null;
1545
+ phases: Array<SubscriptionOfferApplicationPhase>;
1546
+ /** @format date-time */
1547
+ quotedAt: string;
1548
+ expiresAt: string | null;
1549
+ appliedAt: string | null;
1550
+ }
1551
+ type SubscriptionOfferApplicationPhase = {
1552
+ type: "free_trial";
1553
+ durationDays: number;
1554
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1555
+ startsAt: string | null;
1556
+ endsAt: string | null;
1557
+ } | {
1558
+ type: "percentage";
1559
+ durationCycles: number | null;
1560
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1561
+ percentage: number;
1562
+ startsAt: string | null;
1563
+ endsAt: string | null;
1564
+ } | {
1565
+ type: "amount_off";
1566
+ durationCycles: number | null;
1567
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1568
+ amount: number;
1569
+ startsAt: string | null;
1570
+ endsAt: string | null;
1571
+ } | {
1572
+ type: "fixed_price";
1573
+ durationCycles: number | null;
1574
+ durationInterval: "weekly" | "monthly" | "quarterly" | "yearly" | null;
1575
+ price: number;
1576
+ startsAt: string | null;
1577
+ endsAt: string | null;
1578
+ };
1409
1579
  interface SubscriptionSummary {
1410
1580
  id: string;
1411
1581
  customerId: string;
@@ -1441,12 +1611,6 @@ interface SubscriptionSummary {
1441
1611
  /** @format date-time */
1442
1612
  scheduledFor: string;
1443
1613
  } | null;
1444
- discount: {
1445
- type: "percentage" | "amount";
1446
- value: number;
1447
- name: string | null;
1448
- endsAt: string | null;
1449
- } | null;
1450
1614
  /** @format date-time */
1451
1615
  startDate: string;
1452
1616
  endDate: string | null;
@@ -1457,6 +1621,7 @@ interface SubscriptionSummary {
1457
1621
  createdAt: string;
1458
1622
  /** @format date-time */
1459
1623
  updatedAt: string;
1624
+ offerApplications: Array<SubscriptionOfferApplication>;
1460
1625
  priceId: string | null;
1461
1626
  object: "subscription";
1462
1627
  livemode: boolean;
@@ -1466,15 +1631,58 @@ interface TestClock {
1466
1631
  isActive: boolean;
1467
1632
  /** @format date-time */
1468
1633
  now: string;
1634
+ latestRun: {
1635
+ id: string;
1636
+ status: "pending" | "running" | "completed" | "failed";
1637
+ /** @format date-time */
1638
+ startedAtTime: string;
1639
+ /** @format date-time */
1640
+ targetTime: string;
1641
+ estimatedDeadlineCount: number;
1642
+ completedDeadlineCount: number;
1643
+ failedDeadlineCount: number;
1644
+ error: string | null;
1645
+ items: Array<{
1646
+ kind: "billing_cycle" | "dunning_retry";
1647
+ status: "pending" | "processing" | "completed" | "failed";
1648
+ /** @format date-time */
1649
+ dueAt: string;
1650
+ subscriptionId: string;
1651
+ customerName: string | null;
1652
+ invoiceNumber: string | null;
1653
+ invoiceId: string | null;
1654
+ outcome: string | null;
1655
+ detail: string | null;
1656
+ error: string | null;
1657
+ }>;
1658
+ } | null;
1469
1659
  object: "test_clock";
1470
1660
  livemode: boolean;
1471
1661
  }
1472
- interface TestClockBilling {
1473
- customersFound: number;
1474
- enqueued: number;
1475
- failed: number;
1476
- dunningRetried: number;
1477
- dunningFailed: number;
1662
+ interface TestClockRun {
1663
+ id: string;
1664
+ status: "pending" | "running" | "completed" | "failed";
1665
+ /** @format date-time */
1666
+ startedAtTime: string;
1667
+ /** @format date-time */
1668
+ targetTime: string;
1669
+ estimatedDeadlineCount: number;
1670
+ completedDeadlineCount: number;
1671
+ failedDeadlineCount: number;
1672
+ error: string | null;
1673
+ items: Array<{
1674
+ kind: "billing_cycle" | "dunning_retry";
1675
+ status: "pending" | "processing" | "completed" | "failed";
1676
+ /** @format date-time */
1677
+ dueAt: string;
1678
+ subscriptionId: string;
1679
+ customerName: string | null;
1680
+ invoiceNumber: string | null;
1681
+ invoiceId: string | null;
1682
+ outcome: string | null;
1683
+ detail: string | null;
1684
+ error: string | null;
1685
+ }>;
1478
1686
  object: "test_clock_run";
1479
1687
  livemode: boolean;
1480
1688
  }
@@ -1869,6 +2077,70 @@ declare class CreditPacksResource {
1869
2077
  create(params: CreateCreditPackParams, options?: RequestOptions): Promise<CreditPack>;
1870
2078
  }
1871
2079
 
2080
+ interface RevokeCustomerCreditParams {
2081
+ id: string;
2082
+ creditId: string;
2083
+ }
2084
+ interface ListCustomerCreditsParams {
2085
+ id: string;
2086
+ }
2087
+ interface CreateCustomerCreditParams {
2088
+ id: string;
2089
+ /** Amount in the currency's smallest unit. */
2090
+ amount: number;
2091
+ currency: "usd" | "ars" | "brl" | "clp" | "cop" | "pen" | "uyu" | "pyg" | "bob" | "mxn" | "cad" | "eur" | "jpy" | "cny" | "krw" | "hkd" | "sgd" | "twd" | "inr" | "thb";
2092
+ reason: string;
2093
+ expiresAt?: string | null;
2094
+ }
2095
+ interface RevokePlanGrantParams {
2096
+ id: string;
2097
+ grantId: string;
2098
+ reason: string;
2099
+ }
2100
+ type UpdatePlanGrantParams = {
2101
+ id: string;
2102
+ grantId: string;
2103
+ reason: string;
2104
+ duration: "cycles";
2105
+ durationCycles: number;
2106
+ } | {
2107
+ id: string;
2108
+ grantId: string;
2109
+ reason: string;
2110
+ duration: "until_date";
2111
+ /** @format date-time */
2112
+ expiresAt: string;
2113
+ } | {
2114
+ id: string;
2115
+ grantId: string;
2116
+ reason: string;
2117
+ duration: "until_revoked";
2118
+ };
2119
+ interface ListPlanGrantsParams {
2120
+ id: string;
2121
+ }
2122
+ type CreatePlanGrantParams = {
2123
+ id: string;
2124
+ planId: string;
2125
+ billingInterval: "weekly" | "monthly" | "quarterly" | "yearly";
2126
+ reason: string;
2127
+ duration: "cycles";
2128
+ durationCycles: number;
2129
+ } | {
2130
+ id: string;
2131
+ planId: string;
2132
+ billingInterval: "weekly" | "monthly" | "quarterly" | "yearly";
2133
+ reason: string;
2134
+ duration: "until_date";
2135
+ /** @format date-time */
2136
+ expiresAt: string;
2137
+ } | {
2138
+ id: string;
2139
+ planId: string;
2140
+ billingInterval: "weekly" | "monthly" | "quarterly" | "yearly";
2141
+ reason: string;
2142
+ duration: "until_revoked";
2143
+ };
1872
2144
  interface GetCustomerParams {
1873
2145
  id: string;
1874
2146
  }
@@ -1937,6 +2209,30 @@ interface CreateCustomerParams {
1937
2209
  declare class CustomersResource {
1938
2210
  private httpClient;
1939
2211
  constructor(httpClient: CommetHTTPClient);
2212
+ /** Revoke the unallocated remainder of a customer credit grant. Applied invoice history is unchanged. */
2213
+ revokeCredit(params: RevokeCustomerCreditParams, options?: RequestOptions): Promise<CustomerCreditRevocation>;
2214
+ /** List currency-specific invoice credit grants and their remaining balances for a customer. */
2215
+ listCredits(params: ListCustomerCreditsParams, options?: RequestOptions): Promise<{
2216
+ object: "list";
2217
+ data: Array<CustomerCredit>;
2218
+ hasMore: boolean;
2219
+ nextCursor?: string;
2220
+ }>;
2221
+ /** Grant monetary credit in one currency. Credit is applied FIFO before tax to eligible recurring invoices. */
2222
+ createCredit(params: CreateCustomerCreditParams, options?: RequestOptions): Promise<CustomerCredit>;
2223
+ /** End complimentary access immediately. The next full-price period becomes pending payment and requires checkout; no past period is billed retroactively. */
2224
+ revokePlanGrant(params: RevokePlanGrantParams, options?: RequestOptions): Promise<PlanGrant>;
2225
+ /** Give the grant a remaining number of billing cycles, set an exact deadline, or keep it active until revoked. */
2226
+ updatePlanGrant(params: UpdatePlanGrantParams, options?: RequestOptions): Promise<PlanGrant>;
2227
+ /** List the independent audit timeline for paid-plan access granted without checkout or payment credentials. */
2228
+ listPlanGrants(params: ListPlanGrantsParams, options?: RequestOptions): Promise<{
2229
+ object: "list";
2230
+ data: Array<PlanGrant>;
2231
+ hasMore: boolean;
2232
+ nextCursor?: string;
2233
+ }>;
2234
+ /** Move an active free subscription to an eligible paid plan immediately without checkout, a card, or customer credit. The grant may last for exact billing cycles, until a date, or until revoked. */
2235
+ createPlanGrant(params: CreatePlanGrantParams, options?: RequestOptions): Promise<PlanGrant>;
1940
2236
  /** Retrieve a customer by their public ID, including subscription status and metadata. */
1941
2237
  get(params: GetCustomerParams, options?: RequestOptions): Promise<Customer>;
1942
2238
  /** Update a customer's name, external ID, or metadata. */
@@ -2062,25 +2358,64 @@ declare class InvoicesResource {
2062
2358
  createAdjustment(params: CreateAdjustmentInvoiceParams, options?: RequestOptions): Promise<Invoice>;
2063
2359
  }
2064
2360
 
2361
+ interface GetMarketParams {
2362
+ id: string;
2363
+ }
2364
+ interface UpdateMarketParams {
2365
+ id: string;
2366
+ name: string;
2367
+ countryCodes: Array<string>;
2368
+ metadata?: Record<string, unknown>;
2369
+ }
2370
+ interface DeleteMarketParams {
2371
+ id: string;
2372
+ }
2373
+ interface CreateMarketParams {
2374
+ name: string;
2375
+ countryCodes: Array<string>;
2376
+ metadata?: Record<string, unknown>;
2377
+ }
2378
+ declare class MarketsResource {
2379
+ private httpClient;
2380
+ constructor(httpClient: CommetHTTPClient);
2381
+ /** Get one reusable market. */
2382
+ get(params: GetMarketParams, options?: RequestOptions): Promise<Market>;
2383
+ /** Replace the name, countries, and metadata of a market. */
2384
+ update(params: UpdateMarketParams, options?: RequestOptions): Promise<Market>;
2385
+ /** Delete an unused market. Markets referenced by prices or subscriptions cannot be deleted. */
2386
+ delete(params: DeleteMarketParams, options?: RequestOptions): Promise<DeletedObject>;
2387
+ /** List reusable country groups that resolve market-specific prices independently from currency. */
2388
+ list(): Promise<{
2389
+ object: "list";
2390
+ data: Array<Market>;
2391
+ hasMore: boolean;
2392
+ nextCursor?: string;
2393
+ }>;
2394
+ /** Create a reusable market without attaching it to a plan or price. Countries can belong to only one active market. */
2395
+ create(params: CreateMarketParams, options?: RequestOptions): Promise<Market>;
2396
+ }
2397
+
2065
2398
  interface GetOfferParams {
2066
2399
  id: string;
2067
2400
  }
2068
2401
  interface UpdateOfferParams {
2069
2402
  id: string;
2070
2403
  name: string;
2071
- purpose: "introductory" | "promotional";
2072
- planPriceIds: Array<string>;
2073
2404
  phases: Array<{
2074
2405
  type: "free_trial";
2075
2406
  durationDays: number;
2076
2407
  } | {
2077
2408
  type: "percentage";
2078
- durationCycles: number;
2409
+ durationCycles: number | null;
2410
+ /** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
2411
+ durationInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | null;
2079
2412
  /** Discount in basis points. 5000 means 50%. */
2080
2413
  percentage: number;
2081
2414
  } | {
2082
2415
  type: "amount_off";
2083
- durationCycles: number;
2416
+ durationCycles: number | null;
2417
+ /** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
2418
+ durationInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | null;
2084
2419
  amounts: Array<{
2085
2420
  currency: string;
2086
2421
  /** Amount in the currency's minor unit (for example, cents for USD). */
@@ -2088,7 +2423,9 @@ interface UpdateOfferParams {
2088
2423
  }>;
2089
2424
  } | {
2090
2425
  type: "fixed_price";
2091
- durationCycles: number;
2426
+ durationCycles: number | null;
2427
+ /** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
2428
+ durationInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | null;
2092
2429
  prices: Array<{
2093
2430
  currency: string;
2094
2431
  /** Amount in the currency's minor unit (for example, cents for USD). */
@@ -2106,25 +2443,25 @@ interface DeleteOfferParams {
2106
2443
  interface ListOffersParams {
2107
2444
  cursor?: string;
2108
2445
  limit?: number;
2109
- planPriceId?: string;
2110
- purpose?: "introductory" | "promotional";
2111
2446
  active?: boolean;
2112
2447
  }
2113
2448
  interface CreateOfferParams {
2114
2449
  name: string;
2115
- purpose: "introductory" | "promotional";
2116
- planPriceIds: Array<string>;
2117
2450
  phases: Array<{
2118
2451
  type: "free_trial";
2119
2452
  durationDays: number;
2120
2453
  } | {
2121
2454
  type: "percentage";
2122
- durationCycles: number;
2455
+ durationCycles: number | null;
2456
+ /** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
2457
+ durationInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | null;
2123
2458
  /** Discount in basis points. 5000 means 50%. */
2124
2459
  percentage: number;
2125
2460
  } | {
2126
2461
  type: "amount_off";
2127
- durationCycles: number;
2462
+ durationCycles: number | null;
2463
+ /** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
2464
+ durationInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | null;
2128
2465
  amounts: Array<{
2129
2466
  currency: string;
2130
2467
  /** Amount in the currency's minor unit (for example, cents for USD). */
@@ -2132,7 +2469,9 @@ interface CreateOfferParams {
2132
2469
  }>;
2133
2470
  } | {
2134
2471
  type: "fixed_price";
2135
- durationCycles: number;
2472
+ durationCycles: number | null;
2473
+ /** Unit the phase duration is counted in. Only a fixed-price phase may set it, because its amount is declared rather than derived from the plan. Defaults to the plan's own billing interval. */
2474
+ durationInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | null;
2136
2475
  prices: Array<{
2137
2476
  currency: string;
2138
2477
  /** Amount in the currency's minor unit (for example, cents for USD). */
@@ -2147,20 +2486,20 @@ interface CreateOfferParams {
2147
2486
  declare class OffersResource {
2148
2487
  private httpClient;
2149
2488
  constructor(httpClient: CommetHTTPClient);
2150
- /** Retrieve a canonical offer by its public ID. */
2489
+ /** Retrieve reusable offer terms by public ID. */
2151
2490
  get(params: GetOfferParams, options?: RequestOptions): Promise<Offer>;
2152
- /** Replace an offer's catalog definition. Existing offer applications keep their immutable accepted terms. */
2491
+ /** Replace reusable offer terms. Existing applications keep their immutable accepted terms. */
2153
2492
  update(params: UpdateOfferParams, options?: RequestOptions): Promise<Offer>;
2154
- /** Soft-delete an offer. Existing applications and their accepted terms remain available for billing and audit. */
2493
+ /** Soft-delete an Offer. Existing applications and their accepted terms remain available for billing and audit. */
2155
2494
  delete(params: DeleteOfferParams, options?: RequestOptions): Promise<DeletedOffer>;
2156
- /** List the organization's canonical introductory and promotional offers. */
2495
+ /** List reusable offer terms. Offers are independent from plans, prices, eligibility, and distribution channels. */
2157
2496
  list(params?: ListOffersParams, options?: RequestOptions): Promise<{
2158
2497
  object: "list";
2159
2498
  data: Array<Offer>;
2160
2499
  hasMore: boolean;
2161
2500
  nextCursor?: string;
2162
2501
  }>;
2163
- /** Create a canonical offer scoped to one or more plan prices. Currency-specific phases require an explicit USD value and never fall back across currencies. */
2502
+ /** Create reusable offer terms without assigning a plan, price, eligibility rule, or distribution channel. */
2164
2503
  create(params: CreateOfferParams, options?: RequestOptions): Promise<Offer>;
2165
2504
  }
2166
2505
 
@@ -2221,63 +2560,6 @@ interface RequestPayoutParams {
2221
2560
  amount: number;
2222
2561
  description?: string;
2223
2562
  }
2224
- type CompletePayoutVerificationParams = {
2225
- email: string;
2226
- businessUrl: string;
2227
- documentUrl: string;
2228
- bank: {
2229
- accountNumber: string;
2230
- accountHolderName: string;
2231
- routingNumber?: string;
2232
- accountType?: "checking" | "savings";
2233
- };
2234
- businessType: "individual";
2235
- individual: {
2236
- firstName: string;
2237
- lastName: string;
2238
- phone: string;
2239
- dateOfBirth: string;
2240
- ssnLast4?: string;
2241
- idNumber?: string;
2242
- address: {
2243
- line1: string;
2244
- line2?: string;
2245
- city: string;
2246
- state?: string;
2247
- postalCode: string;
2248
- country: string;
2249
- };
2250
- };
2251
- } | {
2252
- email: string;
2253
- businessUrl: string;
2254
- documentUrl: string;
2255
- bank: {
2256
- accountNumber: string;
2257
- accountHolderName: string;
2258
- routingNumber?: string;
2259
- accountType?: "checking" | "savings";
2260
- };
2261
- businessType: "company";
2262
- company: {
2263
- name: string;
2264
- taxId: string;
2265
- address: {
2266
- line1: string;
2267
- line2?: string;
2268
- city: string;
2269
- state?: string;
2270
- postalCode: string;
2271
- country: string;
2272
- };
2273
- representative: {
2274
- firstName: string;
2275
- lastName: string;
2276
- phone?: string;
2277
- email?: string;
2278
- };
2279
- };
2280
- };
2281
2563
  declare class PayoutsResource {
2282
2564
  private httpClient;
2283
2565
  constructor(httpClient: CommetHTTPClient);
@@ -2285,8 +2567,11 @@ declare class PayoutsResource {
2285
2567
  addBankAccount(params: AddPayoutBankAccountParams, options?: RequestOptions): Promise<PayoutBankAccount>;
2286
2568
  /** Withdraw available balance to the organization's verified payout account. `amount` is in cents (USD, minimum 1000 = $10). The payout is created in `pending` and settles to `paid` asynchronously as provider webhooks arrive. */
2287
2569
  request(params: RequestPayoutParams, options?: RequestOptions): Promise<Payout>;
2288
- /** Provision the organization's payout account in a single call with the full KYC + bank payload. Uploads the identity document, persists the destination bank, and creates the connected account through the org's payout provider. The account starts `pending_verification` and flips to `verified` via the provider's webhook. Idempotent: returns the existing account if the org already has one. */
2289
- completeVerification(params: CompletePayoutVerificationParams, options?: RequestOptions): Promise<PayoutVerification>;
2570
+ /**
2571
+ * Deprecated. Complete business and identity verification in the Commet dashboard. This endpoint no longer accepts or processes KYC data.
2572
+ * @deprecated
2573
+ */
2574
+ completeVerification(options?: RequestOptions): Promise<void>;
2290
2575
  }
2291
2576
 
2292
2577
  interface RemovePlanFromGroupParams {
@@ -2545,44 +2830,7 @@ declare class PortalResource {
2545
2830
  private httpClient;
2546
2831
  constructor(httpClient: CommetHTTPClient);
2547
2832
  /** Generate a customer portal URL. Exactly one identifier (email or customerId) is required. */
2548
- getUrl(params?: RequestPortalAccessParams, options?: RequestOptions): Promise<PortalAccess>;
2549
- }
2550
-
2551
- interface GetMarketGroupParams {
2552
- id: string;
2553
- }
2554
- interface UpdateMarketGroupParams {
2555
- id: string;
2556
- name: string;
2557
- countryCodes: Array<string>;
2558
- metadata?: Record<string, unknown>;
2559
- }
2560
- interface DeleteMarketGroupParams {
2561
- id: string;
2562
- }
2563
- interface CreateMarketGroupParams {
2564
- name: string;
2565
- countryCodes: Array<string>;
2566
- metadata?: Record<string, unknown>;
2567
- }
2568
- declare class PricingResource {
2569
- private httpClient;
2570
- constructor(httpClient: CommetHTTPClient);
2571
- /** Get one reusable pricing market group. */
2572
- getMarketGroup(params: GetMarketGroupParams, options?: RequestOptions): Promise<MarketGroup>;
2573
- /** Replace the name, countries, and metadata of a pricing market group. */
2574
- updateMarketGroup(params: UpdateMarketGroupParams, options?: RequestOptions): Promise<MarketGroup>;
2575
- /** Delete an unused pricing market group. Groups referenced by prices or subscriptions cannot be deleted. */
2576
- deleteMarketGroup(params: DeleteMarketGroupParams, options?: RequestOptions): Promise<DeletedObject>;
2577
- /** List reusable country groups used to resolve market-specific prices independently from currency. */
2578
- listMarketGroups(): Promise<{
2579
- object: "list";
2580
- data: Array<MarketGroup>;
2581
- hasMore: boolean;
2582
- nextCursor?: string;
2583
- }>;
2584
- /** Create a reusable country group. Countries can belong to only one active group; each price chooses its currency independently. */
2585
- createMarketGroup(params: CreateMarketGroupParams, options?: RequestOptions): Promise<MarketGroup>;
2833
+ getUrl(params: RequestPortalAccessParams, options?: RequestOptions): Promise<PortalAccess>;
2586
2834
  }
2587
2835
 
2588
2836
  interface GetPromoCodeParams {
@@ -2623,7 +2871,7 @@ declare class PromoCodesResource {
2623
2871
  hasMore: boolean;
2624
2872
  nextCursor?: string;
2625
2873
  }>;
2626
- /** Create a distribution code for an existing promotional offer. Offer economics remain owned by the referenced Offer. */
2874
+ /** Create a distribution code for an existing Offer. The referenced Offer owns the benefit and duration; the promo code owns redemption restrictions. */
2627
2875
  create(params: CreatePromoCodeParams, options?: RequestOptions): Promise<PromoCode>;
2628
2876
  }
2629
2877
 
@@ -2770,6 +3018,15 @@ interface PurchaseCreditsParams {
2770
3018
  id: string;
2771
3019
  creditPackId: string;
2772
3020
  }
3021
+ interface ApplySubscriptionOfferParams {
3022
+ id: string;
3023
+ offerId: string;
3024
+ /** @format date-time */
3025
+ expiresAt?: string;
3026
+ }
3027
+ interface RemoveSubscriptionOfferParams {
3028
+ id: string;
3029
+ }
2773
3030
  interface UpdatePaymentMethodParams {
2774
3031
  id: string;
2775
3032
  successUrl?: string;
@@ -2806,8 +3063,8 @@ type CreateSubscriptionParams = {
2806
3063
  /** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
2807
3064
  priceId?: string;
2808
3065
  initialSeats?: Record<string, number>;
2809
- /** Payment provider for the initial checkout. Overrides country routing when present. */
2810
- provider?: "stripe" | "commet" | "dlocal";
3066
+ /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
3067
+ provider?: "stripe" | "commet" | "dlocal" | string;
2811
3068
  name?: string;
2812
3069
  /** @format date-time */
2813
3070
  startDate?: string;
@@ -2823,8 +3080,8 @@ type CreateSubscriptionParams = {
2823
3080
  /** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
2824
3081
  priceId?: string;
2825
3082
  initialSeats?: Record<string, number>;
2826
- /** Payment provider for the initial checkout. Overrides country routing when present. */
2827
- provider?: "stripe" | "commet" | "dlocal";
3083
+ /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
3084
+ provider?: "stripe" | "commet" | "dlocal" | string;
2828
3085
  name?: string;
2829
3086
  /** @format date-time */
2830
3087
  startDate?: string;
@@ -2840,8 +3097,8 @@ type CreateSubscriptionParams = {
2840
3097
  /** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
2841
3098
  priceId?: string;
2842
3099
  initialSeats?: Record<string, number>;
2843
- /** Payment provider for the initial checkout. Overrides country routing when present. */
2844
- provider?: "stripe" | "commet" | "dlocal";
3100
+ /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
3101
+ provider?: "stripe" | "commet" | "dlocal" | string;
2845
3102
  name?: string;
2846
3103
  /** @format date-time */
2847
3104
  startDate?: string;
@@ -2857,8 +3114,8 @@ type CreateSubscriptionParams = {
2857
3114
  /** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
2858
3115
  priceId?: string;
2859
3116
  initialSeats?: Record<string, number>;
2860
- /** Payment provider for the initial checkout. Overrides country routing when present. */
2861
- provider?: "stripe" | "commet" | "dlocal";
3117
+ /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
3118
+ provider?: "stripe" | "commet" | "dlocal" | string;
2862
3119
  name?: string;
2863
3120
  /** @format date-time */
2864
3121
  startDate?: string;
@@ -2868,6 +3125,44 @@ type CreateSubscriptionParams = {
2868
3125
  customTrialDays?: never;
2869
3126
  skipTrial?: false;
2870
3127
  planCode: string;
3128
+ } | {
3129
+ customerId: string;
3130
+ billingInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time" | null;
3131
+ /** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
3132
+ priceId?: string;
3133
+ initialSeats?: Record<string, number>;
3134
+ /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
3135
+ provider?: "stripe" | "commet" | "dlocal" | string;
3136
+ name?: string;
3137
+ /** @format date-time */
3138
+ startDate?: string;
3139
+ successUrl?: string;
3140
+ offerId?: never;
3141
+ /** Public card promotion ID. The offer is shown immediately and remains conditional on card eligibility until checkout confirmation. */
3142
+ cardPromotionId: string;
3143
+ promoCode?: never;
3144
+ customTrialDays?: never;
3145
+ skipTrial?: false;
3146
+ planId: string;
3147
+ } | {
3148
+ customerId: string;
3149
+ billingInterval?: "weekly" | "monthly" | "quarterly" | "yearly" | "one_time" | null;
3150
+ /** Public price ID. When omitted, Commet selects the default price for the billing interval and still applies its market pricing. */
3151
+ priceId?: string;
3152
+ initialSeats?: Record<string, number>;
3153
+ /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
3154
+ provider?: "stripe" | "commet" | "dlocal" | string;
3155
+ name?: string;
3156
+ /** @format date-time */
3157
+ startDate?: string;
3158
+ successUrl?: string;
3159
+ offerId?: never;
3160
+ /** Public card promotion ID. The offer is shown immediately and remains conditional on card eligibility until checkout confirmation. */
3161
+ cardPromotionId: string;
3162
+ promoCode?: never;
3163
+ customTrialDays?: never;
3164
+ skipTrial?: false;
3165
+ planCode: string;
2871
3166
  };
2872
3167
  declare class SubscriptionsResource {
2873
3168
  private httpClient;
@@ -2882,15 +3177,19 @@ declare class SubscriptionsResource {
2882
3177
  topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<BalanceTopup>;
2883
3178
  /** Cancel immediately or at period end and return the updated subscription. */
2884
3179
  cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
2885
- /** Upgrade or change billing interval immediately, optionally applying a quoted Promotional Offer. Scheduled changes do not accept offers. */
3180
+ /** Upgrade or change billing interval immediately, optionally applying an Offer. Scheduled changes do not accept offers. */
2886
3181
  changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<PlanChange>;
2887
3182
  /** Purchase a credit pack for a subscription. Charges the customer and adds credits to their balance. */
2888
3183
  purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
3184
+ /** Apply or replace a direct Offer on a subscription's pending payment checkout. The existing checkout URL remains unchanged. Offers whose first phase is a free trial cannot be applied after checkout creation. */
3185
+ applyOffer(params: ApplySubscriptionOfferParams, options?: RequestOptions): Promise<Subscription>;
3186
+ /** Remove the quoted direct Offer from a subscription's pending payment checkout. The existing checkout URL remains unchanged and returns to its undiscounted price. */
3187
+ removeOffer(params: RemoveSubscriptionOfferParams, options?: RequestOptions): Promise<Subscription>;
2889
3188
  /** Creates a hosted checkout session for the customer to update the subscription's default payment method. */
2890
3189
  updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<PaymentMethodUpdateCheckout>;
2891
- /** Preview proration details for an immediate plan change (a higher-sort-order plan or a longer interval) without applying it. 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. Downgrades — a lower-sort-order plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with a Promotional Offer. */
3190
+ /** Preview proration details for an immediate plan change without applying it. Free-to-paid changes are never scheduled and the change-plan endpoint always returns hosted checkout for them. 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. */
2892
3191
  previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<PreviewChange>;
2893
- /** 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 a Promotional Offer by offerId; past-due recovery cannot. */
3192
+ /** 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. */
2894
3193
  reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ReactivatedSubscription>;
2895
3194
  /** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
2896
3195
  createRecoveryLink(params: CreateSubscriptionRecoveryLinkParams, options?: RequestOptions): Promise<RecoveryLink>;
@@ -2907,7 +3206,7 @@ declare class SubscriptionsResource {
2907
3206
  hasMore: boolean;
2908
3207
  nextCursor?: string;
2909
3208
  }>;
2910
- /** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. Without an offer override, Commet applies the price's automatic introductory offer. Pass one Promotional Offer through offerId to override it. Experiment assignment remains external. */
3209
+ /** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. 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. */
2911
3210
  create(params: CreateSubscriptionParams, options?: RequestOptions): Promise<CreatedSubscription>;
2912
3211
  }
2913
3212
 
@@ -2920,12 +3219,15 @@ type AdvanceTestClockParams = {
2920
3219
  declare class TestClockResource {
2921
3220
  private httpClient;
2922
3221
  constructor(httpClient: CommetHTTPClient);
2923
- /** Discovers customers due for billing at the org's current (simulated) time and enqueues a billing cycle for each — renewals, expired trials, pending cancellations. Also fires any dunning retry whose scheduled time has passed. Enqueueing is asynchronous. Sandbox only. */
2924
- processBilling(options?: RequestOptions): Promise<TestClockBilling>;
2925
- /** Returns the organization's current test clock state. Sandbox only. */
3222
+ /**
3223
+ * Deprecated. POST /test-clock now advances time and processes every due billing deadline in one durable run.
3224
+ * @deprecated
3225
+ */
3226
+ processBilling(options?: RequestOptions): Promise<void>;
3227
+ /** Returns the organization's current test clock state and latest durable run. Sandbox only. */
2926
3228
  get(): Promise<TestClock>;
2927
- /** Moves the test clock forward, by a number of days (advanceDays) or to an absolute instant (frozenTime). The clock can only move forward. Sandbox only. */
2928
- advance(params?: AdvanceTestClockParams, options?: RequestOptions): Promise<TestClock>;
3229
+ /** Starts a durable run that moves the test clock forward and processes every billing deadline due before the target time. Poll GET /test-clock for progress and terminal results. Sandbox only. */
3230
+ advance(params: AdvanceTestClockParams, options?: RequestOptions): Promise<TestClockRun>;
2929
3231
  }
2930
3232
 
2931
3233
  interface RefundTransactionParams {
@@ -3024,13 +3326,13 @@ declare class GeneratedResources {
3024
3326
  featureAccess: FeatureAccessResource;
3025
3327
  features: FeaturesResource;
3026
3328
  invoices: InvoicesResource;
3329
+ markets: MarketsResource;
3027
3330
  offers: OffersResource;
3028
3331
  payments: PaymentsResource;
3029
3332
  payouts: PayoutsResource;
3030
3333
  planGroups: PlanGroupsResource;
3031
3334
  plans: PlansResource;
3032
3335
  portal: PortalResource;
3033
- pricing: PricingResource;
3034
3336
  promoCodes: PromoCodesResource;
3035
3337
  provisioning: ProvisioningResource;
3036
3338
  quota: QuotaResource;
@@ -3359,6 +3661,8 @@ interface PaymentFailedData {
3359
3661
  customerId: string;
3360
3662
  /** The subscription ID, if the invoice is linked to a subscription. */
3361
3663
  subscriptionId: string | null;
3664
+ /** The payment provider the charge was routed to: stripe, commet, or dlocal. */
3665
+ provider: "stripe" | "commet" | "dlocal";
3362
3666
  /** The failure code from the payment processor. */
3363
3667
  failureCode: string;
3364
3668
  /** A human-readable failure message. */
@@ -3378,6 +3682,8 @@ interface PaymentRecoveredData {
3378
3682
  customerId: string;
3379
3683
  /** The subscription ID, if the invoice is linked to a subscription. */
3380
3684
  subscriptionId: string | null;
3685
+ /** The payment provider that recovered the payment, or null when the invoice was recovered without a processor charge. */
3686
+ provider: "stripe" | "commet" | "dlocal" | null;
3381
3687
  }
3382
3688
  /** Fired when all dunning retries are exhausted and the subscription is canceled. This is the terminal event of the dunning flow — payment.recovered will not follow. Revoke access when you receive this. */
3383
3689
  interface PaymentRetryFailedData {
@@ -3389,6 +3695,8 @@ interface PaymentRetryFailedData {
3389
3695
  customerId: string;
3390
3696
  /** The subscription ID. */
3391
3697
  subscriptionId: string;
3698
+ /** The payment provider the charge was routed to: stripe, commet, or dlocal. */
3699
+ provider: "stripe" | "commet" | "dlocal";
3392
3700
  /** Terminal dunning reason, usually the last processor decline code or "dunning_exhausted". */
3393
3701
  reason: string;
3394
3702
  }
@@ -3695,7 +4003,7 @@ interface CustomerUpdatedData {
3695
4003
  interface CustomerStateChangedData {
3696
4004
  /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
3697
4005
  customerId: string;
3698
- /** What caused the transition. One of: subscription_created, subscription_activated, subscription_canceled, plan_change, past_due, trial_started, trial_converted, trial_expired, cancellation_scheduled, cancellation_revoked, seats_updated, addon_activated, addon_deactivated, credits_depleted, balance_depleted, quota_exceeded. */
4006
+ /** What caused the transition. One of: subscription_created, subscription_activated, subscription_canceled, plan_change, past_due, trial_started, trial_converted, trial_expired, cancellation_scheduled, cancellation_revoked, seats_updated, addon_activated, addon_deactivated, credits_depleted, balance_depleted, quota_exceeded, plan_access_granted, plan_access_ended. */
3699
4007
  trigger: string;
3700
4008
  /** The customer's current subscription status, or "none" when no live subscription exists. Access is granted while trialing, active, or past_due — past_due is a permissive grace window during dunning. */
3701
4009
  status: string;
@@ -4350,7 +4658,7 @@ declare function createCommet<const TConfig extends BillingConfig>(_billingConfi
4350
4658
 
4351
4659
  declare function registerIntegration(name: string, version: string): void;
4352
4660
 
4353
- declare const API_VERSION = "2026-07-24";
4661
+ declare const API_VERSION = "2026-07-31";
4354
4662
  declare const SDK_VERSION: string;
4355
4663
 
4356
- export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type BalanceAdjustment, type BalanceDepletedData, type BalanceLowData, type BalanceToppedUpData, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSetSeatsParams, type CancelPaymentParams, type CancelSubscriptionParams, type ChangePlanParams, type ChargePaymentParams, type CheckUsageAvailabilityParams, type CheckoutReadyData, type ClaimLink, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreateMarketGroupParams, type CreateOfferParams, type CreatePaymentParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, type CreateWebhookEndpointParams, type CreatedApiKey, type CreatedSubscription, type CreatedWebhook, type CreditGrant, type CreditPack, type CreditPackListItem, type CreditsDepletedData, type CreditsExpiredData, type CreditsGrantedData, type CreditsLowData, type CreditsPurchasedData, type Customer, type CustomerBatch, type CustomerCreatedData, type CustomerStateChangedData, type CustomerUpdatedData, type DeactivateAddonParams, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeleteMarketGroupParams, type DeleteOfferParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookEndpointParams, type DeletedObject, type DeletedOffer, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DownloadInvoiceParams, type Feature, type FeatureAccess, type FeatureDef, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetFeatureParams, type GetInvoiceParams, type GetMarketGroupParams, type GetOfferParams, type GetPaymentParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookEndpointParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceCreatedData, type InvoiceDownload, type InvoiceListItem, type InvoiceOverdueData, type InvoiceType, type InvoiceUpcomingData, type InvoiceVoidedData, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListOffersParams, type ListPaymentsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhookEndpointsParams, type MarketGroup, type Offer, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethodAttachedData, type PaymentMethodUpdateCheckout, type PaymentMethodUpdatedData, type PaymentProvider, type PaymentReceivedData, type PaymentRecoveredData, type PaymentRefundedData, type PaymentRetryFailedData, type Payout, type PayoutAvailableData, type PayoutBankAccount, type PayoutCreatedData, type PayoutFailedData, type PayoutPaidData, type PayoutVerification, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGroup, type PlanGroupDetail, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PortalAccess, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type QuotaExceededData, type QuotaThresholdReachedData, type ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, type Refund, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatBalanceCollection, type SeatEvent, type SeatsLimitReachedData, type SeatsUpdatedData, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type SetUsageParams, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionPastDueData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionStatus, type SubscriptionSummary, type SubscriptionUpdatedData, type TestClock, type TestClockBilling, type TestWebhookEndpointParams, type Timezone, type TopupBalanceParams, type TrackUsageParams, type Transaction, type TransactionListItem, type TransactionRetry, type TransactionStatus, type TrialCheckoutReadyData, type TrialConvertedData, type TrialExpiredData, type TrialStartedData, type TrialWillEndData, type UncancelSubscriptionParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdateMarketGroupParams, type UpdateOfferParams, type UpdatePaymentMethodParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookEndpointParams, type UpsertRegionalPricesParams, type UsageAdjustment, type UsageCheck, type UsageEvent, type UsageQuota, type UsageQuotaEvent, type UsageRecordedData, type Webhook, type WebhookAddonRef, type WebhookBalance, type WebhookBankRef, type WebhookCardInfo, type WebhookCreditsBalance, type WebhookData, type WebhookEvent, type WebhookEventDataMap, type WebhookEventEnvelope, type WebhookEventHandler, type WebhookEventPayload, type WebhookPayload, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTest, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
4664
+ export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApplySubscriptionOfferParams, type BalanceAdjustment, type BalanceDepletedData, type BalanceLowData, type BalanceToppedUpData, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSetSeatsParams, type CancelPaymentParams, type CancelSubscriptionParams, type ChangePlanParams, type ChargePaymentParams, type CheckUsageAvailabilityParams, type CheckoutReadyData, type ClaimLink, Commet, CommetAPIError, type CommetClientOptions, CommetError, type CommetErrorContext, CommetValidationError, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerCreditParams, type CreateCustomerParams, type CreateFeatureParams, type CreateMarketParams, type CreateOfferParams, type CreatePaymentParams, type CreatePlanGrantParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, type CreateWebhookEndpointParams, type CreatedApiKey, type CreatedSubscription, type CreatedWebhook, type CreditGrant, type CreditPack, type CreditPackListItem, type CreditsDepletedData, type CreditsExpiredData, type CreditsGrantedData, type CreditsLowData, type CreditsPurchasedData, type Customer, type CustomerBatch, type CustomerCreatedData, type CustomerCredit, type CustomerCreditRevocation, type CustomerStateChangedData, type CustomerUpdatedData, type DeactivateAddonParams, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeleteMarketParams, type DeleteOfferParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookEndpointParams, type DeletedObject, type DeletedOffer, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DownloadInvoiceParams, type Feature, type FeatureAccess, type FeatureDef, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetFeatureParams, type GetInvoiceParams, type GetMarketParams, type GetOfferParams, type GetPaymentParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookEndpointParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceCreatedData, type InvoiceDownload, type InvoiceListItem, type InvoiceOverdueData, type InvoiceType, type InvoiceUpcomingData, type InvoiceVoidedData, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomerCreditsParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListOffersParams, type ListPaymentsParams, type ListPlanGrantsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhookEndpointsParams, type Market, type Offer, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethodAttachedData, type PaymentMethodUpdateCheckout, type PaymentMethodUpdatedData, type PaymentProvider, type PaymentReceivedData, type PaymentRecoveredData, type PaymentRefundedData, type PaymentRetryFailedData, type Payout, type PayoutAvailableData, type PayoutBankAccount, type PayoutCreatedData, type PayoutFailedData, type PayoutPaidData, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGrant, type PlanGroup, type PlanGroupDetail, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PortalAccess, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type QuotaExceededData, type QuotaThresholdReachedData, type ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, type Refund, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemoveSubscriptionOfferParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, type RevokeCustomerCreditParams, type RevokePlanGrantParams, SDK_VERSION, type SeatBalance, type SeatBalanceCollection, type SeatEvent, type SeatsLimitReachedData, type SeatsUpdatedData, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type SetUsageParams, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionOfferApplication, type SubscriptionOfferApplicationPhase, type SubscriptionPastDueData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionStatus, type SubscriptionSummary, type SubscriptionUpdatedData, type TestClock, type TestClockRun, type TestWebhookEndpointParams, type Timezone, type TopupBalanceParams, type TrackUsageParams, type Transaction, type TransactionListItem, type TransactionRetry, type TransactionStatus, type TrialCheckoutReadyData, type TrialConvertedData, type TrialExpiredData, type TrialStartedData, type TrialWillEndData, type UncancelSubscriptionParams, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdateMarketParams, type UpdateOfferParams, type UpdatePaymentMethodParams, type UpdatePlanFeatureParams, type UpdatePlanGrantParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookEndpointParams, type UpsertRegionalPricesParams, type UsageAdjustment, type UsageCheck, type UsageEvent, type UsageQuota, type UsageQuotaEvent, type UsageRecordedData, type Webhook, type WebhookAddonRef, type WebhookBalance, type WebhookBankRef, type WebhookCardInfo, type WebhookCreditsBalance, type WebhookData, type WebhookEvent, type WebhookEventDataMap, type WebhookEventEnvelope, type WebhookEventHandler, type WebhookEventPayload, type WebhookPayload, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTest, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };