@commet/node 9.10.0 → 9.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/index.d.mts +167 -73
  2. package/dist/index.d.ts +167 -73
  3. package/dist/index.js +16 -13
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +16 -13
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/api-reference/customers.md +3 -3
  8. package/docs/api-reference/features.md +1 -1
  9. package/docs/api-reference/index.md +1 -1
  10. package/docs/api-reference/invoices.md +4 -3
  11. package/docs/api-reference/plans.md +8 -4
  12. package/docs/api-reference/subscriptions.md +10 -6
  13. package/docs/api-reference/transactions.md +2 -1
  14. package/docs/documentation/error-handling.md +11 -0
  15. package/docs/documentation/invoicing/manage-invoices.md +1 -1
  16. package/docs/documentation/plans/add-ons.md +4 -2
  17. package/docs/documentation/plans/balance-and-top-ups.md +3 -1
  18. package/docs/documentation/plans/consumption-models.md +29 -1
  19. package/docs/documentation/plans/credit-packs.md +28 -8
  20. package/docs/documentation/plans/plan-versions.md +9 -7
  21. package/docs/documentation/sales/promotional-offers.md +1 -1
  22. package/docs/documentation/sales/regional-prices.md +1 -1
  23. package/docs/documentation/subscriptions/manage-subscriptions.md +1 -1
  24. package/docs/documentation/subscriptions/plan-grants.md +22 -6
  25. package/docs/errors/currency_held_by_balance_plan.md +22 -0
  26. package/docs/errors/currency_held_by_customer_credit.md +22 -0
  27. package/docs/errors/currency_held_by_fixed_amount_discount.md +22 -0
  28. package/docs/errors/currency_held_by_payment_method.md +22 -0
  29. package/docs/errors/currency_held_by_prepaid_period.md +22 -0
  30. package/docs/errors/currency_held_by_scheduled_pause.md +22 -0
  31. package/docs/errors/index.md +7 -1
  32. package/docs/errors/missing_regional_price.md +3 -3
  33. package/docs/knowledge-base/how-do-discounts-work.md +19 -1
  34. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +1 -1
  35. package/docs/manifest.json +37 -1
  36. package/docs/schemas.md +30 -16
  37. package/docs/webhooks.md +18 -17
  38. package/docs/webhooks.openapi.json +63 -37
  39. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -127,7 +127,7 @@ type BillingInterval = "weekly" | "monthly" | "quarterly" | "semiannual" | "year
127
127
  type ConsumptionModel = "metered" | "credits" | "balance";
128
128
  type FeatureType = "boolean" | "usage" | "seats" | "quota";
129
129
  type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation" | "one_time_payment" | "reactivation" | "resume" | "prepayment";
130
- type PaymentMethod = "card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix";
130
+ type PaymentMethod = "card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix" | "apple_pay" | "link";
131
131
  type PaymentProvider = "stripe" | "commet" | "dlocal";
132
132
  type SubPaymentMethod = "credit_card" | "debit_card" | "prepaid_card" | "bank_transfer" | "account_money";
133
133
  type SubscriptionStatus = "draft" | "pending_payment" | "trialing" | "active" | "past_due" | "paused" | "canceled";
@@ -193,6 +193,10 @@ interface BalanceAdjustment {
193
193
  }
194
194
  interface BalanceTopup {
195
195
  amount: number;
196
+ /** `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`. */
197
+ status: "succeeded" | "processing" | "requires_checkout";
198
+ /** Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`. */
199
+ checkoutUrl?: string;
196
200
  object: "balance_topup";
197
201
  livemode: boolean;
198
202
  }
@@ -313,6 +317,10 @@ interface CreatedWebhook {
313
317
  }
314
318
  interface CreditGrant {
315
319
  credits: number;
320
+ /** `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`. */
321
+ status: "succeeded" | "processing" | "requires_checkout";
322
+ /** Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`. */
323
+ checkoutUrl?: string;
316
324
  object: "credit_grant";
317
325
  livemode: boolean;
318
326
  }
