@openmeter/client 1.0.0-beta.233 → 1.0.0-beta.235

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 (49) hide show
  1. package/README.md +125 -111
  2. package/dist/funcs/customers.d.ts +112 -1
  3. package/dist/funcs/customers.js +430 -0
  4. package/dist/funcs/entitlements.d.ts +38 -1
  5. package/dist/funcs/entitlements.js +169 -6
  6. package/dist/funcs/grants.d.ts +24 -0
  7. package/dist/funcs/grants.js +78 -0
  8. package/dist/funcs/index.d.ts +2 -0
  9. package/dist/funcs/index.js +2 -0
  10. package/dist/funcs/notifications.d.ts +43 -0
  11. package/dist/funcs/notifications.js +163 -0
  12. package/dist/index.d.ts +9 -1
  13. package/dist/index.js +6 -0
  14. package/dist/lib/version.d.ts +1 -1
  15. package/dist/lib/version.js +1 -1
  16. package/dist/models/operations/customers.d.ts +109 -1
  17. package/dist/models/operations/entitlements.d.ts +59 -4
  18. package/dist/models/operations/grants.d.ts +43 -0
  19. package/dist/models/operations/grants.js +2 -0
  20. package/dist/models/operations/notifications.d.ts +46 -0
  21. package/dist/models/operations/notifications.js +2 -0
  22. package/dist/models/schemas.d.ts +6556 -2713
  23. package/dist/models/schemas.js +1802 -365
  24. package/dist/models/types.d.ts +1177 -228
  25. package/dist/sdk/apps.d.ts +70 -1
  26. package/dist/sdk/apps.js +86 -1
  27. package/dist/sdk/charges.d.ts +32 -0
  28. package/dist/sdk/charges.js +38 -0
  29. package/dist/sdk/currencies.d.ts +71 -0
  30. package/dist/sdk/currencies.js +87 -0
  31. package/dist/sdk/customers.d.ts +205 -2
  32. package/dist/sdk/customers.js +246 -1
  33. package/dist/sdk/entitlementAccess.d.ts +22 -0
  34. package/dist/sdk/entitlementAccess.js +26 -0
  35. package/dist/sdk/entitlements.d.ts +51 -1
  36. package/dist/sdk/entitlements.js +61 -1
  37. package/dist/sdk/grants.d.ts +43 -0
  38. package/dist/sdk/grants.js +51 -0
  39. package/dist/sdk/internal.d.ts +5 -458
  40. package/dist/sdk/internal.js +6 -569
  41. package/dist/sdk/notifications.d.ts +58 -0
  42. package/dist/sdk/notifications.js +72 -0
  43. package/dist/sdk/planAddons.d.ts +20 -1
  44. package/dist/sdk/planAddons.js +24 -1
  45. package/dist/sdk/sdk.d.ts +18 -0
  46. package/dist/sdk/sdk.js +30 -0
  47. package/dist/sdk/subscriptions.d.ts +39 -9
  48. package/dist/sdk/subscriptions.js +45 -11
  49. package/package.json +1 -1
@@ -147,6 +147,28 @@ export interface AppStripeCreateCustomerPortalSessionOptions {
147
147
  * "mesh", "kic", or "\_".
148
148
  */
149
149
  export type CreateLabels = Record<string, string>;
150
+ /** An integer version comparison. Exactly one operator must be provided. */
151
+ export interface CreateVersionFilter {
152
+ /** Match this exact version. */
153
+ eq?: number;
154
+ /** Match one of these versions. */
155
+ oeq?: number[];
156
+ /** Match this version and later versions. */
157
+ gte?: number;
158
+ /** Match this version and earlier versions. */
159
+ lte?: number;
160
+ }
161
+ /** An integer version comparison. Exactly one operator must be provided. */
162
+ export interface VersionFilter {
163
+ /** Match this exact version. */
164
+ eq?: number;
165
+ /** Match one of these versions. */
166
+ oeq?: number[];
167
+ /** Match this version and later versions. */
168
+ gte?: number;
169
+ /** Match this version and earlier versions. */
170
+ lte?: number;
171
+ }
150
172
  /** Free price. */
151
173
  export interface PriceFree {
152
174
  /** The type of the price. */
@@ -606,19 +628,58 @@ export interface CreateCurrencyCustomRequest {
606
628
  thousandSeparator: string;
607
629
  code: string;
608
630
  }
609
- /** Balance details of a metered entitlement. */
631
+ /**
632
+ * Balance details of a metered entitlement at the evaluation time, which is the
633
+ * `at` query parameter when given and the current time otherwise.
634
+ */
610
635
  export interface EntitlementAccessValue {
611
- /** The remaining balance of the entitlement in the current usage period. */
636
+ /**
637
+ * The remaining balance of the entitlement in the usage period at the evaluation
638
+ * time.
639
+ */
612
640
  balance: string;
613
- /** The usage recorded in the current usage period. */
641
+ /** The usage recorded in the usage period at the evaluation time. */
614
642
  usage: string;
615
- /** The usage exceeding the available balance in the current usage period. */
643
+ /**
644
+ * The usage exceeding the available balance in the usage period at the evaluation
645
+ * time.
646
+ */
616
647
  overage: string;
617
- /** The total amount granted and currently available to the entitlement. */
648
+ /**
649
+ * The total amount granted and available to the entitlement at the evaluation
650
+ * time.
651
+ */
618
652
  totalAvailableGrantAmount: string;
619
653
  /** The remaining balance of each grant, keyed by grant ID. */
620
654
  grantBalances: Record<string, string>;
621
655
  }
656
+ /**
657
+ * Usage granted automatically after each reset of a metered entitlement. The
658
+ * balance returns to `amount` after every reset.
659
+ */
660
+ export interface EntitlementIssueAfterReset {
661
+ /** The amount granted after each reset, in the feature's unit. */
662
+ amount: string;
663
+ /**
664
+ * The priority of the grant created after each reset. Lower values have higher
665
+ * priority.
666
+ */
667
+ priority: number;
668
+ }
669
+ /** Entitlement balance at the boundaries of a burndown segment. */
670
+ export interface EntitlementBurndownBalance {
671
+ /** The balance at the start of the segment. */
672
+ start: string;
673
+ /** The balance at the end of the segment. */
674
+ end: string;
675
+ }
676
+ /** Grant balances at the boundaries of a burndown segment, keyed by grant ID. */
677
+ export interface EntitlementBurndownGrantBalances {
678
+ /** The balance of each active grant at the start of the segment. */
679
+ start: Record<string, string>;
680
+ /** The balance of each active grant at the end of the segment. */
681
+ end: Record<string, string>;
682
+ }
622
683
  /** Cost basis with an explicit conversion rate supplied with the charge. */
623
684
  export interface CreateChargeCostBasisManual {
624
685
  /** Discriminator selecting the cost basis mode. */
@@ -873,6 +934,17 @@ export interface ProfileReference {
873
934
  /** The ID of the billing profile. */
874
935
  id: string;
875
936
  }
937
+ /** Feature reference. */
938
+ export interface FeatureReference {
939
+ id: string;
940
+ }
941
+ /** Usage taken from a single grant. */
942
+ export interface EntitlementGrantUsage {
943
+ /** The ID of the grant. */
944
+ grantId: string;
945
+ /** The usage taken from the grant. */
946
+ usage: string;
947
+ }
876
948
  /** Cost basis pinned to a specific cost basis resource of the custom currency. */
877
949
  export interface CreateChargeCostBasisPinned {
878
950
  /** Discriminator selecting the cost basis mode. */
@@ -908,6 +980,10 @@ export interface CreditGrantInvoiceReference {
908
980
  id: string;
909
981
  };
910
982
  }
983
+ /** CurrencyCustom reference. */
984
+ export interface CurrencyCustomReference {
985
+ id: string;
986
+ }
911
987
  /** A cost basis pinned to a custom-currency pair for the subscription. */
912
988
  export interface SubscriptionCostBasisPin {
913
989
  /** The managed custom currency ID. */
@@ -917,10 +993,6 @@ export interface SubscriptionCostBasisPin {
917
993
  /** The pinned cost basis resource ID. */
918
994
  costBasisId: string;
919
995
  }
920
- /** Feature reference. */
921
- export interface FeatureReference {
922
- id: string;
923
- }
924
996
  /**
925
997
  * Subscription reference represents a reference to the specific subscription item
926
998
  * this entity represents.
@@ -1102,24 +1174,6 @@ export interface AppStripeCreateCustomerPortalSessionResult {
1102
1174
  */
1103
1175
  url: string;
1104
1176
  }
1105
- /**
1106
- * Fiat conversion rate a custom-currency charge is invoiced at. Present once the
1107
- * cost basis is resolved; dynamic cost bases are exposed only after the service
1108
- * period has started.
1109
- */
1110
- export interface ChargeResolvedCostBasis {
1111
- /** The fiat currency the charge amount is converted into for invoicing. */
1112
- fiatCurrency: string;
1113
- /** Fiat amount per one unit of the custom currency. */
1114
- rate: string;
1115
- /**
1116
- * ID of the custom currency's cost basis resource the rate was taken from. Absent
1117
- * for manual cost bases.
1118
- */
1119
- costBasisId?: string;
1120
- /** When the rate was resolved. */
1121
- resolvedAt: Date;
1122
- }
1123
1177
  /**
1124
1178
  * A period with defined start and end dates.
1125
1179
  *
@@ -1139,6 +1193,42 @@ export interface ClosedPeriod {
1139
1193
  */
1140
1194
  to: Date;
1141
1195
  }
1196
+ /** Request body for resetting the usage of a metered entitlement. */
1197
+ export interface ResetCustomerEntitlementUsageRequest {
1198
+ /**
1199
+ * The time the reset takes effect. Defaults to the current time and cannot be in
1200
+ * the future. Truncated to the minute.
1201
+ */
1202
+ effectiveAt?: Date;
1203
+ /**
1204
+ * Whether the usage period anchor is kept. When false, the anchor moves to
1205
+ * `effective_at`.
1206
+ */
1207
+ retainAnchor: boolean;
1208
+ /**
1209
+ * Whether overage carries over into the new usage period. Defaults to the
1210
+ * entitlement's own setting.
1211
+ */
1212
+ preserveOverage?: boolean;
1213
+ }
1214
+ /**
1215
+ * Fiat conversion rate a custom-currency charge is invoiced at. Present once the
1216
+ * cost basis is resolved; dynamic cost bases are exposed only after the service
1217
+ * period has started.
1218
+ */
1219
+ export interface ChargeResolvedCostBasis {
1220
+ /** The fiat currency the charge amount is converted into for invoicing. */
1221
+ fiatCurrency: string;
1222
+ /** Fiat amount per one unit of the custom currency. */
1223
+ rate: string;
1224
+ /**
1225
+ * ID of the custom currency's cost basis resource the rate was taken from. Absent
1226
+ * for manual cost bases.
1227
+ */
1228
+ costBasisId?: string;
1229
+ /** When the rate was resolved. */
1230
+ resolvedAt: Date;
1231
+ }
1142
1232
  /** A subscription add-on event. */
1143
1233
  export interface SubscriptionAddonTimelineSegment {
1144
1234
  /** An ISO-8601 timestamp representation of the cadence start of the resource. */
@@ -1398,22 +1488,6 @@ export interface NotImplemented extends BaseError {
1398
1488
  /** Not Available. */
1399
1489
  export interface NotAvailable extends BaseError {
1400
1490
  }
1401
- /** Filters for the credit grant. */
1402
- export interface CreateCreditGrantFilters {
1403
- /**
1404
- * Limit the credit grant to specific features. If no features are specified, the
1405
- * credit grant can be used for any feature.
1406
- */
1407
- features?: string[];
1408
- }
1409
- /** Filters for the credit grant. */
1410
- export interface CreditGrantFilters {
1411
- /**
1412
- * Limit the credit grant to specific features. If no features are specified, the
1413
- * credit grant can be used for any feature.
1414
- */
1415
- features?: string[];
1416
- }
1417
1491
  /**
1418
1492
  * A reference to the plan a subscription was created from, pinned to an exact
1419
1493
  * revision.
@@ -1776,6 +1850,43 @@ export interface CustomerStripeCreateCustomerPortalSessionRequest {
1776
1850
  /** Options for configuring the Stripe Customer Portal Session. */
1777
1851
  stripeOptions: AppStripeCreateCustomerPortalSessionOptions;
1778
1852
  }
1853
+ /** Entitlement access check result. */
1854
+ export interface EntitlementAccessCheckResult {
1855
+ /**
1856
+ * Whether the customer has access to the feature. Always true for `boolean` and
1857
+ * `static` entitlements. Depends on balance for `metered` entitlements.
1858
+ */
1859
+ hasAccess: boolean;
1860
+ /**
1861
+ * Only available for static entitlements. Config is the JSON parsable
1862
+ * configuration of the entitlement. Useful to describe per customer configuration.
1863
+ */
1864
+ config?: string;
1865
+ /**
1866
+ * The type of the entitlement.
1867
+ *
1868
+ * If not provided, the feature has no entitlement defined (has access is always
1869
+ * false in this case)
1870
+ */
1871
+ type?: 'metered' | 'static' | 'boolean';
1872
+ }
1873
+ /**
1874
+ * Recurring period input. The anchor is optional; the owning resource defines the
1875
+ * default, typically its creation time.
1876
+ */
1877
+ export interface RecurringPeriodInput {
1878
+ /** The interval duration in ISO 8601 format. */
1879
+ interval: string;
1880
+ /** A date-time anchor to base the recurring period on. */
1881
+ anchor?: Date;
1882
+ }
1883
+ /** Recurring period with an anchor and an interval. */
1884
+ export interface RecurringPeriod {
1885
+ /** A date-time anchor to base the recurring period on. */
1886
+ anchor: Date;
1887
+ /** The interval duration in ISO 8601 format. */
1888
+ interval: string;
1889
+ }
1779
1890
  /** The entitlement template of a metered entitlement. */
1780
1891
  export interface RateCardMeteredEntitlement {
1781
1892
  /** The type of the entitlement template. */
@@ -1826,12 +1937,32 @@ export interface SubscriptionEditStretchPhase {
1826
1937
  /** The ISO-8601 duration to extend the phase by. */
1827
1938
  extendBy: string;
1828
1939
  }
1829
- /** Recurring period with an anchor and an interval. */
1830
- export interface RecurringPeriod {
1831
- /** A date-time anchor to base the recurring period on. */
1832
- anchor: Date;
1833
- /** The interval duration in ISO 8601 format. */
1834
- interval: string;
1940
+ /** Filter options for getting a credit balance. */
1941
+ export interface GetCreditBalanceParamsFilter {
1942
+ /**
1943
+ * Filter credit balance by currency code. When historical custom currencies reuse
1944
+ * a code, each managed currency is returned as a separate balance row.
1945
+ */
1946
+ currency?: StringFieldFilterExact;
1947
+ /**
1948
+ * Filter credit balance by feature key. Omit to return the total portfolio value.
1949
+ * Use `exists=false` to return only unrestricted balance.
1950
+ */
1951
+ featureKey?: StringFieldFilter;
1952
+ }
1953
+ /** Filter options for listing plans. */
1954
+ export interface ListPlansParamsFilter {
1955
+ key?: StringFieldFilter;
1956
+ name?: StringFieldFilter;
1957
+ status?: StringFieldFilterExact;
1958
+ currency?: StringFieldFilterExact;
1959
+ }
1960
+ /** A plan key and an optional version constraint for matching credit grants. */
1961
+ export interface CreateCreditGrantPlanFilter {
1962
+ /** The plan key in the customer's namespace. */
1963
+ key: string;
1964
+ /** Omission matches all versions, including future versions. */
1965
+ version?: CreateVersionFilter;
1835
1966
  }
1836
1967
  /**
1837
1968
  * Request body for updating the external payment settlement status of a credit
@@ -1841,6 +1972,13 @@ export interface UpdateCreditGrantExternalSettlementRequest {
1841
1972
  /** The new payment settlement status. */
1842
1973
  status: 'pending' | 'authorized' | 'settled';
1843
1974
  }
1975
+ /** A plan key and an optional version constraint for matching credit grants. */
1976
+ export interface CreditGrantPlanFilter {
1977
+ /** The plan key in the customer's namespace. */
1978
+ key: string;
1979
+ /** Omission matches all versions, including future versions. */
1980
+ version?: VersionFilter;
1981
+ }
1844
1982
  /** Filter options for listing credit grants. */
1845
1983
  export interface ListCreditGrantsParamsFilter {
1846
1984
  /** Filter credit grants by status. */
@@ -1865,26 +2003,6 @@ export interface ValidationIssue {
1865
2003
  /** Component that reported the validation issue, if applicable. */
1866
2004
  component?: string;
1867
2005
  }
1868
- /** Filter options for getting a credit balance. */
1869
- export interface GetCreditBalanceParamsFilter {
1870
- /**
1871
- * Filter credit balance by currency code. When historical custom currencies reuse
1872
- * a code, each managed currency is returned as a separate balance row.
1873
- */
1874
- currency?: StringFieldFilterExact;
1875
- /**
1876
- * Filter credit balance by feature key. Omit to return the total portfolio value.
1877
- * Use `exists=false` to return only unrestricted balance.
1878
- */
1879
- featureKey?: StringFieldFilter;
1880
- }
1881
- /** Filter options for listing plans. */
1882
- export interface ListPlansParamsFilter {
1883
- key?: StringFieldFilter;
1884
- name?: StringFieldFilter;
1885
- status?: StringFieldFilterExact;
1886
- currency?: StringFieldFilterExact;
1887
- }
1888
2006
  /** Request body for voiding a credit grant. */
1889
2007
  export interface VoidCreditGrantRequest {
1890
2008
  /**
@@ -2197,6 +2315,120 @@ export interface EntitlementAccessQueryError {
2197
2315
  /** The customer identifier from the request that produced this error. */
2198
2316
  customer?: string;
2199
2317
  }
2318
+ /**
2319
+ * A notification channel delivers notification events, such as entitlement balance
2320
+ * threshold crossings, to an external system. Today the only supported channel
2321
+ * type is a webhook delivered via Svix.
2322
+ */
2323
+ export interface NotificationChannel {
2324
+ id: string;
2325
+ /**
2326
+ * Display name of the resource.
2327
+ *
2328
+ * Between 1 and 256 characters.
2329
+ */
2330
+ name: string;
2331
+ labels?: Labels;
2332
+ /** An ISO-8601 timestamp representation of entity creation date. */
2333
+ createdAt: Date;
2334
+ /** An ISO-8601 timestamp representation of entity last update date. */
2335
+ updatedAt: Date;
2336
+ /** An ISO-8601 timestamp representation of entity deletion date. */
2337
+ deletedAt?: Date;
2338
+ /** The type of the channel. Immutable after creation. */
2339
+ type: 'webhook';
2340
+ /**
2341
+ * Whether the channel is disabled. Disabled channels do not receive notification
2342
+ * events.
2343
+ */
2344
+ disabled: boolean;
2345
+ /** The URL that webhook notification events are delivered to. */
2346
+ url: string;
2347
+ /**
2348
+ * Custom HTTP headers to include on every webhook delivery request, keyed by
2349
+ * header name.
2350
+ */
2351
+ customHeaders?: Record<string, string>;
2352
+ /**
2353
+ * Secret used to sign outgoing webhook payloads so recipients can verify their
2354
+ * authenticity. If omitted on create, a secret is generated automatically by the
2355
+ * delivery provider. This is a sensitive credential returned in responses (unlike
2356
+ * most secrets) specifically so clients can retrieve a server-generated value and
2357
+ * verify webhook signatures; handle it with the same care as any other credential.
2358
+ */
2359
+ signingSecret?: string;
2360
+ }
2361
+ /** NotificationChannel create request. */
2362
+ export interface CreateNotificationChannelRequest {
2363
+ /**
2364
+ * Display name of the resource.
2365
+ *
2366
+ * Between 1 and 256 characters.
2367
+ */
2368
+ name: string;
2369
+ labels?: Labels;
2370
+ /** The type of the channel. Immutable after creation. */
2371
+ type: 'webhook';
2372
+ /**
2373
+ * Whether the channel is disabled. Disabled channels do not receive notification
2374
+ * events.
2375
+ */
2376
+ disabled: boolean;
2377
+ /** The URL that webhook notification events are delivered to. */
2378
+ url: string;
2379
+ /**
2380
+ * Custom HTTP headers to include on every webhook delivery request, keyed by
2381
+ * header name.
2382
+ */
2383
+ customHeaders?: Record<string, string>;
2384
+ /**
2385
+ * Secret used to sign outgoing webhook payloads so recipients can verify their
2386
+ * authenticity. If omitted on create, a secret is generated automatically by the
2387
+ * delivery provider. This is a sensitive credential returned in responses (unlike
2388
+ * most secrets) specifically so clients can retrieve a server-generated value and
2389
+ * verify webhook signatures; handle it with the same care as any other credential.
2390
+ */
2391
+ signingSecret?: string;
2392
+ }
2393
+ /**
2394
+ * Request body for updating a notification channel. Updates replace the channel's
2395
+ * mutable state rather than merging it: `type`, `name`, and `url` must always be
2396
+ * provided, and omitting `disabled`, `labels`, or `custom_headers` resets them to
2397
+ * their defaults (enabled, no labels, no custom headers). `signing_secret` is the
2398
+ * one exception: omitting it keeps the channel's current signing secret instead of
2399
+ * clearing the credential.
2400
+ */
2401
+ export interface UpdateBillingNotificationChannelRequest {
2402
+ /**
2403
+ * Display name of the resource.
2404
+ *
2405
+ * Between 1 and 256 characters.
2406
+ */
2407
+ name: string;
2408
+ /** The type of the channel. Immutable after creation. */
2409
+ type: 'webhook';
2410
+ /** The URL that webhook notification events are delivered to. */
2411
+ url: string;
2412
+ labels?: Labels;
2413
+ /**
2414
+ * Whether the channel is disabled. Disabled channels do not receive notification
2415
+ * events.
2416
+ */
2417
+ disabled: boolean;
2418
+ /**
2419
+ * Custom HTTP headers to include on every webhook delivery request, keyed by
2420
+ * header name.
2421
+ */
2422
+ customHeaders?: Record<string, string>;
2423
+ /**
2424
+ * Secret used to sign outgoing webhook payloads so recipients can verify their
2425
+ * authenticity. If omitted on create, a secret is generated automatically by the
2426
+ * delivery provider. This is a sensitive credential returned in responses (unlike
2427
+ * most secrets) specifically so clients can retrieve a server-generated value and
2428
+ * verify webhook signatures; handle it with the same care as any other credential.
2429
+ */
2430
+ signingSecret?: string;
2431
+ }
2200
2432
  /** App customer data. */
2201
2433
  export interface AppCustomerData {
2202
2434
  /**
@@ -2254,26 +2486,6 @@ export interface CreditAdjustment {
2254
2486
  description?: string;
2255
2487
  labels?: Labels;
2256
2488
  }
2257
- /** The credit balance by currency. */
2258
- export interface CreditBalance {
2259
- currency: BillingCurrencyCode;
2260
- /** Immutable managed currency identifier. Present only for custom currencies. */
2261
- customCurrencyId?: string;
2262
- /**
2263
- * Credits available after applying currently live charge impacts.
2264
- *
2265
- * Always zero for historical balance queries using the `timestamp` parameter
2266
- * because live charge impacts cannot be reconstructed historically.
2267
- */
2268
- live: string;
2269
- /** Credits that have been booked on the ledger as of the balance timestamp. */
2270
- settled: string;
2271
- /**
2272
- * Credits that have been granted but are not yet written to the ledger, or are
2273
- * written to the ledger with a future booked time.
2274
- */
2275
- pending: string;
2276
- }
2277
2489
  /** CreditAdjustment create request. */
2278
2490
  export interface CreateCreditAdjustmentRequest {
2279
2491
  /**
@@ -2310,48 +2522,6 @@ export interface ListCreditTransactionsParamsFilter {
2310
2522
  */
2311
2523
  featureKey?: StringFieldFilter;
2312
2524
  }
2313
- /**
2314
- * A credit transaction represents a single credit movement on the customer's
2315
- * balance.
2316
- *
2317
- * Credit transactions are immutable.
2318
- */
2319
- export interface CreditTransaction {
2320
- id: string;
2321
- /**
2322
- * Display name of the resource.
2323
- *
2324
- * Between 1 and 256 characters.
2325
- */
2326
- name: string;
2327
- /**
2328
- * Optional description of the resource.
2329
- *
2330
- * Maximum 1024 characters.
2331
- */
2332
- description?: string;
2333
- labels?: Labels;
2334
- /** An ISO-8601 timestamp representation of entity creation date. */
2335
- createdAt: Date;
2336
- /** The date and time the transaction was booked. */
2337
- bookedAt: Date;
2338
- /** The type of credit transaction. */
2339
- type: 'funded' | 'consumed' | 'expired' | 'voided';
2340
- /** Currency of the balance affected by the transaction. */
2341
- currency: BillingCurrencyCode;
2342
- /** Immutable managed currency identifier. Present only for custom currencies. */
2343
- customCurrencyId?: string;
2344
- /**
2345
- * Signed amount of the credit movement. Positive values add balance, negative
2346
- * values reduce balance.
2347
- */
2348
- amount: string;
2349
- /** The available balance before and after the transaction. */
2350
- availableBalance: {
2351
- before: string;
2352
- after: string;
2353
- };
2354
- }
2355
2525
  /** Monetary amount in a fiat or custom currency. */
2356
2526
  export interface CurrencyAmount {
2357
2527
  /** The amount as an arbitrary-precision decimal string. */
@@ -2359,11 +2529,34 @@ export interface CurrencyAmount {
2359
2529
  /** The fiat or custom currency code of the amount. */
2360
2530
  currency: BillingCurrencyCode;
2361
2531
  }
2362
- /** Entitlement access result. */
2363
- export interface EntitlementAccessResult {
2532
+ /** Entitlement value result. */
2533
+ export interface EntitlementValueResult {
2364
2534
  /** The type of the entitlement. */
2365
2535
  type: 'metered' | 'static' | 'boolean';
2366
- /** The feature key of the entitlement. */
2536
+ /** The feature key being evaluated. */
2537
+ featureKey: string;
2538
+ /**
2539
+ * Whether the customer has access to the feature. Always true for `boolean` and
2540
+ * `static` entitlements. Depends on balance for `metered` entitlements.
2541
+ */
2542
+ hasAccess: boolean;
2543
+ /**
2544
+ * Only available for static entitlements. Config is the JSON parsable
2545
+ * configuration of the entitlement. Useful to describe per customer configuration.
2546
+ */
2547
+ config?: string;
2548
+ /**
2549
+ * Only available for metered entitlements. The balance details of the entitlement
2550
+ * at the evaluation time. Requires the `value` expand.
2551
+ */
2552
+ value?: EntitlementAccessValue;
2553
+ }
2554
+ /**
2555
+ * Entitlement value looked up by feature key. A missing entitlement has no type
2556
+ * and does not grant access.
2557
+ */
2558
+ export interface EntitlementFeatureValueResult {
2559
+ /** The feature key being evaluated. */
2367
2560
  featureKey: string;
2368
2561
  /**
2369
2562
  * Whether the customer has access to the feature. Always true for `boolean` and
@@ -2376,10 +2569,17 @@ export interface EntitlementAccessResult {
2376
2569
  */
2377
2570
  config?: string;
2378
2571
  /**
2379
- * Only available for metered entitlements. The current balance details of the
2380
- * entitlement. Requires the `value` expand.
2572
+ * Only available for metered entitlements. The balance details of the entitlement
2573
+ * at the evaluation time. Requires the `value` expand.
2381
2574
  */
2382
2575
  value?: EntitlementAccessValue;
2576
+ /**
2577
+ * The type of the entitlement.
2578
+ *
2579
+ * If not provided, the feature has no entitlement defined (has access is always
2580
+ * false in this case)
2581
+ */
2582
+ type?: 'metered' | 'static' | 'boolean';
2383
2583
  }
2384
2584
  /**
2385
2585
  * A price tier used in graduated and volume pricing.
@@ -2537,6 +2737,33 @@ export interface ListCustomersParamsFilter {
2537
2737
  planKey?: StringFieldFilter;
2538
2738
  billingProfileId?: UlidFieldFilter;
2539
2739
  }
2740
+ /** Filter options for listing customer entitlements. */
2741
+ export interface ListCustomerEntitlementsParamsFilter {
2742
+ /** Filter entitlements by feature ID. */
2743
+ featureId?: UlidFieldFilter;
2744
+ /** Filter entitlements by feature key. */
2745
+ featureKey?: StringFieldFilterExact;
2746
+ /** Filter entitlements by type (`metered`, `static` or `boolean`). */
2747
+ type?: StringFieldFilterExact;
2748
+ }
2749
+ /** Filter options for listing entitlements. */
2750
+ export interface ListEntitlementsParamsFilter {
2751
+ /** Filter entitlements by feature ID. */
2752
+ featureId?: UlidFieldFilter;
2753
+ /** Filter entitlements by feature key. */
2754
+ featureKey?: StringFieldFilterExact;
2755
+ /** Filter entitlements by type (`metered`, `static` or `boolean`). */
2756
+ type?: StringFieldFilterExact;
2757
+ /** Filter entitlements by customer ID. */
2758
+ customerId?: UlidFieldFilter;
2759
+ }
2760
+ /** Filter options for listing grants. */
2761
+ export interface ListGrantsParamsFilter {
2762
+ /** Filter grants by the ID of the customer that owns the entitlement. */
2763
+ customerId?: UlidFieldFilter;
2764
+ /** Filter grants by the ID of the entitlement's feature. */
2765
+ featureId?: UlidFieldFilter;
2766
+ }
2540
2767
  /** Filter options for listing subscriptions. */
2541
2768
  export interface ListSubscriptionsParamsFilter {
2542
2769
  id?: UlidFieldFilter;
@@ -2581,33 +2808,44 @@ export interface ListPlanAddonsParamsFilter {
2581
2808
  planCurrency?: StringFieldFilter;
2582
2809
  }
2583
2810
  /**
2584
- * Tax configuration for a credit grant.
2811
+ * Tax configuration for a billable resource.
2585
2812
  *
2586
- * Tax configuration should be provided to ensure correct revenue recognition,
2587
- * including for externally funded grants.
2813
+ * Applies a tax code and tax behavior to the resulting invoice line items. When
2814
+ * not set, the applicable default is used: the billing profile default tax
2815
+ * configuration, then the organization default tax code.
2588
2816
  */
2589
- export interface CreateCreditGrantTaxConfig {
2590
- /** Tax behavior applied to the invoice line item. */
2817
+ export interface CreateTaxCodeConfig {
2818
+ /**
2819
+ * Tax behavior.
2820
+ *
2821
+ * This enum is used to specify whether tax is included in the price or excluded
2822
+ * from the price. If not specified, the billing profile is used to determine the
2823
+ * tax behavior. If not specified in the billing profile, the provider's default
2824
+ * behavior is used.
2825
+ */
2591
2826
  behavior?: 'inclusive' | 'exclusive';
2592
2827
  /** Tax code applied to the invoice line item. */
2593
- taxCode?: CreateResourceReference;
2828
+ code?: CreateResourceReference;
2594
2829
  }
2595
2830
  /**
2596
- * Tax configuration for a credit grant.
2831
+ * Tax configuration for a billable resource.
2597
2832
  *
2598
- * Tax configuration should be provided to ensure correct revenue recognition,
2599
- * including for externally funded grants.
2833
+ * Applies a tax code and tax behavior to the resulting invoice line items. When
2834
+ * not set, the applicable default is used: the billing profile default tax
2835
+ * configuration, then the organization default tax code.
2600
2836
  */
2601
- export interface CreditGrantTaxConfig {
2602
- /** Tax behavior applied to the invoice line item. */
2837
+ export interface TaxCodeConfig {
2838
+ /**
2839
+ * Tax behavior.
2840
+ *
2841
+ * This enum is used to specify whether tax is included in the price or excluded
2842
+ * from the price. If not specified, the billing profile is used to determine the
2843
+ * tax behavior. If not specified in the billing profile, the provider's default
2844
+ * behavior is used.
2845
+ */
2603
2846
  behavior?: 'inclusive' | 'exclusive';
2604
2847
  /** Tax code applied to the invoice line item. */
2605
- taxCode?: TaxCodeReference;
2606
- }
2607
- /** The tax config of the rate card. */
2608
- export interface RateCardTaxConfig {
2609
- behavior?: 'inclusive' | 'exclusive';
2610
- code: TaxCodeReference;
2848
+ code?: TaxCodeReference;
2611
2849
  }
2612
2850
  /** Set of provider specific tax configs. */
2613
2851
  export interface TaxConfig {
@@ -2656,6 +2894,68 @@ export interface UpdateOrganizationDefaultTaxCodesRequest {
2656
2894
  /** Default tax code for credit grants. */
2657
2895
  creditGrantTaxCode?: TaxCodeReference;
2658
2896
  }
2897
+ /** The credit balance by currency. */
2898
+ export interface CreditBalance {
2899
+ currency: BillingCurrencyCode;
2900
+ /** Managed currency reference. Present only for custom currencies. */
2901
+ customCurrency?: CurrencyCustomReference;
2902
+ /**
2903
+ * Credits available after applying currently live charge impacts.
2904
+ *
2905
+ * Always zero for historical balance queries using the `timestamp` parameter
2906
+ * because live charge impacts cannot be reconstructed historically.
2907
+ */
2908
+ live: string;
2909
+ /** Credits that have been booked on the ledger as of the balance timestamp. */
2910
+ settled: string;
2911
+ /**
2912
+ * Credits that have been granted but are not yet written to the ledger, or are
2913
+ * written to the ledger with a future booked time.
2914
+ */
2915
+ pending: string;
2916
+ }
2917
+ /**
2918
+ * A credit transaction represents a single credit movement on the customer's
2919
+ * balance.
2920
+ *
2921
+ * Credit transactions are immutable.
2922
+ */
2923
+ export interface CreditTransaction {
2924
+ id: string;
2925
+ /**
2926
+ * Display name of the resource.
2927
+ *
2928
+ * Between 1 and 256 characters.
2929
+ */
2930
+ name: string;
2931
+ /**
2932
+ * Optional description of the resource.
2933
+ *
2934
+ * Maximum 1024 characters.
2935
+ */
2936
+ description?: string;
2937
+ labels?: Labels;
2938
+ /** An ISO-8601 timestamp representation of entity creation date. */
2939
+ createdAt: Date;
2940
+ /** The date and time the transaction was booked. */
2941
+ bookedAt: Date;
2942
+ /** The type of credit transaction. */
2943
+ type: 'funded' | 'consumed' | 'expired' | 'voided';
2944
+ /** Currency of the balance affected by the transaction. */
2945
+ currency: BillingCurrencyCode;
2946
+ /** Managed currency reference. Present only for custom currencies. */
2947
+ customCurrency?: CurrencyCustomReference;
2948
+ /**
2949
+ * Signed amount of the credit movement. Positive values add balance, negative
2950
+ * values reduce balance.
2951
+ */
2952
+ amount: string;
2953
+ /** The available balance before and after the transaction. */
2954
+ availableBalance: {
2955
+ before: string;
2956
+ after: string;
2957
+ };
2958
+ }
2659
2959
  /**
2660
2960
  * BillingInvoiceWorkflowAppsReferences represents the references (id) to the apps
2661
2961
  * used by a billing profile
@@ -2741,10 +3041,25 @@ export interface CreatePlanAddonRequest {
2741
3041
  */
2742
3042
  maxQuantity?: number;
2743
3043
  }
2744
- /** The tax config of the rate card. */
2745
- export interface UpdateRateCardTaxConfig {
3044
+ /**
3045
+ * Tax configuration for a billable resource.
3046
+ *
3047
+ * Applies a tax code and tax behavior to the resulting invoice line items. When
3048
+ * not set, the applicable default is used: the billing profile default tax
3049
+ * configuration, then the organization default tax code.
3050
+ */
3051
+ export interface UpdateTaxCodeConfig {
3052
+ /**
3053
+ * Tax behavior.
3054
+ *
3055
+ * This enum is used to specify whether tax is included in the price or excluded
3056
+ * from the price. If not specified, the billing profile is used to determine the
3057
+ * tax behavior. If not specified in the billing profile, the provider's default
3058
+ * behavior is used.
3059
+ */
2746
3060
  behavior?: 'inclusive' | 'exclusive';
2747
- code: UpdateResourceReference;
3061
+ /** Tax code applied to the invoice line item. */
3062
+ code?: UpdateResourceReference;
2748
3063
  }
2749
3064
  /** Filter options for listing ingested events. */
2750
3065
  export interface ListEventsParamsFilter {
@@ -2828,6 +3143,15 @@ export interface ListChargesParamsFilter {
2828
3143
  /** Filter charges by the ID of their customer. */
2829
3144
  customerId?: UlidFieldFilter;
2830
3145
  }
3146
+ /** Filter options for listing notification channels. */
3147
+ export interface ListNotificationChannelsParamsFilter {
3148
+ id?: UlidFieldFilter;
3149
+ name?: StringFieldFilter;
3150
+ type?: StringFieldFilterExact;
3151
+ disabled?: BooleanFieldFilter;
3152
+ createdAt?: DateTimeFieldFilter;
3153
+ updatedAt?: DateTimeFieldFilter;
3154
+ }
2831
3155
  /** Resource filters. */
2832
3156
  export interface ResourceFilters {
2833
3157
  name?: StringFieldFilter;
@@ -2839,9 +3163,7 @@ export interface ResourceFilters {
2839
3163
  }
2840
3164
  /** Field filters with all supported types. */
2841
3165
  export interface FieldFilters {
2842
- boolean?: boolean | {
2843
- eq: boolean;
2844
- };
3166
+ boolean?: BooleanFieldFilter;
2845
3167
  numeric?: number | {
2846
3168
  eq?: number;
2847
3169
  neq?: number;
@@ -2879,6 +3201,33 @@ export interface MeterQueryResult {
2879
3201
  /** The usage data. If no data is available, an empty array is returned. */
2880
3202
  data: MeterQueryRow[];
2881
3203
  }
3204
+ /** Usage and balance of a single history window. */
3205
+ export interface EntitlementHistoryWindow {
3206
+ /** The period the window covers. */
3207
+ period: ClosedPeriod;
3208
+ /** The usage recorded in the window. */
3209
+ usage: string;
3210
+ /** The entitlement balance at the start of the window. */
3211
+ balanceAtStart: string;
3212
+ }
3213
+ /** A period in which grants were consumed in a fixed order. */
3214
+ export interface EntitlementBurndownSegment {
3215
+ /** The period the segment covers. */
3216
+ period: ClosedPeriod;
3217
+ /** The usage recorded in the segment. */
3218
+ usage: string;
3219
+ /** The usage in the segment not covered by any grant. */
3220
+ overage: string;
3221
+ /** The entitlement balance at the start and at the end of the segment. */
3222
+ balance: EntitlementBurndownBalance;
3223
+ /**
3224
+ * The balance of each active grant at the start and at the end of the segment,
3225
+ * keyed by grant ID.
3226
+ */
3227
+ grantBalances: EntitlementBurndownGrantBalances;
3228
+ /** The grants consumed in the segment and the usage taken from each. */
3229
+ grantUsages: EntitlementGrantUsage[];
3230
+ }
2882
3231
  /** A detailed line produced by a flat fee charge's realization run. */
2883
3232
  export interface ChargeRealizationDetailedLineFlatFee {
2884
3233
  id: string;
@@ -3117,52 +3466,313 @@ export interface InvoiceCustomer {
3117
3466
  * resource itself, the key is optional here because the invoice snapshot may
3118
3467
  * predate or omit it.
3119
3468
  */
3120
- key?: string;
3121
- }
3122
- /** A collection of addresses for the party. */
3123
- export interface UpdateBillingPartyAddresses {
3124
- /** Billing address. */
3125
- billingAddress: UpdateAddress;
3126
- }
3127
- /** Snapshot of the customer's information at the time the invoice was issued. */
3128
- export interface UpdateInvoiceCustomer {
3469
+ key?: string;
3470
+ }
3471
+ /** A collection of addresses for the party. */
3472
+ export interface UpdateBillingPartyAddresses {
3473
+ /** Billing address. */
3474
+ billingAddress: UpdateAddress;
3475
+ }
3476
+ /** Snapshot of the customer's information at the time the invoice was issued. */
3477
+ export interface UpdateInvoiceCustomer {
3478
+ /**
3479
+ * Display name of the resource.
3480
+ *
3481
+ * Between 1 and 256 characters.
3482
+ */
3483
+ name: string;
3484
+ /** Mapping to attribute metered usage to the customer by the event subject. */
3485
+ usageAttribution?: UpdateCustomerUsageAttribution;
3486
+ /** The billing address of the customer. Used for tax and invoicing. */
3487
+ billingAddress?: UpdateAddress;
3488
+ id: string;
3489
+ /**
3490
+ * Optional external resource key for the customer.
3491
+ *
3492
+ * Omitted when the customer was created without a key. Unlike on the customer
3493
+ * resource itself, the key is optional here because the invoice snapshot may
3494
+ * predate or omit it.
3495
+ */
3496
+ key?: string;
3497
+ }
3498
+ /** Checkout Session consent collection configuration. */
3499
+ export interface AppStripeCreateCheckoutSessionConsentCollection {
3500
+ /** Controls the visibility of payment method reuse agreement. */
3501
+ paymentMethodReuseAgreement?: AppStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement;
3502
+ /**
3503
+ * Enables collection of promotional communication consent.
3504
+ *
3505
+ * Only available to US merchants. When set to "auto", Checkout determines whether
3506
+ * to show the option based on the customer's locale.
3507
+ */
3508
+ promotions?: 'auto' | 'none';
3509
+ /**
3510
+ * Requires customers to accept terms of service before payment.
3511
+ *
3512
+ * Requires a valid terms of service URL in your Stripe Dashboard settings.
3513
+ */
3514
+ termsOfService?: 'none' | 'required';
3515
+ }
3516
+ /** A grant to issue for a metered entitlement. */
3517
+ export interface EntitlementGrantCreateRequest {
3518
+ /** The amount to grant, in the feature's unit. Must be positive. */
3519
+ amount: string;
3520
+ /**
3521
+ * The priority of the grant. Lower values have higher priority. Grants are
3522
+ * consumed in priority order, then by closest expiration, then by earliest
3523
+ * creation.
3524
+ */
3525
+ priority?: number;
3526
+ /**
3527
+ * The time the grant becomes effective and the anchor for recurring grants. The
3528
+ * value is truncated to the start of the minute.
3529
+ */
3530
+ effectiveAt: Date;
3531
+ /**
3532
+ * The duration after which the grant expires, counted from `effective_at`. Only
3533
+ * single-unit durations are accepted, such as `PT12H`, `P7D`, `P2W`, `P3M`, or
3534
+ * `P1Y`. If omitted, the grant never expires.
3535
+ */
3536
+ expiresAfter?: string;
3537
+ /**
3538
+ * The maximum balance carried over at reset. The balance after a reset is
3539
+ * `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`.
3540
+ * Defaults to `amount`.
3541
+ */
3542
+ maxRolloverAmount?: string;
3543
+ /**
3544
+ * The minimum balance carried over at reset. The balance after a reset is
3545
+ * `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`.
3546
+ * Defaults to `0`.
3547
+ */
3548
+ minRolloverAmount?: string;
3549
+ labels?: Labels;
3550
+ /**
3551
+ * The recurrence of the grant. When set, the amount is issued again every
3552
+ * interval. The anchor defaults to `effective_at`.
3553
+ */
3554
+ recurrence?: RecurringPeriodInput;
3555
+ }
3556
+ /** Static entitlement create request. */
3557
+ export interface CreateEntitlementStaticRequest {
3558
+ /** The type of the entitlement. */
3559
+ type: 'static';
3560
+ /** The feature the customer is entitled to use. */
3561
+ feature: FeatureReference;
3562
+ labels?: Labels;
3563
+ /**
3564
+ * The entitlement configuration as a JSON value. Returned when checking
3565
+ * entitlement access.
3566
+ */
3567
+ config: unknown;
3568
+ /**
3569
+ * The usage period of the entitlement. The anchor defaults to the entitlement
3570
+ * creation time.
3571
+ */
3572
+ usagePeriod?: RecurringPeriodInput;
3573
+ }
3574
+ /** Boolean entitlement create request. */
3575
+ export interface CreateEntitlementBooleanRequest {
3576
+ /** The type of the entitlement. */
3577
+ type: 'boolean';
3578
+ /** The feature the customer is entitled to use. */
3579
+ feature: FeatureReference;
3580
+ labels?: Labels;
3581
+ /**
3582
+ * The usage period of the entitlement. The anchor defaults to the entitlement
3583
+ * creation time.
3584
+ */
3585
+ usagePeriod?: RecurringPeriodInput;
3586
+ }
3587
+ /**
3588
+ * A metered entitlement grants a usage allowance for a feature. Access is
3589
+ * determined by the balance: the allowance provided by grants is burnt down by
3590
+ * usage.
3591
+ */
3592
+ export interface EntitlementMetered {
3593
+ id: string;
3594
+ /** The type of the entitlement. */
3595
+ type: 'metered';
3596
+ /** The feature the customer is entitled to use. */
3597
+ feature: FeatureReference;
3598
+ /** The customer the entitlement belongs to. */
3599
+ customer: CustomerReference;
3600
+ labels?: Labels;
3601
+ /** The time from which the entitlement is active. */
3602
+ activeFrom: Date;
3603
+ /**
3604
+ * The time until which the entitlement is active. If not set, the entitlement is
3605
+ * active until deleted.
3606
+ */
3607
+ activeTo?: Date;
3608
+ /** The time the entitlement was created. */
3609
+ createdAt: Date;
3610
+ /** The time the entitlement was last updated. */
3611
+ updatedAt: Date;
3612
+ /** The time the entitlement was deleted. */
3613
+ deletedAt?: Date;
3614
+ /**
3615
+ * The usage period of the entitlement. The balance resets at the start of every
3616
+ * period.
3617
+ */
3618
+ usagePeriod: RecurringPeriod;
3619
+ /** The current usage period of the entitlement. */
3620
+ currentUsagePeriod: ClosedPeriod;
3621
+ /**
3622
+ * If true, the customer keeps access to the feature after the balance is
3623
+ * exhausted.
3624
+ */
3625
+ isSoftLimit: boolean;
3626
+ /** Usage granted automatically after each reset. Cannot be combined with `grants`. */
3627
+ issue?: EntitlementIssueAfterReset;
3628
+ /** The amount granted automatically after each reset. */
3629
+ issueAfterReset?: string;
3630
+ /** The priority of the grant created after each reset. */
3631
+ issueAfterResetPriority: number;
3632
+ /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
3633
+ preserveOverageAtReset: boolean;
3634
+ /** The time from which usage is measured. */
3635
+ measureUsageFrom: Date;
3636
+ /** The time of the last reset. */
3637
+ lastReset: Date;
3638
+ }
3639
+ /** A static entitlement grants access to a feature together with a configuration. */
3640
+ export interface EntitlementStatic {
3641
+ id: string;
3642
+ /** The type of the entitlement. */
3643
+ type: 'static';
3644
+ /** The feature the customer is entitled to use. */
3645
+ feature: FeatureReference;
3646
+ /** The customer the entitlement belongs to. */
3647
+ customer: CustomerReference;
3648
+ labels?: Labels;
3649
+ /** The usage period of the entitlement. */
3650
+ usagePeriod?: RecurringPeriod;
3651
+ /** The current usage period of the entitlement. */
3652
+ currentUsagePeriod?: ClosedPeriod;
3653
+ /** The time from which the entitlement is active. */
3654
+ activeFrom: Date;
3655
+ /**
3656
+ * The time until which the entitlement is active. If not set, the entitlement is
3657
+ * active until deleted.
3658
+ */
3659
+ activeTo?: Date;
3660
+ /** The time the entitlement was created. */
3661
+ createdAt: Date;
3662
+ /** The time the entitlement was last updated. */
3663
+ updatedAt: Date;
3664
+ /** The time the entitlement was deleted. */
3665
+ deletedAt?: Date;
3666
+ /**
3667
+ * The entitlement configuration as a JSON value. Returned when checking
3668
+ * entitlement access.
3669
+ */
3670
+ config: unknown;
3671
+ }
3672
+ /** A boolean entitlement grants access to a feature. */
3673
+ export interface EntitlementBoolean {
3674
+ id: string;
3675
+ /** The type of the entitlement. */
3676
+ type: 'boolean';
3677
+ /** The feature the customer is entitled to use. */
3678
+ feature: FeatureReference;
3679
+ /** The customer the entitlement belongs to. */
3680
+ customer: CustomerReference;
3681
+ labels?: Labels;
3682
+ /** The usage period of the entitlement. */
3683
+ usagePeriod?: RecurringPeriod;
3684
+ /** The current usage period of the entitlement. */
3685
+ currentUsagePeriod?: ClosedPeriod;
3686
+ /** The time from which the entitlement is active. */
3687
+ activeFrom: Date;
3688
+ /**
3689
+ * The time until which the entitlement is active. If not set, the entitlement is
3690
+ * active until deleted.
3691
+ */
3692
+ activeTo?: Date;
3693
+ /** The time the entitlement was created. */
3694
+ createdAt: Date;
3695
+ /** The time the entitlement was last updated. */
3696
+ updatedAt: Date;
3697
+ /** The time the entitlement was deleted. */
3698
+ deletedAt?: Date;
3699
+ }
3700
+ /**
3701
+ * A grant issued for a metered entitlement. Each grant adds its amount to the
3702
+ * entitlement's balance from its effective time until it expires, and usage is
3703
+ * deducted from the grants in priority order.
3704
+ *
3705
+ * Grants are immutable, so the balance is deterministic regardless of when it is
3706
+ * queried. Deleting a grant ends it at the time of the deletion.
3707
+ */
3708
+ export interface EntitlementGrant {
3709
+ id: string;
3710
+ /** The ID of the entitlement the grant belongs to. */
3711
+ entitlementId: string;
3712
+ /** The ID of the customer the grant belongs to. */
3713
+ customerId?: string;
3714
+ /** The granted amount, in the feature's unit. */
3715
+ amount: string;
3716
+ /**
3717
+ * The priority of the grant. Lower values are consumed first: a grant with
3718
+ * priority 1 is consumed before one with priority 2. Among equal priorities, the
3719
+ * grant closest to expiration is consumed first, then the earliest created.
3720
+ */
3721
+ priority: number;
3722
+ /** The time the grant takes effect. */
3723
+ effectiveAt: Date;
3724
+ /**
3725
+ * The duration after which the grant expires, counted from `effective_at`. Always
3726
+ * a single-unit duration (for example `PT12H`, `P7D`, `P2W`, `P3M`, `P1Y`). Absent
3727
+ * when the grant never expires.
3728
+ */
3729
+ expiresAfter?: string;
3129
3730
  /**
3130
- * Display name of the resource.
3131
- *
3132
- * Between 1 and 256 characters.
3731
+ * The time the grant expires, calculated from `effective_at` and `expires_after`.
3732
+ * The grant is no longer in effect from this time. Absent when the grant never
3733
+ * expires.
3133
3734
  */
3134
- name: string;
3135
- /** Mapping to attribute metered usage to the customer by the event subject. */
3136
- usageAttribution?: UpdateCustomerUsageAttribution;
3137
- /** The billing address of the customer. Used for tax and invoicing. */
3138
- billingAddress?: UpdateAddress;
3139
- id: string;
3735
+ expiresAt?: Date;
3140
3736
  /**
3141
- * Optional external resource key for the customer.
3142
- *
3143
- * Omitted when the customer was created without a key. Unlike on the customer
3144
- * resource itself, the key is optional here because the invoice snapshot may
3145
- * predate or omit it.
3737
+ * The maximum balance the grant carries over at reset. The balance after a reset
3738
+ * is `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`.
3146
3739
  */
3147
- key?: string;
3148
- }
3149
- /** Checkout Session consent collection configuration. */
3150
- export interface AppStripeCreateCheckoutSessionConsentCollection {
3151
- /** Controls the visibility of payment method reuse agreement. */
3152
- paymentMethodReuseAgreement?: AppStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement;
3740
+ maxRolloverAmount: string;
3153
3741
  /**
3154
- * Enables collection of promotional communication consent.
3155
- *
3156
- * Only available to US merchants. When set to "auto", Checkout determines whether
3157
- * to show the option based on the customer's locale.
3742
+ * The minimum balance the grant carries over at reset. The balance after a reset
3743
+ * is `MIN(max_rollover_amount, MAX(balance_before_reset, min_rollover_amount))`.
3158
3744
  */
3159
- promotions?: 'auto' | 'none';
3745
+ minRolloverAmount: string;
3160
3746
  /**
3161
- * Requires customers to accept terms of service before payment.
3162
- *
3163
- * Requires a valid terms of service URL in your Stripe Dashboard settings.
3747
+ * The recurrence of the grant. When set, the grant amount is re-issued every
3748
+ * interval from the anchor, which defaults to `effective_at`. Absent for
3749
+ * non-recurring grants.
3164
3750
  */
3165
- termsOfService?: 'none' | 'required';
3751
+ recurrence?: RecurringPeriod;
3752
+ /** The next time the grant recurs. Absent for non-recurring grants. */
3753
+ nextRecurrence?: Date;
3754
+ /**
3755
+ * The time the grant was voided. A voided grant is no longer in effect from this
3756
+ * time.
3757
+ */
3758
+ voidedAt?: Date;
3759
+ labels?: Labels;
3760
+ /** An ISO-8601 timestamp representation of entity creation date. */
3761
+ createdAt: Date;
3762
+ /** An ISO-8601 timestamp representation of entity last update date. */
3763
+ updatedAt: Date;
3764
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3765
+ deletedAt?: Date;
3766
+ }
3767
+ /**
3768
+ * BillingWorkflowCollectionAlignmentAnchored specifies the alignment for
3769
+ * collecting the pending line items into an invoice.
3770
+ */
3771
+ export interface WorkflowCollectionAlignmentAnchored {
3772
+ /** The type of alignment. */
3773
+ type: 'anchored';
3774
+ /** The recurring period for the alignment. */
3775
+ recurringPeriod: RecurringPeriod;
3166
3776
  }
3167
3777
  /**
3168
3778
  * Add a new phase to the subscription. The phase is created without items; use
@@ -3174,15 +3784,33 @@ export interface SubscriptionEditAddPhase {
3174
3784
  /** The phase to add. */
3175
3785
  phase: SubscriptionPhaseCreate;
3176
3786
  }
3177
- /**
3178
- * BillingWorkflowCollectionAlignmentAnchored specifies the alignment for
3179
- * collecting the pending line items into an invoice.
3180
- */
3181
- export interface WorkflowCollectionAlignmentAnchored {
3182
- /** The type of alignment. */
3183
- type: 'anchored';
3184
- /** The recurring period for the alignment. */
3185
- recurringPeriod: RecurringPeriod;
3787
+ /** Filters for the credit grant. */
3788
+ export interface CreateCreditGrantFilters {
3789
+ /**
3790
+ * Limit the credit grant to specific features. If no features are specified, the
3791
+ * credit grant can be used for any feature.
3792
+ */
3793
+ features?: string[];
3794
+ /**
3795
+ * Limit credits to charges from these plans. Entries are alternatives; when
3796
+ * features are also specified, both dimensions must match. Omission or an empty
3797
+ * list leaves plans unrestricted.
3798
+ */
3799
+ plans?: CreateCreditGrantPlanFilter[];
3800
+ }
3801
+ /** Filters for the credit grant. */
3802
+ export interface CreditGrantFilters {
3803
+ /**
3804
+ * Limit the credit grant to specific features. If no features are specified, the
3805
+ * credit grant can be used for any feature.
3806
+ */
3807
+ features?: string[];
3808
+ /**
3809
+ * Limit credits to charges from these plans. Entries are alternatives; when
3810
+ * features are also specified, both dimensions must match. Omission or an empty
3811
+ * list leaves plans unrestricted.
3812
+ */
3813
+ plans?: CreditGrantPlanFilter[];
3186
3814
  }
3187
3815
  /** Subscription fields without phases or the current billing period. */
3188
3816
  export interface SubscriptionBase {
@@ -3463,6 +4091,11 @@ export interface EntitlementFeatureAccess {
3463
4091
  */
3464
4092
  reason?: EntitlementFeatureAccessReason;
3465
4093
  }
4094
+ /** Page paginated response. */
4095
+ export interface NotificationChannelPagePaginatedResponse {
4096
+ data: NotificationChannel[];
4097
+ meta: PaginatedMeta;
4098
+ }
3466
4099
  /** Billing customer data. */
3467
4100
  export interface CustomerData {
3468
4101
  /**
@@ -3485,18 +4118,6 @@ export interface UpsertCustomerBillingDataRequest {
3485
4118
  /** App customer data. */
3486
4119
  appData?: AppCustomerData;
3487
4120
  }
3488
- /** The balances of the credits of a customer. */
3489
- export interface CreditBalances {
3490
- /** The timestamp of the balance retrieval. */
3491
- retrievedAt: Date;
3492
- /** The balances by currencies. */
3493
- balances: CreditBalance[];
3494
- }
3495
- /** Cursor paginated response. */
3496
- export interface CreditTransactionPaginatedResponse {
3497
- data: CreditTransaction[];
3498
- meta: CursorMeta;
3499
- }
3500
4121
  /**
3501
4122
  * Flat fee intent fields from the system lifecycle controller shadowed by a manual
3502
4123
  * override.
@@ -3540,7 +4161,7 @@ export interface ChargeFlatFeeSystemIntent {
3540
4161
  /** List customer entitlement access response data. */
3541
4162
  export interface ListCustomerEntitlementAccessResponseData {
3542
4163
  /** The list of entitlement access results. */
3543
- data: EntitlementAccessResult[];
4164
+ data: EntitlementValueResult[];
3544
4165
  }
3545
4166
  /**
3546
4167
  * Graduated tiered price.
@@ -3762,6 +4383,18 @@ export interface WorkflowTaxSettings {
3762
4383
  */
3763
4384
  defaultTaxConfig?: TaxConfig;
3764
4385
  }
4386
+ /** The balances of the credits of a customer. */
4387
+ export interface CreditBalances {
4388
+ /** The timestamp of the balance retrieval. */
4389
+ retrievedAt: Date;
4390
+ /** The balances by currencies. */
4391
+ balances: CreditBalance[];
4392
+ }
4393
+ /** Cursor paginated response. */
4394
+ export interface CreditTransactionPaginatedResponse {
4395
+ data: CreditTransaction[];
4396
+ meta: CursorMeta;
4397
+ }
3765
4398
  /** Page paginated response. */
3766
4399
  export interface PlanAddonPagePaginatedResponse {
3767
4400
  data: PlanAddon[];
@@ -3772,6 +4405,20 @@ export interface IngestedEventPaginatedResponse {
3772
4405
  data: IngestedEvent[];
3773
4406
  meta: CursorMeta;
3774
4407
  }
4408
+ /** Balance and usage history of a metered entitlement. */
4409
+ export interface EntitlementHistory {
4410
+ /**
4411
+ * Usage in half-open windows of the requested size, aligned to the requested time
4412
+ * zone. Empty windows are included; windows before usage measurement began are
4413
+ * omitted.
4414
+ */
4415
+ windowedHistory: EntitlementHistoryWindow[];
4416
+ /**
4417
+ * Periods in which grants were consumed in a fixed order. A new segment starts
4418
+ * whenever grant priorities change or a usage period starts.
4419
+ */
4420
+ burndownHistory: EntitlementBurndownSegment[];
4421
+ }
3775
4422
  /** The list of parameters that failed validation. */
3776
4423
  export type InvalidParameters = InvalidParameter[];
3777
4424
  /** A meter query request. */
@@ -3950,6 +4597,44 @@ export interface AppStripeCreateCheckoutSessionRequestOptions {
3950
4597
  /** Configuration for collecting tax IDs during checkout. */
3951
4598
  taxIdCollection?: AppStripeCreateCheckoutSessionTaxIdCollection;
3952
4599
  }
4600
+ /** Metered entitlement create request. */
4601
+ export interface CreateEntitlementMeteredRequest {
4602
+ /** The type of the entitlement. */
4603
+ type: 'metered';
4604
+ /** The feature the customer is entitled to use. */
4605
+ feature: FeatureReference;
4606
+ labels?: Labels;
4607
+ /**
4608
+ * If true, the customer keeps access to the feature after the balance is
4609
+ * exhausted.
4610
+ */
4611
+ isSoftLimit: boolean;
4612
+ /** Usage granted automatically after each reset. Cannot be combined with `grants`. */
4613
+ issue?: EntitlementIssueAfterReset;
4614
+ /** The amount granted automatically after each reset. */
4615
+ issueAfterReset?: string;
4616
+ /** The priority of the grant created after each reset. */
4617
+ issueAfterResetPriority: number;
4618
+ /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
4619
+ preserveOverageAtReset: boolean;
4620
+ /**
4621
+ * The usage period of the entitlement. The balance resets at the start of every
4622
+ * period. The anchor defaults to the entitlement creation time.
4623
+ */
4624
+ usagePeriod: RecurringPeriodInput;
4625
+ /**
4626
+ * The time from which usage is measured. Defaults to the entitlement creation
4627
+ * time.
4628
+ */
4629
+ measureUsageFrom?: EntitlementMeasureUsageFrom;
4630
+ /** Grants created together with the entitlement. Cannot be combined with `issue`. */
4631
+ grants?: EntitlementGrantCreateRequest[];
4632
+ }
4633
+ /** Page paginated response. */
4634
+ export interface EntitlementGrantPagePaginatedResponse {
4635
+ data: EntitlementGrant[];
4636
+ meta: PaginatedMeta;
4637
+ }
3953
4638
  /** Snapshot of the billing workflow configuration captured at invoice creation. */
3954
4639
  export interface InvoiceWorkflowSettings {
3955
4640
  /** The apps that will be used to orchestrate the invoice's workflow. */
@@ -4428,7 +5113,7 @@ export interface CreateCreditGrantRequest {
4428
5113
  * credit grant tax code is applied, if that's not set the global default taxcode
4429
5114
  * is used.
4430
5115
  */
4431
- taxConfig?: CreateCreditGrantTaxConfig;
5116
+ taxConfig?: CreateTaxCodeConfig;
4432
5117
  filters?: CreateCreditGrantFilters;
4433
5118
  /** Draw-down priority of the grant. Lower values have higher priority. */
4434
5119
  priority: number;
@@ -4501,7 +5186,7 @@ export interface CreditGrant {
4501
5186
  * credit grant tax code is applied, if that's not set the global default taxcode
4502
5187
  * is used.
4503
5188
  */
4504
- taxConfig?: CreditGrantTaxConfig;
5189
+ taxConfig?: TaxCodeConfig;
4505
5190
  /** Available when `funding_method` is `invoice`. */
4506
5191
  invoice?: CreditGrantInvoiceReference;
4507
5192
  filters?: CreditGrantFilters;
@@ -4616,6 +5301,11 @@ export interface CustomerStripeCreateCheckoutSessionRequest {
4616
5301
  */
4617
5302
  stripeOptions: AppStripeCreateCheckoutSessionRequestOptions;
4618
5303
  }
5304
+ /** Page paginated response. */
5305
+ export interface EntitlementPagePaginatedResponse {
5306
+ data: Entitlement[];
5307
+ meta: PaginatedMeta;
5308
+ }
4619
5309
  /**
4620
5310
  * Workflow collection specifies how to collect the pending line items for an
4621
5311
  * invoice.
@@ -4775,7 +5465,7 @@ export interface RateCard {
4775
5465
  /** The discounts of the rate card. */
4776
5466
  discounts?: RateCardDiscounts;
4777
5467
  /** The tax config of the rate card. */
4778
- taxConfig?: RateCardTaxConfig;
5468
+ taxConfig?: TaxCodeConfig;
4779
5469
  /**
4780
5470
  * The entitlement template granted to subscribers of a plan or addon containing
4781
5471
  * this rate card. Requires `feature` to be set.
@@ -4787,7 +5477,7 @@ export interface InvoiceLineRateCard {
4787
5477
  /** The price definition used to calculate charges for this line. */
4788
5478
  price: Price;
4789
5479
  /** Tax configuration snapshot for this line. */
4790
- taxConfig?: RateCardTaxConfig;
5480
+ taxConfig?: TaxCodeConfig;
4791
5481
  /** The feature key associated with this line's rate card. */
4792
5482
  featureKey?: string;
4793
5483
  /** Discount configuration from the rate card. */
@@ -4927,7 +5617,7 @@ export interface UpdateInvoiceLineRateCard {
4927
5617
  /** The price definition used to calculate charges for this line. */
4928
5618
  price: UpdatePrice;
4929
5619
  /** Tax configuration snapshot for this line. */
4930
- taxConfig?: UpdateRateCardTaxConfig;
5620
+ taxConfig?: UpdateTaxCodeConfig;
4931
5621
  /** The feature key associated with this line's rate card. */
4932
5622
  featureKey?: string;
4933
5623
  /** Discount configuration from the rate card. */
@@ -6309,6 +6999,11 @@ export type MeterAggregation = 'sum' | 'count' | 'unique_count' | 'avg' | 'min'
6309
6999
  * format.
6310
7000
  */
6311
7001
  export type MeterQueryGranularity = 'PT1M' | 'PT1H' | 'P1D' | 'P1M';
7002
+ /**
7003
+ * The meter query granularities the usage history can be grouped into. Sub-hour
7004
+ * windows are too expensive to compute and monthly windows are not supported.
7005
+ */
7006
+ export type EntitlementHistoryWindowSize = 'PT1H' | 'P1D';
6312
7007
  /**
6313
7008
  * Filters on the given string field value by exact match. All properties are
6314
7009
  * optional; provide exactly one to specify the comparison.
@@ -6320,6 +7015,10 @@ export type StringFieldFilterExact = string | {
6320
7015
  };
6321
7016
  /** The payment term of a flat price. */
6322
7017
  export type PricePaymentTerm = 'in_advance' | 'in_arrears';
7018
+ /** Filter by a boolean value (true/false). */
7019
+ export type BooleanFieldFilter = boolean | {
7020
+ eq: boolean;
7021
+ };
6323
7022
  /** Fiat or custom currency code. */
6324
7023
  export type BillingCurrencyCode = string | string;
6325
7024
  /** Fiat or custom currency code. */
@@ -6344,6 +7043,8 @@ export type DateTimeFieldFilter = Date | {
6344
7043
  gt?: Date;
6345
7044
  gte?: Date;
6346
7045
  };
7046
+ /** The time from which usage is measured, as a preset or an explicit timestamp. */
7047
+ export type EntitlementMeasureUsageFrom = 'current_period_start' | 'now' | Date;
6347
7048
  /** Payment settings for a billing workflow. */
6348
7049
  export type WorkflowPaymentSettings = WorkflowPaymentChargeAutomaticallySettings | WorkflowPaymentSendInvoiceSettings;
6349
7050
  /**
@@ -6399,6 +7100,8 @@ export type ChargeRealizationDetailedLine = ChargeRealizationDetailedLineFlatFee
6399
7100
  export type Currency = CurrencyFiat | CurrencyCustom;
6400
7101
  /** Customer or reference. */
6401
7102
  export type CustomerOrReference = Customer | CustomerReference;
7103
+ /** An entitlement grants a customer access to a feature. */
7104
+ export type Entitlement = EntitlementMetered | EntitlementStatic | EntitlementBoolean;
6402
7105
  /**
6403
7106
  * The alignment for collecting the pending line items into an invoice.
6404
7107
  *
@@ -6418,6 +7121,8 @@ export type Price = PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVo
6418
7121
  export type PriceUsageBased = PriceUnit | PriceGraduated | PriceVolume;
6419
7122
  /** Price. */
6420
7123
  export type UpdatePrice = UpdatePriceFree | UpdatePriceFlat | UpdatePriceUnit | UpdatePriceGraduated | UpdatePriceVolume;
7124
+ /** Entitlement create request. */
7125
+ export type CreateEntitlementRequest = CreateEntitlementMeteredRequest | CreateEntitlementStaticRequest | CreateEntitlementBooleanRequest;
6421
7126
  /** Installed application. */
6422
7127
  export type App = AppStripe | AppSandbox | AppExternalInvoicing;
6423
7128
  /** Response of the app install. */
@@ -6546,6 +7251,19 @@ export interface UpdateBillingWorkflowPaymentSendInvoiceSettingsInput {
6546
7251
  */
6547
7252
  dueAfter?: string;
6548
7253
  }
7254
+ /**
7255
+ * Usage granted automatically after each reset of a metered entitlement. The
7256
+ * balance returns to `amount` after every reset.
7257
+ */
7258
+ export interface EntitlementIssueAfterResetInput {
7259
+ /** The amount granted after each reset, in the feature's unit. */
7260
+ amount: string;
7261
+ /**
7262
+ * The priority of the grant created after each reset. Lower values have higher
7263
+ * priority.
7264
+ */
7265
+ priority?: number;
7266
+ }
6549
7267
  /** Metering event following the CloudEvents specification. */
6550
7268
  export interface EventInput {
6551
7269
  /** Identifies the event. */
@@ -6576,6 +7294,24 @@ export interface EventInput {
6576
7294
  /** The event payload. Optional, if present it must be a JSON object. */
6577
7295
  data?: Record<string, unknown> | null;
6578
7296
  }
7297
+ /** Request body for resetting the usage of a metered entitlement. */
7298
+ export interface ResetCustomerEntitlementUsageRequestInput {
7299
+ /**
7300
+ * The time the reset takes effect. Defaults to the current time and cannot be in
7301
+ * the future. Truncated to the minute.
7302
+ */
7303
+ effectiveAt?: Date;
7304
+ /**
7305
+ * Whether the usage period anchor is kept. When false, the anchor moves to
7306
+ * `effective_at`.
7307
+ */
7308
+ retainAnchor?: boolean;
7309
+ /**
7310
+ * Whether overage carries over into the new usage period. Defaults to the
7311
+ * entitlement's own setting.
7312
+ */
7313
+ preserveOverage?: boolean;
7314
+ }
6579
7315
  /** Unauthorized. */
6580
7316
  export interface UnauthorizedInput extends BaseErrorInput {
6581
7317
  }
@@ -6762,6 +7498,120 @@ export interface EntitlementAccessQueryRequestInput {
6762
7498
  customer: EntitlementAccessQueryRequestCustomers;
6763
7499
  feature?: EntitlementAccessQueryRequestFeatures;
6764
7500
  }
7501
+ /**
7502
+ * A notification channel delivers notification events, such as entitlement balance
7503
+ * threshold crossings, to an external system. Today the only supported channel
7504
+ * type is a webhook delivered via Svix.
7505
+ */
7506
+ export interface NotificationChannelInput {
7507
+ id: string;
7508
+ /**
7509
+ * Display name of the resource.
7510
+ *
7511
+ * Between 1 and 256 characters.
7512
+ */
7513
+ name: string;
7514
+ labels?: Labels;
7515
+ /** An ISO-8601 timestamp representation of entity creation date. */
7516
+ createdAt: Date;
7517
+ /** An ISO-8601 timestamp representation of entity last update date. */
7518
+ updatedAt: Date;
7519
+ /** An ISO-8601 timestamp representation of entity deletion date. */
7520
+ deletedAt?: Date;
7521
+ /** The type of the channel. Immutable after creation. */
7522
+ type: 'webhook';
7523
+ /**
7524
+ * Whether the channel is disabled. Disabled channels do not receive notification
7525
+ * events.
7526
+ */
7527
+ disabled?: boolean;
7528
+ /** The URL that webhook notification events are delivered to. */
7529
+ url: string;
7530
+ /**
7531
+ * Custom HTTP headers to include on every webhook delivery request, keyed by
7532
+ * header name.
7533
+ */
7534
+ customHeaders?: Record<string, string>;
7535
+ /**
7536
+ * Secret used to sign outgoing webhook payloads so recipients can verify their
7537
+ * authenticity. If omitted on create, a secret is generated automatically by the
7538
+ * delivery provider. This is a sensitive credential returned in responses (unlike
7539
+ * most secrets) specifically so clients can retrieve a server-generated value and
7540
+ * verify webhook signatures; handle it with the same care as any other credential.
7541
+ */
7542
+ signingSecret?: string;
7543
+ }
7544
+ /** NotificationChannel create request. */
7545
+ export interface CreateNotificationChannelRequestInput {
7546
+ /**
7547
+ * Display name of the resource.
7548
+ *
7549
+ * Between 1 and 256 characters.
7550
+ */
7551
+ name: string;
7552
+ labels?: Labels;
7553
+ /** The type of the channel. Immutable after creation. */
7554
+ type: 'webhook';
7555
+ /**
7556
+ * Whether the channel is disabled. Disabled channels do not receive notification
7557
+ * events.
7558
+ */
7559
+ disabled?: boolean;
7560
+ /** The URL that webhook notification events are delivered to. */
7561
+ url: string;
7562
+ /**
7563
+ * Custom HTTP headers to include on every webhook delivery request, keyed by
7564
+ * header name.
7565
+ */
7566
+ customHeaders?: Record<string, string>;
7567
+ /**
7568
+ * Secret used to sign outgoing webhook payloads so recipients can verify their
7569
+ * authenticity. If omitted on create, a secret is generated automatically by the
7570
+ * delivery provider. This is a sensitive credential returned in responses (unlike
7571
+ * most secrets) specifically so clients can retrieve a server-generated value and
7572
+ * verify webhook signatures; handle it with the same care as any other credential.
7573
+ */
7574
+ signingSecret?: string;
7575
+ }
7576
+ /**
7577
+ * Request body for updating a notification channel. Updates replace the channel's
7578
+ * mutable state rather than merging it: `type`, `name`, and `url` must always be
7579
+ * provided, and omitting `disabled`, `labels`, or `custom_headers` resets them to
7580
+ * their defaults (enabled, no labels, no custom headers). `signing_secret` is the
7581
+ * one exception: omitting it keeps the channel's current signing secret instead of
7582
+ * clearing the credential.
7583
+ */
7584
+ export interface UpdateBillingNotificationChannelRequestInput {
7585
+ /**
7586
+ * Display name of the resource.
7587
+ *
7588
+ * Between 1 and 256 characters.
7589
+ */
7590
+ name: string;
7591
+ /** The type of the channel. Immutable after creation. */
7592
+ type: 'webhook';
7593
+ /** The URL that webhook notification events are delivered to. */
7594
+ url: string;
7595
+ labels?: Labels;
7596
+ /**
7597
+ * Whether the channel is disabled. Disabled channels do not receive notification
7598
+ * events.
7599
+ */
7600
+ disabled?: boolean;
7601
+ /**
7602
+ * Custom HTTP headers to include on every webhook delivery request, keyed by
7603
+ * header name.
7604
+ */
7605
+ customHeaders?: Record<string, string>;
7606
+ /**
7607
+ * Secret used to sign outgoing webhook payloads so recipients can verify their
7608
+ * authenticity. If omitted on create, a secret is generated automatically by the
7609
+ * delivery provider. This is a sensitive credential returned in responses (unlike
7610
+ * most secrets) specifically so clients can retrieve a server-generated value and
7611
+ * verify webhook signatures; handle it with the same care as any other credential.
7612
+ */
7613
+ signingSecret?: string;
7614
+ }
6765
7615
  /** An ingested metering event with ingestion metadata. */
6766
7616
  export interface IngestedEventInput {
6767
7617
  /** The original event ingested. */
@@ -6775,6 +7625,58 @@ export interface IngestedEventInput {
6775
7625
  /** The validation errors of the ingested event. */
6776
7626
  validationErrors?: IngestedEventValidationError[];
6777
7627
  }
7628
+ /**
7629
+ * A metered entitlement grants a usage allowance for a feature. Access is
7630
+ * determined by the balance: the allowance provided by grants is burnt down by
7631
+ * usage.
7632
+ */
7633
+ export interface EntitlementMeteredInput {
7634
+ id: string;
7635
+ /** The type of the entitlement. */
7636
+ type: 'metered';
7637
+ /** The feature the customer is entitled to use. */
7638
+ feature: FeatureReference;
7639
+ /** The customer the entitlement belongs to. */
7640
+ customer: CustomerReference;
7641
+ labels?: Labels;
7642
+ /** The time from which the entitlement is active. */
7643
+ activeFrom: Date;
7644
+ /**
7645
+ * The time until which the entitlement is active. If not set, the entitlement is
7646
+ * active until deleted.
7647
+ */
7648
+ activeTo?: Date;
7649
+ /** The time the entitlement was created. */
7650
+ createdAt: Date;
7651
+ /** The time the entitlement was last updated. */
7652
+ updatedAt: Date;
7653
+ /** The time the entitlement was deleted. */
7654
+ deletedAt?: Date;
7655
+ /**
7656
+ * The usage period of the entitlement. The balance resets at the start of every
7657
+ * period.
7658
+ */
7659
+ usagePeriod: RecurringPeriod;
7660
+ /** The current usage period of the entitlement. */
7661
+ currentUsagePeriod: ClosedPeriod;
7662
+ /**
7663
+ * If true, the customer keeps access to the feature after the balance is
7664
+ * exhausted.
7665
+ */
7666
+ isSoftLimit?: boolean;
7667
+ /** Usage granted automatically after each reset. Cannot be combined with `grants`. */
7668
+ issue?: EntitlementIssueAfterResetInput;
7669
+ /** The amount granted automatically after each reset. */
7670
+ issueAfterReset?: string;
7671
+ /** The priority of the grant created after each reset. */
7672
+ issueAfterResetPriority?: number;
7673
+ /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
7674
+ preserveOverageAtReset?: boolean;
7675
+ /** The time from which usage is measured. */
7676
+ measureUsageFrom: Date;
7677
+ /** The time of the last reset. */
7678
+ lastReset: Date;
7679
+ }
6778
7680
  /** Subscription fields without phases or the current billing period. */
6779
7681
  export interface SubscriptionBaseInput {
6780
7682
  id: string;
@@ -6906,6 +7808,11 @@ export interface UpdateBillingInvoiceWorkflowInput {
6906
7808
  /** Payment settings for this invoice. */
6907
7809
  payment?: UpdateBillingWorkflowPaymentSettingsInput;
6908
7810
  }
7811
+ /** Page paginated response. */
7812
+ export interface NotificationChannelPagePaginatedResponseInput {
7813
+ data: NotificationChannelInput[];
7814
+ meta: PaginatedMeta;
7815
+ }
6909
7816
  /** Purchase and payment terms of the grant. */
6910
7817
  export interface CreateCreditGrantPurchaseInput {
6911
7818
  /**
@@ -7130,6 +8037,39 @@ export interface AppStripeCreateCheckoutSessionRequestOptionsInput {
7130
8037
  /** Configuration for collecting tax IDs during checkout. */
7131
8038
  taxIdCollection?: AppStripeCreateCheckoutSessionTaxIdCollectionInput;
7132
8039
  }
8040
+ /** Metered entitlement create request. */
8041
+ export interface CreateEntitlementMeteredRequestInput {
8042
+ /** The type of the entitlement. */
8043
+ type: 'metered';
8044
+ /** The feature the customer is entitled to use. */
8045
+ feature: FeatureReference;
8046
+ labels?: Labels;
8047
+ /**
8048
+ * If true, the customer keeps access to the feature after the balance is
8049
+ * exhausted.
8050
+ */
8051
+ isSoftLimit?: boolean;
8052
+ /** Usage granted automatically after each reset. Cannot be combined with `grants`. */
8053
+ issue?: EntitlementIssueAfterResetInput;
8054
+ /** The amount granted automatically after each reset. */
8055
+ issueAfterReset?: string;
8056
+ /** The priority of the grant created after each reset. */
8057
+ issueAfterResetPriority?: number;
8058
+ /** If true, the overage is preserved at reset. If false, the usage is reset to 0. */
8059
+ preserveOverageAtReset?: boolean;
8060
+ /**
8061
+ * The usage period of the entitlement. The balance resets at the start of every
8062
+ * period. The anchor defaults to the entitlement creation time.
8063
+ */
8064
+ usagePeriod: RecurringPeriodInput;
8065
+ /**
8066
+ * The time from which usage is measured. Defaults to the entitlement creation
8067
+ * time.
8068
+ */
8069
+ measureUsageFrom?: EntitlementMeasureUsageFrom;
8070
+ /** Grants created together with the entitlement. Cannot be combined with `issue`. */
8071
+ grants?: EntitlementGrantCreateRequest[];
8072
+ }
7133
8073
  /** Snapshot of the billing workflow configuration captured at invoice creation. */
7134
8074
  export interface InvoiceWorkflowSettingsInput {
7135
8075
  /** The apps that will be used to orchestrate the invoice's workflow. */
@@ -7238,7 +8178,7 @@ export interface CreateCreditGrantRequestInput {
7238
8178
  * credit grant tax code is applied, if that's not set the global default taxcode
7239
8179
  * is used.
7240
8180
  */
7241
- taxConfig?: CreateCreditGrantTaxConfig;
8181
+ taxConfig?: CreateTaxCodeConfig;
7242
8182
  filters?: CreateCreditGrantFilters;
7243
8183
  /** Draw-down priority of the grant. Lower values have higher priority. */
7244
8184
  priority?: number;
@@ -7311,7 +8251,7 @@ export interface CreditGrantInput {
7311
8251
  * credit grant tax code is applied, if that's not set the global default taxcode
7312
8252
  * is used.
7313
8253
  */
7314
- taxConfig?: CreditGrantTaxConfig;
8254
+ taxConfig?: TaxCodeConfig;
7315
8255
  /** Available when `funding_method` is `invoice`. */
7316
8256
  invoice?: CreditGrantInvoiceReference;
7317
8257
  filters?: CreditGrantFilters;
@@ -7370,6 +8310,11 @@ export interface CustomerStripeCreateCheckoutSessionRequestInput {
7370
8310
  */
7371
8311
  stripeOptions: AppStripeCreateCheckoutSessionRequestOptionsInput;
7372
8312
  }
8313
+ /** Page paginated response. */
8314
+ export interface EntitlementPagePaginatedResponseInput {
8315
+ data: EntitlementInput[];
8316
+ meta: PaginatedMeta;
8317
+ }
7373
8318
  /**
7374
8319
  * Workflow collection specifies how to collect the pending line items for an
7375
8320
  * invoice.
@@ -7517,7 +8462,7 @@ export interface RateCardInput {
7517
8462
  /** The discounts of the rate card. */
7518
8463
  discounts?: RateCardDiscounts;
7519
8464
  /** The tax config of the rate card. */
7520
- taxConfig?: RateCardTaxConfig;
8465
+ taxConfig?: TaxCodeConfig;
7521
8466
  /**
7522
8467
  * The entitlement template granted to subscribers of a plan or addon containing
7523
8468
  * this rate card. Requires `feature` to be set.
@@ -7529,7 +8474,7 @@ export interface InvoiceLineRateCardInput {
7529
8474
  /** The price definition used to calculate charges for this line. */
7530
8475
  price: Price;
7531
8476
  /** Tax configuration snapshot for this line. */
7532
- taxConfig?: RateCardTaxConfig;
8477
+ taxConfig?: TaxCodeConfig;
7533
8478
  /** The feature key associated with this line's rate card. */
7534
8479
  featureKey?: string;
7535
8480
  /** Discount configuration from the rate card. */
@@ -8965,6 +9910,10 @@ export type UpdateBillingWorkflowPaymentSettingsInput = UpdateBillingWorkflowPay
8965
9910
  * rate card itself, so it is omitted here.
8966
9911
  */
8967
9912
  export type RateCardEntitlementInput = RateCardMeteredEntitlementInput | RateCardStaticEntitlement | RateCardBooleanEntitlement;
9913
+ /** An entitlement grants a customer access to a feature. */
9914
+ export type EntitlementInput = EntitlementMeteredInput | EntitlementStatic | EntitlementBoolean;
9915
+ /** Entitlement create request. */
9916
+ export type CreateEntitlementRequestInput = CreateEntitlementMeteredRequestInput | CreateEntitlementStaticRequest | CreateEntitlementBooleanRequest;
8968
9917
  /** ChargeRealizationInvoice or reference. */
8969
9918
  export type ChargeRealizationInvoiceOrReferenceInput = ChargeRealizationInvoiceInput | ChargeRealizationInvoiceReference;
8970
9919
  /** Customer charge. */