@@ -376,6 +384,7 @@ interface CustomerBatch {
376
384
  email: string;
377
385
  fullName?: string | null;
378
386
  taxDocument?: string | null;
387
+ businessTaxId?: string;
379
388
  timezone?: string;
380
389
  metadata?: Record<string, unknown> | null;
381
390
  address?: {
@@ -542,8 +551,10 @@ type FeatureAccess = {
542
551
  creditsPerUnit: number;
543
552
  /** Actual credits deducted by this feature during the period. */
544
553
  creditsConsumed: number;
545
- /** Additional product units available from the current shared credit pool at this feature's conversion rate. */
546
- availableUnits: number;
554
+ /** Whether the plan credits are unlimited: usage never spends them and only the plan credit limit caps it. */
555
+ unlimited: boolean;
556
+ /** Additional product units available from the current shared credit pool at this feature's conversion rate. Absent when unlimited is true. */
557
+ availableUnits?: number;
547
558
  } | {
548
559
  /** Product usage deducts money from a shared balance. */
549
560
  model: "balance";
@@ -569,7 +580,9 @@ type FeatureAccess = {
569
580
  /** Lowercase ISO 4217 currency code. */
570
581
  currency: string;
571
582
  };
572
- /** Estimated additional units available from the current shared balance at this feature's fixed price. Absent for dynamic pricing. */
583
+ /** Whether the plan balance is unlimited: usage never spends it and only the plan balance limit caps it. */
584
+ unlimited: boolean;
585
+ /** Estimated additional units available from the current shared balance at this feature's fixed price. Absent for dynamic pricing and when unlimited is true. */
573
586
  availableUnits?: number;
574
587
  /** Price for one additional product unit. */
575
588
  unitPrice?: {
@@ -936,6 +949,8 @@ interface Plan {
936
949
  /** The most plan credits a subscription holds after a reset, including the credits that reset grants; credits above it expire. At least the included credits of every price. null means no limit other than the largest storable balance, 2,147,483,647 plan credits. */
937
950
  maxPlanCredits: number | null;
938
951
  } | null;
952
+ /** Credits plans only; null for other consumption models. true when the plan credits are unlimited: usage never spends them and only planCreditLimit caps it. */
953
+ unlimitedPlanCredits: boolean | null;
939
954
  /** Credits plans only. The most plan credits a subscription spends per day or per week; null means no limit. */
940
955
  planCreditLimit: {
941
956
  /** The most plan credits a subscription spends in one window. */
@@ -951,6 +966,8 @@ interface Plan {
951
966
  /** The most plan balance a subscription holds after a reset, in USD cents, including the balance that reset grants; balance above it expires. At least the included balance of every price. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. null means no limit other than the largest storable amount, 2,147,483,647 cents. */
952
967
  maxPlanBalance: number | null;
953
968
  } | null;
969
+ /** Balance plans only; null for other consumption models. true when the plan balance is unlimited: usage never spends it and only planBalanceLimit caps it. */
970
+ unlimitedPlanBalance: boolean | null;
954
971
  /** Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; null means no limit. */
955
972
  planBalanceLimit: {
956
973
  /** The most plan balance a subscription spends in one window, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. */
@@ -1056,6 +1073,11 @@ interface Plan {
1056
1073
  livemode: boolean;
1057
1074
  }
1058
1075
  type PlanChange = {
1076
+ outcome: "processing";
1077
+ invoiceId: string;
1078
+ object: "plan_change";
1079
+ livemode: boolean;
1080
+ } | {
1059
1081
  outcome: "requires_checkout";
1060
1082
  requiresCheckout: true;
1061
1083
  checkoutUrl: string;
@@ -1896,6 +1918,8 @@ interface Subscription {
1896
1918
  label: string;
1897
1919
  /** @format date-time */
1898
1920
  effectiveAt: string;
1921
+ /** The currency the subscription pays from the move on: its own, or usd when the move charges it in USD. */
1922
+ currency: string;
1899
1923
  } | null;
1900
1924
  planGrant?: {
1901
1925
  /** The active Plan Grant ID. */
@@ -1964,27 +1988,31 @@ interface Subscription {
1964
1988
  } | null;
1965
1989
  }>;
1966
1990
  credits: {
1967
- /** Plan credits left. Kept for compatibility; equal to `plan`. */
1968
- remaining: number;
1991
+ /** true when the plan credits are unlimited: usage never spends them and only the plan credit limit caps it. */
1992
+ unlimited: boolean;
1993
+ /** Plan credits left. Kept for compatibility; equal to `plan`. Omitted when `unlimited` is true. */
1994
+ remaining?: number;
1969
1995
  included: number;
1970
1996
  /** Purchased credits: purchases and manual adjustments. Spent after plan credits and kept until the subscription ends. */
1971
1997
  purchased: number;
1972
- /** Plan credits left this period. Spent first and replaced or rolled over at each reset; negative while overage is owed. */
1973
- plan: number;
1974
- /** Credits available: `plan` plus `purchased`. */
1975
- total: number;
1998
+ /** Plan credits left this period. Spent first and replaced or rolled over at each reset; negative while overage is owed. Omitted when `unlimited` is true. */
1999
+ plan?: number;
2000
+ /** Credits available: `plan` plus `purchased`. Omitted when `unlimited` is true. */
2001
+ total?: number;
1976
2002
  } | null;
1977
2003
  balance: {
1978
- /** Balance available in minor units of the subscription currency. Kept for compatibility; equal to `total`. */
1979
- remaining: number;
2004
+ /** true when the plan balance is unlimited: usage never spends it and only the plan balance limit caps it. */
2005
+ unlimited: boolean;
2006
+ /** Balance available in minor units of the subscription currency. Kept for compatibility; equal to `total`. Omitted when `unlimited` is true. */
2007
+ remaining?: number;
1980
2008
  included: number;
1981
2009
  currency: string;
1982
- /** Plan balance left this period, in minor units. Spent first and replaced or rolled over at each reset; negative while overage is owed. */
1983
- plan: number;
2010
+ /** Plan balance left this period, in minor units. Spent first and replaced or rolled over at each reset; negative while overage is owed. Omitted when `unlimited` is true. */
2011
+ plan?: number;
1984
2012
  /** Purchased balance in minor units: top-ups and manual adjustments. Spent after the plan balance and kept until the subscription ends. */
1985
2013
  purchased: number;
1986
- /** Balance available in minor units: `plan` plus `purchased`. */
1987
- total: number;
2014
+ /** Balance available in minor units: `plan` plus `purchased`. Omitted when `unlimited` is true. */
2015
+ total?: number;
1988
2016
  } | null;
1989
2017
  priceId: string | null;
1990
2018
  object: "subscription";
@@ -1992,8 +2020,11 @@ interface Subscription {
1992
2020
  }
1993
2021
  interface SubscriptionAddon {
1994
2022
  addonId: string;
1995
- status: "active";
2023
+ /** `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`. */
2024
+ status: "active" | "processing" | "requires_checkout";
1996
2025
  proratedCharge: number;
2026
+ /** Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`. */
2027
+ checkoutUrl?: string;
1997
2028
  object: "subscription_addon";
1998
2029
  livemode: boolean;
1999
2030
  }
@@ -2246,10 +2277,12 @@ interface Transaction {
2246
2277
  taxAmount: number | null;
2247
2278
  /** Amount in the charge currency's smallest unit, as presented to the customer. Set for non-USD charges; null when the charge was made in USD. */
2248
2279
  presentmentAmount: number | null;
2280
+ /** Cumulative confirmed refunds in the payment currency’s smallest unit. */
2281
+ amountRefunded: number;
2249
2282
  currency: string;
2250
2283
  /** The payment provider the charge was routed to: stripe, commet, or dlocal. */
2251
2284
  provider: PaymentProvider;
2252
- /** The method used for this charge: card, oxxo, or mercado_pago. Null when unknown. */
2285
+ /** The method used for this charge: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
2253
2286
  paymentMethod: PaymentMethod | null;
2254
2287
  /** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
2255
2288
  subPaymentMethod: SubPaymentMethod | null;
@@ -2291,10 +2324,12 @@ interface TransactionListItem {
2291
2324
  taxAmount: number | null;
2292
2325
  /** Amount in the charge currency's smallest unit, as presented to the customer. Set for non-USD charges; null when the charge was made in USD. */
2293
2326
  presentmentAmount: number | null;
2327
+ /** Cumulative confirmed refunds in the payment currency’s smallest unit. */
2328
+ amountRefunded: number;
2294
2329
  currency: string;
2295
2330
  /** The payment provider the charge was routed to: stripe, commet, or dlocal. */
2296
2331
  provider: PaymentProvider;
2297
- /** The method used for this charge: card, oxxo, or mercado_pago. Null when unknown. */
2332
+ /** The method used for this charge: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
2298
2333
  paymentMethod: PaymentMethod | null;
2299
2334
  /** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
2300
2335
  subPaymentMethod: SubPaymentMethod | null;
@@ -2357,9 +2392,13 @@ type UsageCheck = {
2357
2392
  consumptionModel: "credits";
2358
2393
  creditsPerUnit: number;
2359
2394
  estimatedCredits: number;
2360
- planCredits: number;
2395
+ /** true when the plan credits are unlimited: usage never spends them and only planCreditLimit caps it. */
2396
+ unlimited: boolean;
2397
+ /** Plan credits left. Omitted when unlimited is true. */
2398
+ planCredits?: number;
2361
2399
  purchasedCredits: number;
2362
- totalCredits: number;
2400
+ /** planCredits plus purchasedCredits. Omitted when unlimited is true. */
2401
+ totalCredits?: number;
2363
2402
  planCreditLimit: {
2364
2403
  /** The most plan credits the subscription spends per window. */
2365
2404
  credits: number;
@@ -2389,14 +2428,16 @@ type UsageCheck = {
2389
2428
  consumptionModel: "balance";
2390
2429
  unitPrice: number;
2391
2430
  estimatedAmount: number;
2392
- /** The available balance, plan plus purchased, in rate scale (10000 = 1.00 of the subscription currency). Equal to totalBalance. */
2393
- currentBalance: number;
2394
- /** The plan part of the balance in rate scale. Consumed first, replaced or rolled over at each reset, and negative while overage is owed. */
2395
- planBalance: number;
2431
+ /** true when the plan balance is unlimited: usage never spends it and only planBalanceLimit caps it. */
2432
+ unlimited: boolean;
2433
+ /** The available balance, plan plus purchased, in rate scale (10000 = 1.00 of the subscription currency). Equal to totalBalance. Omitted when unlimited is true. */
2434
+ currentBalance?: number;
2435
+ /** The plan part of the balance in rate scale. Consumed first, replaced or rolled over at each reset, and negative while overage is owed. Omitted when unlimited is true. */
2436
+ planBalance?: number;
2396
2437
  /** The purchased part of the balance in rate scale: top-ups and adjustments. Consumed after the plan part and kept until the subscription ends. */
2397
2438
  purchasedBalance: number;
2398
- /** planBalance plus purchasedBalance, in rate scale. */
2399
- totalBalance: number;
2439
+ /** planBalance plus purchasedBalance, in rate scale. Omitted when unlimited is true. */
2440
+ totalBalance?: number;
2400
2441
  planBalanceLimit: {
2401
2442
  /** The most plan balance the subscription spends per window, in rate scale (10000 = 1.00 of the subscription currency). */
2402
2443
  amount: number;
@@ -2434,7 +2475,10 @@ interface UsageEvent {
2434
2475
  consumption?: {
2435
2476
  model: "credits" | "balance";
2436
2477
  deducted: number;
2437
- remaining: number;
2478
+ /** true when the plan credits or plan balance are unlimited: usage never spends them and only the plan limit caps it. */
2479
+ unlimited: boolean;
2480
+ /** Plan plus purchased amount left after this event. Omitted when unlimited is true. */
2481
+ remaining?: number;
2438
2482
  blocked: boolean;
2439
2483
  /** Credits consumption only, omitted for balance. The plan credit limit after this event; null when the plan has no limit. */
2440
2484
  planCreditLimit?: {
@@ -2514,14 +2558,16 @@ interface WebhookAddonRef {
2514
2558
  name: string;
2515
2559
  }
2516
2560
  interface WebhookBalance {
2517
- /** The available balance, plan plus purchased, in rate scale. Equal to totalBalance. */
2518
- currentBalance: number;
2519
- /** The plan part in rate scale: spent first, replaced or rolled over at each reset, negative while overage is owed. */
2520
- planBalance: number;
2561
+ /** true when the plan balance is unlimited: usage never spends it and only the plan balance limit caps it. */
2562
+ unlimited: boolean;
2563
+ /** The available balance, plan plus purchased, in rate scale. Equal to totalBalance. Omitted when unlimited is true. */
2564
+ currentBalance?: number;
2565
+ /** The plan part in rate scale: spent first, replaced or rolled over at each reset, negative while overage is owed. Omitted when unlimited is true. */
2566
+ planBalance?: number;
2521
2567
  /** The purchased part in rate scale: top-ups and manual adjustments, spent after the plan part and kept until the subscription ends. */
2522
2568
  purchasedBalance: number;
2523
- /** planBalance plus purchasedBalance, in rate scale. */
2524
- totalBalance: number;
2569
+ /** planBalance plus purchasedBalance, in rate scale. Omitted when unlimited is true. */
2570
+ totalBalance?: number;
2525
2571
  }
2526
2572
  interface WebhookBankRef {
2527
2573
  bankName: string | null;
@@ -2534,9 +2580,13 @@ interface WebhookCardInfo {
2534
2580
  expYear: number;
2535
2581
  }
2536
2582
  interface WebhookCreditsBalance {
2537
- planCredits: number;
2583
+ /** true when the plan credits are unlimited: usage never spends them and only the plan credit limit caps it. */
2584
+ unlimited: boolean;
2585
+ /** Plan credits left. Omitted when unlimited is true. */
2586
+ planCredits?: number;
2538
2587
  purchasedCredits: number;
2539
- totalCredits: number;
2588
+ /** planCredits plus purchasedCredits. Omitted when unlimited is true. */
2589
+ totalCredits?: number;
2540
2590
  }
2541
2591
  interface WebhookPlanGrantTimelineEvent {
2542
2592
  /** The public ID of this plan grant event. */
@@ -2861,7 +2911,7 @@ interface UpdateCustomerParams {
2861
2911
  email?: string;
2862
2912
  fullName?: string;
2863
2913
  taxDocument?: string;
2864
- /** Business tax ID, such as an EU VAT number or a Peruvian RUC, for the country of the customer's address. Accepted only where Commet collects tax; a valid ID replaces consumer tax with the business treatment. Send null to remove it. */
2914
+ /** Business tax ID, such as an EU VAT number, a Peruvian RUC or an Argentine CUIT, for the country of the customer's address; its type comes from that country. Where Commet collects tax and that ID exempts business buyers, a valid ID replaces consumer tax with the business treatment; elsewhere it is stored as sent and does not change any charge. Send null to remove it. */
2865
2915
  businessTaxId?: string | null;
2866
2916
  externalId?: string;
2867
2917
  timezone?: Timezone;
@@ -2883,6 +2933,8 @@ interface BatchCreateCustomersParams {
2883
2933
  externalId?: string;
2884
2934
  fullName?: string;
2885
2935
  taxDocument?: string;
2936
+ /** Business tax ID, such as an EU VAT number, a Peruvian RUC or an Argentine CUIT, for the country of the customer's address; its type comes from that country. Where Commet collects tax and that ID exempts business buyers, a valid ID replaces consumer tax with the business treatment; elsewhere it is stored as sent and does not change any charge. */
2937
+ businessTaxId?: string;
2886
2938
  timezone?: Timezone;
2887
2939
  metadata?: Record<string, unknown>;
2888
2940
  address?: {
@@ -2908,7 +2960,7 @@ interface CreateCustomerParams {
2908
2960
  externalId?: string;
2909
2961
  fullName?: string;
2910
2962
  taxDocument?: string;
2911
- /** Business tax ID, such as an EU VAT number or a Peruvian RUC, for the country of the customer's address. Accepted only where Commet collects tax; a valid ID replaces consumer tax with the business treatment. */
2963
+ /** Business tax ID, such as an EU VAT number, a Peruvian RUC or an Argentine CUIT, for the country of the customer's address; its type comes from that country. Where Commet collects tax and that ID exempts business buyers, a valid ID replaces consumer tax with the business treatment; elsewhere it is stored as sent and does not change any charge. */
2912
2964
  businessTaxId?: string;
2913
2965
  address?: {
2914
2966
  line1: string;
@@ -3017,7 +3069,7 @@ declare class FeaturesResource {
3017
3069
  get(params: GetFeatureParams, options?: RequestOptions): Promise<Feature>;
3018
3070
  /** Update a feature's name, description, or unit name. At least one field must be provided. */
3019
3071
  update(params: UpdateFeatureParams, options?: RequestOptions): Promise<Feature>;
3020
- /** Delete a feature. Fails if the feature is attached to active plans or has an active add-on. */
3072
+ /** Delete a feature. Fails while a plan's current version, a running experiment or a draft includes it, or while it has an active add-on. Subscribers whose plan version includes it keep it, and its code can be used by a new feature right away. */
3021
3073
  delete(params: DeleteFeatureParams, options?: RequestOptions): Promise<DeletedObject>;
3022
3074
  /** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
3023
3075
  list(): Promise<{
@@ -3041,7 +3093,6 @@ interface SendInvoiceParams {
3041
3093
  }
3042
3094
  interface UpdateInvoiceStatusParams {
3043
3095
  id: string;
3044
- status: "paid" | "void";
3045
3096
  }
3046
3097
  interface ListInvoicesParams {
3047
3098
  cursor?: string;
@@ -3065,8 +3116,11 @@ declare class InvoicesResource {
3065
3116
  get(params: GetInvoiceParams, options?: RequestOptions): Promise<Invoice>;
3066
3117
  /** Send the invoice to the customer via email. */
3067
3118
  send(params: SendInvoiceParams, options?: RequestOptions): Promise<SentInvoice>;
3068
- /** Mark an outstanding invoice as "paid" or "void" and return the updated invoice. Cannot change the status of already paid or voided invoices. */
3069
- updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<Invoice>;
3119
+ /**
3120
+ * Deprecated. No longer changes the invoice. An invoice is paid when its charge settles: to collect a past-due subscription, reactivate it or send the customer a recovery link.
3121
+ * @deprecated
3122
+ */
3123
+ updateStatus(params: UpdateInvoiceStatusParams, options?: RequestOptions): Promise<void>;
3070
3124
  /** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
3071
3125
  list(params?: ListInvoicesParams, options?: RequestOptions): Promise<{
3072
3126
  object: "list";
@@ -3365,6 +3419,8 @@ type PublishPlanDraftParams = {
3365
3419
  seatLimit?: true;
3366
3420
  /** Add-ons it stops paying at renewal. */
3367
3421
  removeAddonIds?: Array<string>;
3422
+ /** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
3423
+ currency?: string;
3368
3424
  }>;
3369
3425
  /** Check everything without publishing. */
3370
3426
  preview?: boolean;
@@ -3394,6 +3450,8 @@ type PublishPlanDraftParams = {
3394
3450
  seatLimit?: true;
3395
3451
  /** Add-ons it stops paying at renewal. */
3396
3452
  removeAddonIds?: Array<string>;
3453
+ /** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
3454
+ currency?: string;
3397
3455
  }>;
3398
3456
  /** Check everything without publishing. */
3399
3457
  preview?: boolean;
@@ -3472,10 +3530,14 @@ interface UpdatePlanDraftParams {
3472
3530
  freeIncludedBalance?: number | null;
3473
3531
  unusedPlanCredits?: "expire" | "roll_over";
3474
3532
  maxPlanCredits?: number | null;
3533
+ /** Credits plans only. true makes the plan credits unlimited: usage never spends them, only planCreditLimit caps it, and every price and the free plan include 0 credits. */
3534
+ unlimitedPlanCredits?: boolean;
3475
3535
  planCreditLimit?: number | null;
3476
3536
  planCreditLimitInterval?: "day" | "week" | null;
3477
3537
  unusedPlanBalance?: "expire" | "roll_over";
3478
3538
  maxPlanBalance?: number | null;
3539
+ /** Balance plans only. true makes the plan balance unlimited: usage never spends it, only planBalanceLimit caps it, and every price, country and the free plan include no balance. */
3540
+ unlimitedPlanBalance?: boolean;
3479
3541
  planBalanceLimit?: number | null;
3480
3542
  planBalanceLimitInterval?: "day" | "week" | null;
3481
3543
  blockOnExhaustion?: boolean;
@@ -3514,6 +3576,8 @@ interface ArchivePlanExperimentParams {
3514
3576
  seatLimit?: true;
3515
3577
  /** Add-ons it stops paying at renewal. */
3516
3578
  removeAddonIds?: Array<string>;
3579
+ /** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
3580
+ currency?: string;
3517
3581
  }>;
3518
3582
  /** Check the archive and the move without changing anything. */
3519
3583
  preview?: boolean;
@@ -3648,6 +3712,8 @@ type CreatePlanMoveParams = {
3648
3712
  seatLimit?: true;
3649
3713
  /** Add-ons it stops paying at renewal. */
3650
3714
  removeAddonIds?: Array<string>;
3715
+ /** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
3716
+ currency?: string;
3651
3717
  }>;
3652
3718
  /** Check every subscriber without moving anyone. */
3653
3719
  preview?: boolean;
@@ -3669,6 +3735,8 @@ type CreatePlanMoveParams = {
3669
3735
  seatLimit?: true;
3670
3736
  /** Add-ons it stops paying at renewal. */
3671
3737
  removeAddonIds?: Array<string>;
3738
+ /** usd to charge it in USD from its renewal when the version does not sell the currency it pays, or the USD price of its country. */
3739
+ currency?: string;
3672
3740
  }>;
3673
3741
  /** Check every subscriber without moving anyone. */
3674
3742
  preview?: boolean;
@@ -3783,6 +3851,8 @@ interface UpdatePlanParams {
3783
3851
  /** The most plan credits a subscription holds after a reset, including the credits that reset grants; credits above it expire. At least the included credits of every price. null means no limit other than the largest storable balance, 2,147,483,647 plan credits. */
3784
3852
  maxPlanCredits: number | null;
3785
3853
  };
3854
+ /** Credits plans only. true makes the plan credits unlimited: usage never spends them, only planCreditLimit caps it, and every price includes 0 credits. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
3855
+ unlimitedPlanCredits?: boolean;
3786
3856
  /** Credits plans only. The most plan credits a subscription spends per day or per week; null removes the limit. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
3787
3857
  planCreditLimit?: {
3788
3858
  /** The most plan credits a subscription spends in one window. */
@@ -3798,6 +3868,8 @@ interface UpdatePlanParams {
3798
3868
  /** The most plan balance a subscription holds after a reset, in USD cents, including the balance that reset grants; balance above it expires. At least the included balance of every price. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. null means no limit other than the largest storable amount, 2,147,483,647 cents. */
3799
3869
  maxPlanBalance: number | null;
3800
3870
  };
3871
+ /** Balance plans only. true makes the plan balance unlimited: usage never spends it, only planBalanceLimit caps it, and every price and country includes no balance. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
3872
+ unlimitedPlanBalance?: boolean;
3801
3873
  /** Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; null removes the limit. Changing it publishes a new version of the plan; each subscription stays on its version until moved. */
3802
3874
  planBalanceLimit?: {
3803
3875
  /** The most plan balance a subscription spends in one window, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. */
@@ -3877,6 +3949,8 @@ interface CreatePlanParams {
3877
3949
  /** The most plan credits a subscription holds after a reset, including the credits that reset grants; credits above it expire. At least the included credits of every price. null means no limit other than the largest storable balance, 2,147,483,647 plan credits. */
3878
3950
  maxPlanCredits: number | null;
3879
3951
  };
3952
+ /** Credits plans only. true makes the plan credits unlimited: usage never spends them, only planCreditLimit caps it, and every price includes 0 credits. Omitted means false. */
3953
+ unlimitedPlanCredits?: boolean;
3880
3954
  /** Credits plans only. The most plan credits a subscription spends per day or per week; omitted or null means no limit. */
3881
3955
  planCreditLimit?: {
3882
3956
  /** The most plan credits a subscription spends in one window. */
@@ -3892,6 +3966,8 @@ interface CreatePlanParams {
3892
3966
  /** The most plan balance a subscription holds after a reset, in USD cents, including the balance that reset grants; balance above it expires. At least the included balance of every price. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. null means no limit other than the largest storable amount, 2,147,483,647 cents. */
3893
3967
  maxPlanBalance: number | null;
3894
3968
  };
3969
+ /** Balance plans only. true makes the plan balance unlimited: usage never spends it, only planBalanceLimit caps it, and every price and country includes no balance. Omitted means false. */
3970
+ unlimitedPlanBalance?: boolean;
3895
3971
  /** Balance plans only. The most plan balance a subscription spends per day or per week, in USD cents; omitted or null means no limit. */
3896
3972
  planBalanceLimit?: {
3897
3973
  /** The most plan balance a subscription spends in one window, in USD cents. Other currencies convert it with the plan's exchange rate unless the dashboard sets a custom amount for that currency. */
@@ -4193,6 +4269,8 @@ interface DeactivateAddonParams {
4193
4269
  interface ActivateAddonParams {
4194
4270
  id: string;
4195
4271
  addonId: string;
4272
+ /** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way. */
4273
+ successUrl?: string;
4196
4274
  }
4197
4275
  interface GetSubscriptionAutoTopUpParams {
4198
4276
  id: string;
@@ -4217,6 +4295,8 @@ interface TopupBalanceParams {
4217
4295
  id: string;
4218
4296
  /** The amount to add, in minor units of the subscription currency (cents; whole units for zero-decimal currencies). */
4219
4297
  amount: number;
4298
+ /** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way. */
4299
+ successUrl?: string;
4220
4300
  }
4221
4301
  interface CancelSubscriptionParams {
4222
4302
  id: string;
@@ -4245,14 +4325,20 @@ interface ChangeSubscriptionVersionParams {
4245
4325
  planVersionId: string;
4246
4326
  /** now changes features, limits and the included credits or balance at once (the included difference is added to or subtracted from the plan credits or plan balance: an increase first pays any plan-part debt, a decrease never creates new debt, and purchased credits and purchased balance are untouched) and charges the new price from the next renewal. period_end changes everything at the next renewal. There is never a proration charge or refund. */
4247
4327
  effective: "now" | "period_end";
4328
+ /** usd to charge the subscription in USD from its next renewal when the version does not sell the currency it pays, or the USD price of its country: it pays the version's USD price for its country, or the USD base price. The whole move then happens at that renewal, even with effective now. Rejected with missing_regional_price when the version still sells what the subscription pays or for another currency, and with a currency_held_by code naming what keeps it in its currency: currency_held_by_payment_method (it pays through dLocal), currency_held_by_customer_credit, currency_held_by_balance_plan, currency_held_by_fixed_amount_discount, currency_held_by_prepaid_period or currency_held_by_scheduled_pause. */
4329
+ currency?: string;
4248
4330
  }
4249
4331
  type PurchaseCreditsParams = {
4250
4332
  id: string;
4251
4333
  creditPackId: string;
4252
4334
  quantity?: never;
4335
+ /** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way. */
4336
+ successUrl?: string;
4253
4337
  } | {
4254
4338
  id: string;
4255
4339
  quantity: number;
4340
+ /** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way. */
4341
+ successUrl?: string;
4256
4342
  };
4257
4343
  interface ApplySubscriptionOfferParams {
4258
4344
  id: string;
@@ -4340,7 +4426,7 @@ type CreateSubscriptionParams = {
4340
4426
  /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
4341
4427
  provider?: "stripe" | "commet" | "dlocal" | string;
4342
4428
  /** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
4343
- paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
4429
+ paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
4344
4430
  name?: string;
4345
4431
  /** @format date-time */
4346
4432
  startDate?: string;
@@ -4366,7 +4452,7 @@ type CreateSubscriptionParams = {
4366
4452
  /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
4367
4453
  provider?: "stripe" | "commet" | "dlocal" | string;
4368
4454
  /** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
4369
- paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
4455
+ paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
4370
4456
  name?: string;
4371
4457
  /** @format date-time */
4372
4458
  startDate?: string;
@@ -4393,7 +4479,7 @@ type CreateSubscriptionParams = {
4393
4479
  /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
4394
4480
  provider?: "stripe" | "commet" | "dlocal" | string;
4395
4481
  /** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
4396
- paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
4482
+ paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
4397
4483
  name?: string;
4398
4484
  /** @format date-time */
4399
4485
  startDate?: string;
@@ -4419,7 +4505,7 @@ type CreateSubscriptionParams = {
4419
4505
  /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
4420
4506
  provider?: "stripe" | "commet" | "dlocal" | string;
4421
4507
  /** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
4422
- paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
4508
+ paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
4423
4509
  name?: string;
4424
4510
  /** @format date-time */
4425
4511
  startDate?: string;
@@ -4446,7 +4532,7 @@ type CreateSubscriptionParams = {
4446
4532
  /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
4447
4533
  provider?: "stripe" | "commet" | "dlocal" | string;
4448
4534
  /** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
4449
- paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
4535
+ paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
4450
4536
  name?: string;
4451
4537
  /** @format date-time */
4452
4538
  startDate?: string;
@@ -4473,7 +4559,7 @@ type CreateSubscriptionParams = {
4473
4559
  /** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
4474
4560
  provider?: "stripe" | "commet" | "dlocal" | string;
4475
4561
  /** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
4476
- paymentMethodTypes?: Array<"card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix">;
4562
+ paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
4477
4563
  name?: string;
4478
4564
  /** @format date-time */
4479
4565
  startDate?: string;
@@ -4498,7 +4584,7 @@ declare class SubscriptionsResource {
4498
4584
  constructor(httpClient: CommetHTTPClient);
4499
4585
  /** Deactivate an add-on from a subscription. */
4500
4586
  deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<DeletedSubscriptionAddon>;
4501
- /** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable. */
4587
+ /** Activate an add-on on a subscription. Creates the activation invoice and charges a prorated amount for the current billing period; the add-on is active once the payment is confirmed. Without a saved payment method, send successUrl to receive a checkout that charges the activation and saves the method. Rejected with 409 while the add-on is active or an activation of it is still processing. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable. */
4502
4588
  activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<SubscriptionAddon>;
4503
4589
  /** Read whether the subscription tops up automatically with its saved payment method when its available credits or balance reach a threshold, with the top-ups used this period and the last failure. */
4504
4590
  getAutoTopUp(params: GetSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
@@ -4506,15 +4592,15 @@ declare class SubscriptionsResource {
4506
4592
  updateAutoTopUp(params: UpdateSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
4507
4593
  /** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
4508
4594
  adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<BalanceAdjustment>;
4509
- /** Top up a balance subscription. Charges the customer's payment method for the amount plus tax, adds it to the subscription's purchased balance (after paying back any overage owed on the plan balance), creates its invoice and emits `balance.topped_up`. Purchased balance is spent after the plan balance and is kept until the subscription ends. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge. */
4595
+ /** Top up a balance subscription. Creates the top-up invoice and charges the customer's payment method for the amount plus tax. Once the payment is confirmed, adds the amount to the subscription's purchased balance (after paying back any overage owed on the plan balance), marks the invoice paid and emits `balance.topped_up`. Purchased balance is spent after the plan balance and is kept until the subscription ends. Without a saved payment method, send successUrl to receive a checkout that charges the top-up and saves the method. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge. */
4510
4596
  topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<BalanceTopup>;
4511
4597
  /** Cancel immediately or at period end and return the updated subscription. */
4512
4598
  cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
4513
4599
  /** Upgrade or change billing interval immediately, optionally applying an Offer by offerId or the Offer of a promoCode. Scheduled changes accept neither offerId nor promoCode. From a free plan, a promoCode opens the checkout with the code applied and counts its use when the checkout is paid; without offerId or promoCode, a destination price whose free trial requires no payment method starts that trial right away without checkout. During a trial without a payment method, an immediate change returns 409 no_payment_method; scheduled changes still apply. */
4514
4600
  changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<PlanChange>;
4515
- /** Move a subscription to a newer published version of its plan, now or at the end of the period, without proration; an older version is rejected with version_not_newer, and a subscription on a running experiment moves only to a later version of that experiment. The subscription keeps its currency and its price: a destination that does not sell its currency is rejected with missing_regional_price, and one that does not sell the price it pays with price_not_found. A free version moves only to a free version and a paid one only to a paid one (validation_error). A subscription whose usage does not fit the destination, or with an active add-on the destination does not sell, is not moved either, and the error says why. Each change is recorded as a move of this one subscription in the plan's moves. Repeating the same request changes nothing; a new one replaces the pending move. */
4601
+ /** Move a subscription to a newer published version of its plan, now or at the end of the period, without proration; an older version is rejected with version_not_newer, and a subscription on a running experiment moves only to a later version of that experiment. The subscription keeps its currency and its price: a destination that does not sell its currency is rejected with missing_regional_price unless currency asks to charge it in USD from its renewal, and one that does not sell the price it pays with price_not_found. A free version moves only to a free version and a paid one only to a paid one (validation_error). A subscription whose usage does not fit the destination, or with an active add-on the destination does not sell, is not moved either, and the error says why. Each change is recorded as a move of this one subscription in the plan's moves. Repeating the same request changes nothing; a new one replaces the pending move. */
4516
4602
  changeVersion(params: ChangeSubscriptionVersionParams, options?: RequestOptions): Promise<Subscription>;
4517
- /** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Charges the saved payment method and adds purchased credits. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
4603
+ /** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Creates the purchase invoice, charges the saved payment method and adds the purchased credits once the payment is confirmed. Without a saved payment method, send successUrl to receive a checkout that charges the purchase and saves the method. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
4518
4604
  purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
4519
4605
  /** Apply a direct Offer to a subscription. On a pending checkout it quotes or replaces the checkout discount, which starts after the plan price trial when there is one, and the existing checkout URL remains unchanged. On an active subscription it applies the Offer immediately with its discount phases starting at the next billing cycle; the call is rejected while another applied Offer still has active or upcoming discount phases. */
4520
4606
  applyOffer(params: ApplySubscriptionOfferParams, options?: RequestOptions): Promise<Subscription>;
@@ -4532,7 +4618,7 @@ declare class SubscriptionsResource {
4532
4618
  createPrepaidPeriodsCheckout(params: CreatePrepaidPeriodsCheckoutParams, options?: RequestOptions): Promise<PrepaidPeriodsCheckout>;
4533
4619
  /** Preview proration details for an immediate plan change without applying it. Free-to-paid changes are never scheduled and the change-plan endpoint returns hosted checkout for them, except a change without offerId or promoCode to a price whose free trial needs no payment method, for a customer who never had that plan: it starts the trial at once, so the preview reports nothing due today. For paid plans, interval direction takes precedence: a longer interval is immediate and a shorter interval is scheduled. When the interval is unchanged, a higher-sort-order plan is immediate and a lower-sort-order plan is scheduled. A paid-to-free change is always scheduled. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Scheduled changes return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with an Offer, or promoCode to quote it with the Offer of a promo code validated with the checkout's rules. */
4534
4620
  previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<PreviewChange>;
4535
- /** 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. */
4621
+ /** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period; when that invoice totals zero, for example under an Offer, it is marked paid without a charge and the subscription becomes active at once, still requiring a saved payment method. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply an Offer by offerId; past-due recovery cannot. */
4536
4622
  reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ReactivatedSubscription>;
4537
4623
  /** 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. */
4538
4624
  createRecoveryLink(params: CreateSubscriptionRecoveryLinkParams, options?: RequestOptions): Promise<RecoveryLink>;
@@ -4581,6 +4667,8 @@ declare class TestClockResource {
4581
4667
 
4582
4668
  interface RefundTransactionParams {
4583
4669
  id: string;
4670
+ /** Amount returned to the customer, including tax, in the payment currency’s smallest unit. Omit to refund the remainder. */
4671
+ amount?: number;
4584
4672
  }
4585
4673
  interface RetryTransactionParams {
4586
4674
  id: string;
@@ -4597,7 +4685,7 @@ interface ListTransactionsParams {
4597
4685
  declare class TransactionsResource {
4598
4686
  private httpClient;
4599
4687
  constructor(httpClient: CommetHTTPClient);
4600
- /** Issue a full refund and return the provider-neutral refund resource with its actual status. */
4688
+ /** Refund a positive amount in the payment currency’s smallest unit, or omit amount to refund the remaining amount. Returns the refund resource with its actual status. */
4601
4689
  refund(params: RefundTransactionParams, options?: RequestOptions): Promise<Refund>;
4602
4690
  /** Retry a failed subscription renewal and return an honest retry result. The original failed transaction remains immutable. */
4603
4691
  retry(params: RetryTransactionParams, options?: RequestOptions): Promise<TransactionRetry>;
@@ -4736,7 +4824,7 @@ interface SubscriptionActivatedData {
4736
4824
  /** The payment provider that processed the activating charge: stripe, commet, or dlocal. Null when the subscription activated without a charge (zero-total or setup-based activation). */
4737
4825
  provider: "stripe" | "commet" | "dlocal" | null;
4738
4826
  }
4739
- /** Fired when a canceled subscription is reactivated and its reactivation charge succeeds. The subscription returns to active with a fresh invoice and a billing period anchored to the reactivation date. Distinct from subscription.activated (first activation) and payment.recovered (past_due recovery, which keeps the original anchor). */
4827
+ /** Fired when a canceled subscription is reactivated: its reactivation charge succeeds, or its reactivation invoice totals zero and is paid without a charge. The subscription returns to active with a fresh invoice and a billing period anchored to the reactivation date. Distinct from subscription.activated (first activation) and payment.recovered (past_due recovery, which keeps the original anchor). */
4740
4828
  interface SubscriptionReactivatedData {
4741
4829
  /** The subscription ID. */
4742
4830
  subscriptionId: string;
@@ -4758,7 +4846,7 @@ interface SubscriptionReactivatedData {
4758
4846
  invoiceTotal: number;
4759
4847
  /** The invoice currency code. */
4760
4848
  invoiceCurrency: string;
4761
- /** The payment provider that processed the reactivation charge: stripe, commet, or dlocal. */
4849
+ /** The subscription's payment provider, which processed the reactivation charge: stripe, commet, or dlocal. A reactivation whose invoice totals zero runs no charge and still carries the subscription's provider. */
4762
4850
  provider: "stripe" | "commet" | "dlocal";
4763
4851
  }
4764
4852
  /** Fired when a period-end pause is scheduled. Access and billing continue until effectiveAt. */
@@ -4990,7 +5078,7 @@ interface SubscriptionVersionChangeCanceledData {
4990
5078
  customerId: string;
4991
5079
  /** The version the subscription was going to move to. */
4992
5080
  toVersionId: string;
4993
- /** Why the move was canceled: canceled_by_merchant, version_change_failed when the move could not be applied at renewal, or the code of what the subscription no longer fits (addon_unavailable, seat_limit_exceeded, price_not_found, missing_regional_price). */
5081
+ /** Why the move was canceled: canceled_by_merchant, version_change_failed when the move could not be applied at renewal, the code of what the subscription no longer fits (addon_unavailable, seat_limit_exceeded, price_not_found, missing_regional_price), or, for a move that charges it in USD, what keeps it in its currency (currency_held_by_payment_method, currency_held_by_customer_credit, currency_held_by_balance_plan, currency_held_by_fixed_amount_discount, currency_held_by_prepaid_period, currency_held_by_scheduled_pause). */
4994
5082
  reason: string;
4995
5083
  }
4996
5084
  /** Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. past_due is a grace window, not a cutoff: usage and seats keep working while new purchases are blocked, and dunning retries the charge — use this to notify the customer and recover the payment. */
@@ -5049,7 +5137,7 @@ interface TrialExpiredData {
5049
5137
  /** ISO 8601 datetime when the trial ended. */
5050
5138
  trialEndsAt: string;
5051
5139
  }
5052
- /** Predictive event fired once, 3 days before a trial ends. Use it to remind the customer that billing starts soon. Emitted by a daily scan with a deterministic idempotency key, so it never fires twice for the same trial end date. */
5140
+ /** Predictive event fired once, 3 days before a trial ends. Use it to remind the customer that billing starts soon. Emitted by a recurring scan with a deterministic idempotency key, so it never fires twice for the same trial end date. */
5053
5141
  interface TrialWillEndData {
5054
5142
  /** The subscription ID. */
5055
5143
  subscriptionId: string;
@@ -5126,7 +5214,7 @@ interface PaymentReceivedData {
5126
5214
  paymentTransactionId: string | null;
5127
5215
  /** The payment provider the charge was routed to: stripe, commet, or dlocal. Null for billing-only charges with no Commet ledger row. */
5128
5216
  provider: "stripe" | "commet" | "dlocal" | null;
5129
- /** The payment method: card, oxxo, or mercado_pago. Null when unknown. */
5217
+ /** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
5130
5218
  paymentMethod: PaymentMethod | null;
5131
5219
  /** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
5132
5220
  subPaymentMethod: SubPaymentMethod | null;
@@ -5169,7 +5257,7 @@ interface PaymentFailedData {
5169
5257
  subscriptionId: string | null;
5170
5258
  /** The payment provider the charge was routed to: stripe, commet, or dlocal. */
5171
5259
  provider: "stripe" | "commet" | "dlocal";
5172
- /** The payment method: card, oxxo, or mercado_pago. Null when unknown. */
5260
+ /** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
5173
5261
  paymentMethod: PaymentMethod | null;
5174
5262
  /** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
5175
5263
  subPaymentMethod: SubPaymentMethod | null;
@@ -5194,7 +5282,7 @@ interface PaymentRecoveredData {
5194
5282
  subscriptionId: string | null;
5195
5283
  /** The payment provider that recovered the payment, or null when the invoice was recovered without a processor charge. */
5196
5284
  provider: "stripe" | "commet" | "dlocal" | null;
5197
- /** The payment method: card, oxxo, or mercado_pago. Null when unknown. */
5285
+ /** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
5198
5286
  paymentMethod: PaymentMethod | null;
5199
5287
  /** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
5200
5288
  subPaymentMethod: SubPaymentMethod | null;
@@ -5230,6 +5318,8 @@ interface PaymentRefundedData {
5230
5318
  customerId: string | null;
5231
5319
  /** The subscription ID, if the invoice is linked to a subscription. */
5232
5320
  subscriptionId: string | null;
5321
+ /** Cumulative confirmed refunds in the payment currency’s smallest unit. */
5322
+ amountRefunded: number;
5233
5323
  /** The refunded amount in cents (100 = $1.00). */
5234
5324
  refundAmount: number;
5235
5325
  /** The refund currency code. */
@@ -5334,7 +5424,7 @@ interface PaymentLinkCompletedData {
5334
5424
  invoiceNumber: string;
5335
5425
  /** The payment transaction ID for the settled charge. */
5336
5426
  paymentTransactionId: string | null;
5337
- /** The payment method: card, oxxo, or mercado_pago. Null when unknown. */
5427
+ /** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
5338
5428
  paymentMethod: PaymentMethod | null;
5339
5429
  /** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
5340
5430
  subPaymentMethod: SubPaymentMethod | null;
@@ -5373,7 +5463,7 @@ interface PaymentLinkFailedData {
5373
5463
  failureCode: string;
5374
5464
  /** A human-readable failure message. */
5375
5465
  failureMessage: string;
5376
- /** The payment method: card, oxxo, or mercado_pago. Null when unknown. */
5466
+ /** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
5377
5467
  paymentMethod: PaymentMethod | null;
5378
5468
  /** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
5379
5469
  subPaymentMethod: SubPaymentMethod | null;
@@ -5420,7 +5510,7 @@ interface InvoiceCreatedData {
5420
5510
  /** The subscription ID, if the invoice is linked to a subscription. */
5421
5511
  subscriptionId: string | null;
5422
5512
  }
5423
- /** Fired when an invoice is voided — nullified before collection, either manually or automatically when its subscription is canceled. Voiding is terminal: a void invoice is never retried or collected. */
5513
+ /** Fired when an invoice is voided — nullified before collection, for example when its subscription is canceled. Voiding is terminal: a void invoice is never retried or collected. */
5424
5514
  interface InvoiceVoidedData {
5425
5515
  /** The invoice ID. */
5426
5516
  invoiceId: string;
@@ -5447,7 +5537,7 @@ interface InvoiceVoidedData {
5447
5537
  /** The subscription ID, if the invoice is linked to a subscription. */
5448
5538
  subscriptionId: string | null;
5449
5539
  }
5450
- /** Fired once when an outstanding invoice passes its due date without payment. The invoice keeps its outstanding status — overdue is a fact about the due date, not a new status. Use it to start your own dunning flow. */
5540
+ /** Fired once when an invoice is still outstanding 24 hours after its due date. The invoice keeps its outstanding status — overdue is a fact about the due date, not a new status. Use it to start your own dunning flow. */
5451
5541
  interface InvoiceOverdueData {
5452
5542
  /** The invoice ID. */
5453
5543
  invoiceId: string;
@@ -5474,7 +5564,7 @@ interface InvoiceOverdueData {
5474
5564
  /** The subscription ID, if the invoice is linked to a subscription. */
5475
5565
  subscriptionId: string | null;
5476
5566
  }
5477
- /** Predictive event fired once, 3 days before an active subscription renews. Use it to notify the customer before they are charged. Carries no amount — usage-based charges are only final at renewal, when invoice.created delivers the actual invoice. */
5567
+ /** Predictive event fired once, 3 days before an active subscription renews. A subscription on a free plan issues no renewal invoice and does not fire it. Use it to notify the customer before they are charged. Carries no amount — usage-based charges are only final at renewal, when invoice.created delivers the actual invoice. */
5478
5568
  interface InvoiceUpcomingData {
5479
5569
  /** The subscription ID. */
5480
5570
  subscriptionId: string;
@@ -5497,7 +5587,7 @@ interface PaymentMethodAttachedData {
5497
5587
  subscriptionId: string;
5498
5588
  /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
5499
5589
  customerId: string;
5500
- /** The payment method: card, oxxo, or mercado_pago. Null when unknown. */
5590
+ /** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
5501
5591
  paymentMethod: PaymentMethod | null;
5502
5592
  /** Card display metadata: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved. */
5503
5593
  card: WebhookCardInfo | null;
@@ -5506,7 +5596,7 @@ interface PaymentMethodAttachedData {
5506
5596
  interface PaymentMethodUpdatedData {
5507
5597
  /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
5508
5598
  customerId: string;
5509
- /** The payment method: card, oxxo, or mercado_pago. Null when unknown. */
5599
+ /** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
5510
5600
  paymentMethod: PaymentMethod | null;
5511
5601
  /** Card display metadata for the new method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved. */
5512
5602
  card: WebhookCardInfo | null;
@@ -5515,7 +5605,7 @@ interface PaymentMethodUpdatedData {
5515
5605
  interface PaymentMethodDetachedData {
5516
5606
  /** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
5517
5607
  customerId: string;
5518
- /** The payment method: card, oxxo, or mercado_pago. Null when unknown. */
5608
+ /** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
5519
5609
  paymentMethod: PaymentMethod | null;
5520
5610
  /** Card display metadata of the removed method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved. */
5521
5611
  card: WebhookCardInfo | null;
@@ -5686,8 +5776,10 @@ interface CustomerStateChangedData {
5686
5776
  creditsPerUnit: number;
5687
5777
  /** Actual credits deducted by this feature during the period. */
5688
5778
  creditsConsumed: number;
5689
- /** Additional product units available from the current shared credit pool at this feature's conversion rate. */
5690
- availableUnits: number;
5779
+ /** Whether the plan credits are unlimited: usage never spends them and only the plan credit limit caps it. */
5780
+ unlimited: boolean;
5781
+ /** Additional product units available from the current shared credit pool at this feature's conversion rate. Absent when unlimited is true. */
5782
+ availableUnits?: number;
5691
5783
  } | {
5692
5784
  /** Product usage deducts money from a shared balance. */
5693
5785
  model: "balance";
@@ -5713,7 +5805,9 @@ interface CustomerStateChangedData {
5713
5805
  /** Lowercase ISO 4217 currency code. */
5714
5806
  currency: string;
5715
5807
  };
5716
- /** Estimated additional units available from the current shared balance at this feature's fixed price. Absent for dynamic pricing. */
5808
+ /** Whether the plan balance is unlimited: usage never spends it and only the plan balance limit caps it. */
5809
+ unlimited: boolean;
5810
+ /** Estimated additional units available from the current shared balance at this feature's fixed price. Absent for dynamic pricing and when unlimited is true. */
5717
5811
  availableUnits?: number;
5718
5812
  /** Price for one additional product unit. */
5719
5813
  unitPrice?: {
@@ -6063,7 +6157,7 @@ interface CreditsDepletedData {
6063
6157
  /** Credits remaining after depletion. Always 0. */
6064
6158
  remainingCredits: number;
6065
6159
  }
6066
- /** Fired at a reset when unused plan credits are discarded. On a plan whose unused plan credits expire, every unused plan credit expires at each reset. On a plan that rolls them over, a reset keeps them, up to the plan's maxPlanCredits when it has one, and only the excess expires. A change to another credits plan applies the new plan's terms the same way. Purchased credits never expire and are not affected. */
6160
+ /** Fired at a reset when unused plan credits are discarded. On a plan whose unused plan credits expire, every unused plan credit expires at each reset. On a plan that rolls them over, a reset keeps them, up to the plan's maxPlanCredits when it has one, and only the excess expires. A change to another credits plan applies the new plan's terms the same way, and an immediate change also discards the credits the previous plan gave for the period it cuts short. Purchased credits never expire and are not affected. */
6067
6161
  interface CreditsExpiredData {
6068
6162
  /** The subscription ID. */
6069
6163
  subscriptionId: string;