@stripe/extensibility-sdk 0.22.4 → 0.24.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 (52) hide show
  1. package/dist/api-surface.d.ts.map +1 -0
  2. package/dist/config-values/generate.cjs +1 -1
  3. package/dist/config-values/generate.d.ts +2 -2
  4. package/dist/config-values/generate.d.ts.map +1 -1
  5. package/dist/config-values/generate.js +1 -1
  6. package/dist/extensibility-sdk-alpha.d.ts +1290 -1
  7. package/dist/extensibility-sdk-beta.d.ts +1290 -1
  8. package/dist/extensibility-sdk-config-values-internal.d.ts +2 -2
  9. package/dist/extensibility-sdk-extensions-alpha.d.ts +95 -114
  10. package/dist/extensibility-sdk-extensions-beta.d.ts +95 -114
  11. package/dist/extensibility-sdk-extensions-internal.d.ts +106 -147
  12. package/dist/extensibility-sdk-extensions-public.d.ts +95 -114
  13. package/dist/extensibility-sdk-internal.d.ts +1301 -1
  14. package/dist/extensibility-sdk-public.d.ts +1290 -1
  15. package/dist/extensions/billing/bill/discount_calculation.d.ts +7 -10
  16. package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -1
  17. package/dist/extensions/billing/customer_balance_application.d.ts +7 -9
  18. package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -1
  19. package/dist/extensions/billing/invoice_collection_setting.d.ts +15 -19
  20. package/dist/extensions/billing/invoice_collection_setting.d.ts.map +1 -1
  21. package/dist/extensions/billing/prorations.d.ts +25 -34
  22. package/dist/extensions/billing/prorations.d.ts.map +1 -1
  23. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +29 -47
  24. package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -1
  25. package/dist/extensions/billing/types.d.ts +4 -4
  26. package/dist/extensions/core/workflows/custom_action.d.ts +7 -12
  27. package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -1
  28. package/dist/extensions/extend/workflows/custom_action.d.ts +7 -12
  29. package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -1
  30. package/dist/extensions/index.cjs +0 -2
  31. package/dist/extensions/index.d.ts +6 -2
  32. package/dist/extensions/index.d.ts.map +1 -1
  33. package/dist/extensions/index.js +1 -2
  34. package/dist/index.cjs +2317 -0
  35. package/dist/index.d.ts +2 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +2320 -0
  38. package/dist/stdlib/decimal.d.ts +4 -40
  39. package/dist/stdlib/refs.d.ts +7 -21
  40. package/dist/stdlib/scalars.d.ts +16 -71
  41. package/dist/stdlib/type-utils.d.ts +1 -3
  42. package/dist/stdlib/types.d.ts +6 -6
  43. package/dist/tsconfig.build.tsbuildinfo +1 -1
  44. package/package.json +3 -11
  45. package/dist/extensibility-sdk-jsonschema-alpha.d.ts +0 -3
  46. package/dist/extensibility-sdk-jsonschema-beta.d.ts +0 -3
  47. package/dist/extensibility-sdk-jsonschema-internal.d.ts +0 -15
  48. package/dist/extensibility-sdk-jsonschema-public.d.ts +0 -3
  49. package/dist/jsonschema.cjs +0 -18
  50. package/dist/jsonschema.d.ts +0 -2
  51. package/dist/jsonschema.d.ts.map +0 -1
  52. package/dist/jsonschema.js +0 -0
@@ -4,7 +4,7 @@
4
4
  * Lean runtime for Stripe script extensions.
5
5
  *
6
6
  * - Standard library utilities (Decimal, Integer, Ref, etc.)
7
- * - Extension interfaces via `./extensions` subpath
7
+ * - Extension interfaces (Billing, Core, Extend namespaces, Context)
8
8
  *
9
9
  * @packageDocumentation
10
10
  */
@@ -39,6 +39,19 @@ export declare const __brand: unique symbol;
39
39
  */
40
40
  export declare const __stripeType: unique symbol;
41
41
 
42
+ /** @public */
43
+ declare type AnyTimeRange = {
44
+ at: Date;
45
+ value: 'oneTime';
46
+ } | {
47
+ endDate: Date;
48
+ startDate: Date;
49
+ value: 'timeRange';
50
+ } | {
51
+ otherValue: string;
52
+ value: 'other';
53
+ };
54
+
42
55
  /* Excluded from this release type: _apply */
43
56
 
44
57
  /* Excluded from this release type: _applyConfig */
@@ -49,6 +62,28 @@ export declare const __stripeType: unique symbol;
49
62
 
50
63
  /* Excluded from this release type: _ApplyStrategy */
51
64
 
65
+ declare namespace Bill {
66
+ export {
67
+ DiscountCalculation
68
+ }
69
+ }
70
+
71
+ declare namespace Billing {
72
+ export {
73
+ CustomerBalanceApplication,
74
+ InvoiceCollectionSetting,
75
+ Prorations,
76
+ RecurringBillingItemHandling,
77
+ Bill,
78
+ OneTime,
79
+ TimeRange,
80
+ AnyTimeRange,
81
+ Currency,
82
+ MonetaryAmount
83
+ }
84
+ }
85
+ export { Billing }
86
+
52
87
  /** The type of the opaque brand symbol used as a property key in SDK branded types. @public */
53
88
  export declare type BrandSymbol = typeof __brand;
54
89
 
@@ -58,9 +93,370 @@ export declare type BrandSymbol = typeof __brand;
58
93
 
59
94
  /* Excluded from this release type: _ConfigEnum */
60
95
 
96
+ /** @public */
97
+ export declare interface Context {
98
+ type: string;
99
+ id: string;
100
+ livemode: boolean;
101
+ stripeContext?: string;
102
+ clockTime?: string;
103
+ }
104
+
105
+ declare namespace Core {
106
+ export {
107
+ Workflows
108
+ }
109
+ }
110
+ export { Core }
111
+
61
112
  /** @public */
62
113
  export declare type Currency = 'aed' | 'afn' | 'all' | 'amd' | 'ang' | 'aoa' | 'apt' | 'arb' | 'ars' | 'aud' | 'avax' | 'awg' | 'azn' | 'bam' | 'bbd' | 'bdt' | 'bgn' | 'bhd' | 'bif' | 'bmd' | 'bnb' | 'bnd' | 'bob' | 'bov' | 'brl' | 'bsd' | 'btc' | 'btn' | 'buidl' | 'bwp' | 'byn' | 'byr' | 'bzd' | 'cad' | 'cdf' | 'celo' | 'che' | 'chf' | 'chw' | 'clf' | 'clp' | 'cny' | 'cop' | 'cou' | 'crc' | 'cuc' | 'cup' | 'cve' | 'czk' | 'dai' | 'djf' | 'dkk' | 'dop' | 'dzd' | 'eek' | 'egp' | 'ern' | 'etb' | 'eth' | 'eur' | 'eurc' | 'fjd' | 'fkp' | 'frxusd' | 'gbp' | 'gel' | 'ghc' | 'ghs' | 'gip' | 'gmd' | 'gnf' | 'gtq' | 'gyd' | 'hkd' | 'hnl' | 'hrk' | 'htg' | 'huf' | 'hype' | 'idr' | 'ils' | 'inr' | 'iqd' | 'irr' | 'isk' | 'jmd' | 'jod' | 'jpy' | 'kes' | 'kgs' | 'khr' | 'kmf' | 'kpw' | 'krw' | 'kwd' | 'kyd' | 'kzt' | 'lak' | 'lbp' | 'lkr' | 'lrd' | 'lsl' | 'ltl' | 'lvl' | 'lyd' | 'lzd' | 'm' | 'mad' | 'mdl' | 'mga' | 'mkd' | 'mmk' | 'mnt' | 'mop' | 'mro' | 'mru' | 'mur' | 'mvr' | 'mwk' | 'mxn' | 'mxv' | 'myr' | 'mzn' | 'nad' | 'ngn' | 'nio' | 'nok' | 'npr' | 'nzd' | 'omr' | 'pab' | 'pen' | 'pgk' | 'php' | 'pkr' | 'pln' | 'pol' | 'pyg' | 'pyusd' | 'qar' | 'rd' | 're' | 'ron' | 'rsd' | 'rub' | 'rwf' | 'sar' | 'sbd' | 'scr' | 'sdg' | 'sek' | 'sgd' | 'shp' | 'sle' | 'sll' | 'sol' | 'sos' | 'srd' | 'ssp' | 'std' | 'stn' | 'sui' | 'svc' | 'syp' | 'szl' | 'thb' | 'tjs' | 'tmt' | 'tnd' | 'top' | 'trx' | 'try' | 'ttd' | 'twd' | 'tzs' | 'uah' | 'ugx' | 'usd' | 'usdb' | 'usdc' | 'usdg' | 'usdp' | 'usdt' | 'usn' | 'ustb' | 'uyi' | 'uyu' | 'uzs' | 'vef' | 'ves' | 'vnd' | 'vuv' | 'wst' | 'xaf' | 'xcd' | 'xcg' | 'xeur' | 'xlm' | 'xof' | 'xpf' | 'xpl' | 'xusd' | 'yer' | 'zar' | 'zmk' | 'zmw' | 'zwd' | 'zwg' | 'zwl';
63
114
 
115
+ /** @public */
116
+ declare namespace CustomAction {
117
+ /**
118
+ * Response payload for GetFormState.
119
+ * @public
120
+ */
121
+ interface GetFormStateResponse {
122
+ /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
123
+ values: Record<string, unknown>;
124
+ /** Per-field configuration keyed by field name. */
125
+ config: Record<string, FormStateFieldConfig>;
126
+ }
127
+ /**
128
+ * Configuration for a single form field, returned by GetFormState.
129
+ * @public
130
+ */
131
+ interface FormStateFieldConfig {
132
+ /** Dropdown options for `dynamic_select` fields. */
133
+ options: SelectOption[];
134
+ /** JSON Schema for dynamic_schema fields. Defines the structure of a dynamic object field (for example, template merge variables). V0 limitation: must be a flat object with string properties only. */
135
+ schema: Record<string, unknown>;
136
+ /** Whether the field is disabled (non-interactive). */
137
+ disabled?: boolean;
138
+ /** Whether the field is hidden from the form. */
139
+ hidden?: boolean;
140
+ /** Warning message displayed on the field. You can still save the workflow. */
141
+ warning?: string;
142
+ /** Error message displayed on the field. Blocks saving the workflow. */
143
+ error?: string;
144
+ }
145
+ /**
146
+ * An option in a dynamic_select dropdown.
147
+ * @public
148
+ */
149
+ interface SelectOption {
150
+ value: string;
151
+ label: string;
152
+ }
153
+ /**
154
+ * Request payload for GetFormState, sent at configuration time.
155
+ * @public
156
+ */
157
+ interface GetFormStateRequest {
158
+ /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
159
+ values: Record<string, unknown>;
160
+ /** The name of the field that just changed, triggering this request. Empty on initial form load; set to the field name (for example, `audience_id`) when a user changes a value. */
161
+ changedField?: string;
162
+ }
163
+ /** @public */
164
+ type ExecuteCustomActionResponse = Record<string, never>;
165
+ /**
166
+ * **************************************************************************** DEPRECATED: This proto is deprecated and should no longer be used. Please use the following proto instead: ***************************************************************************** / /** Request payload for executing a custom action, provided at workflow runtime.
167
+ * @public
168
+ */
169
+ interface ExecuteCustomActionRequest {
170
+ /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
171
+ customInput: Record<string, unknown>;
172
+ }
173
+ /**
174
+ * @public
175
+ * @deprecated Platform dispatch handles wire/SDK conversion.
176
+ */
177
+ function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
178
+ /**
179
+ * @public
180
+ * @deprecated Platform dispatch handles wire/SDK conversion.
181
+ */
182
+ function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
183
+ /* Excluded from this release type: $platformWrapExecute */
184
+ /**
185
+ * @public
186
+ * @deprecated Platform dispatch handles wire/SDK conversion.
187
+ */
188
+ function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
189
+ /**
190
+ * @public
191
+ * @deprecated Platform dispatch handles wire/SDK conversion.
192
+ */
193
+ function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
194
+ /* Excluded from this release type: $platformWrapGetFormState */
195
+ /**
196
+ * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
197
+ * @public
198
+ */
199
+ type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
200
+ /**
201
+ * Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
202
+ * @public
203
+ */
204
+ type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
205
+ }
206
+
207
+ /**
208
+ * @example
209
+ * ```ts
210
+ * import type { Core, Context } from '@stripe/extensibility-sdk';
211
+ *
212
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
213
+ * interface MyCustomActionConfig {}
214
+ *
215
+ * export default class MyCustomAction implements Core.Workflows
216
+ * .CustomAction<MyCustomActionConfig> {
217
+ * execute(
218
+ * _request: Core.Workflows.CustomAction.ExecuteCustomActionRequest,
219
+ * _config: MyCustomActionConfig,
220
+ * _context: Context
221
+ * ) {
222
+ * // TODO: implement your action logic here
223
+ *
224
+ * return {};
225
+ * }
226
+ *
227
+ * getFormState(
228
+ * _request: Core.Workflows.CustomAction.GetFormStateRequest,
229
+ * _config: MyCustomActionConfig,
230
+ * _context: Context
231
+ * ) {
232
+ * // TODO: implement your logic here
233
+ *
234
+ * return {
235
+ * values: {},
236
+ * config: {},
237
+ * };
238
+ * }
239
+ * }
240
+ *
241
+ * ```
242
+ * @public
243
+ */
244
+ declare interface CustomAction<Config> {
245
+ execute: CustomAction.ExecuteFunction<Config>;
246
+ getFormState?: CustomAction.GetFormStateFunction<Config>;
247
+ }
248
+
249
+ /** @public */
250
+ declare namespace CustomAction_2 {
251
+ /**
252
+ * Response payload for GetFormState.
253
+ * @public
254
+ */
255
+ interface GetFormStateResponse {
256
+ /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
257
+ values: Record<string, unknown>;
258
+ /** Per-field configuration keyed by field name. */
259
+ config: Record<string, FormStateFieldConfig>;
260
+ }
261
+ /**
262
+ * Configuration for a single form field, returned by GetFormState.
263
+ * @public
264
+ */
265
+ interface FormStateFieldConfig {
266
+ /** Dropdown options for `dynamic_select` fields. */
267
+ options: SelectOption[];
268
+ /** JSON Schema for dynamic_schema fields. Defines the structure of a dynamic object field (for example, template merge variables). V0 limitation: must be a flat object with string properties only. */
269
+ schema: Record<string, unknown>;
270
+ /** Whether the field is disabled (non-interactive). */
271
+ disabled?: boolean;
272
+ /** Whether the field is hidden from the form. */
273
+ hidden?: boolean;
274
+ /** Warning message displayed on the field. You can still save the workflow. */
275
+ warning?: string;
276
+ /** Error message displayed on the field. Blocks saving the workflow. */
277
+ error?: string;
278
+ }
279
+ /**
280
+ * An option in a dynamic_select dropdown.
281
+ * @public
282
+ */
283
+ interface SelectOption {
284
+ value: string;
285
+ label: string;
286
+ }
287
+ /**
288
+ * Request payload for GetFormState, sent at configuration time.
289
+ * @public
290
+ */
291
+ interface GetFormStateRequest {
292
+ /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
293
+ values: Record<string, unknown>;
294
+ /** The name of the field that just changed, triggering this request. Empty on initial form load; set to the field name (for example, `audience_id`) when a user changes a value. */
295
+ changedField?: string;
296
+ }
297
+ /** @public */
298
+ type ExecuteCustomActionResponse = Record<string, never>;
299
+ /**
300
+ * Request payload for executing a custom action, provided at workflow runtime.
301
+ * @public
302
+ */
303
+ interface ExecuteCustomActionRequest {
304
+ /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
305
+ customInput: Record<string, unknown>;
306
+ }
307
+ /**
308
+ * @public
309
+ * @deprecated Platform dispatch handles wire/SDK conversion.
310
+ */
311
+ function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
312
+ /**
313
+ * @public
314
+ * @deprecated Platform dispatch handles wire/SDK conversion.
315
+ */
316
+ function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
317
+ /* Excluded from this release type: $platformWrapExecute */
318
+ /**
319
+ * @public
320
+ * @deprecated Platform dispatch handles wire/SDK conversion.
321
+ */
322
+ function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
323
+ /**
324
+ * @public
325
+ * @deprecated Platform dispatch handles wire/SDK conversion.
326
+ */
327
+ function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
328
+ /* Excluded from this release type: $platformWrapGetFormState */
329
+ /**
330
+ * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
331
+ * @public
332
+ */
333
+ type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
334
+ /**
335
+ * Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
336
+ * @public
337
+ */
338
+ type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
339
+ }
340
+
341
+ /**
342
+ * @example
343
+ * ```ts
344
+ * import type { Extend, Context } from '@stripe/extensibility-sdk';
345
+ *
346
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
347
+ * interface MyCustomActionConfig {}
348
+ *
349
+ * export default class MyCustomAction implements Extend.Workflows
350
+ * .CustomAction<MyCustomActionConfig> {
351
+ * execute(
352
+ * _request: Extend.Workflows.CustomAction.ExecuteCustomActionRequest,
353
+ * _config: MyCustomActionConfig,
354
+ * _context: Context
355
+ * ) {
356
+ * // TODO: implement your action logic here
357
+ *
358
+ * return {};
359
+ * }
360
+ *
361
+ * getFormState(
362
+ * _request: Extend.Workflows.CustomAction.GetFormStateRequest,
363
+ * _config: MyCustomActionConfig,
364
+ * _context: Context
365
+ * ) {
366
+ * // TODO: implement your logic here
367
+ *
368
+ * return {
369
+ * values: {},
370
+ * config: {},
371
+ * };
372
+ * }
373
+ * }
374
+ *
375
+ * ```
376
+ * @public
377
+ */
378
+ declare interface CustomAction_2<Config> {
379
+ execute: CustomAction_2.ExecuteFunction<Config>;
380
+ getFormState?: CustomAction_2.GetFormStateFunction<Config>;
381
+ }
382
+
383
+ /** @public */
384
+ declare namespace CustomerBalanceApplication {
385
+ /**
386
+ * The result of computing how much customer balance to apply to a bill.
387
+ * @public
388
+ */
389
+ interface CustomerBalanceApplicationResult {
390
+ /** The amount of customer balance to apply to this invoice. Positive values increase the invoice amount (applying a debit), negative values decrease it (applying a credit). Set to zero to apply no balance. */
391
+ appliedCustomerBalance: MonetaryAmount;
392
+ }
393
+ /**
394
+ * The bill details provided as input to the customer balance application extension.
395
+ * @public
396
+ */
397
+ interface CustomerBalanceApplicationInput {
398
+ /** The total amount of the invoice before applying any customer balance. */
399
+ totalAmount: MonetaryAmount;
400
+ /** The current customer balance available to apply. Positive values indicate debits (the customer owes money), negative values indicate credits. */
401
+ customerBalance: MonetaryAmount;
402
+ }
403
+ /**
404
+ * @public
405
+ * @deprecated Platform dispatch handles wire/SDK conversion.
406
+ */
407
+ function prepareArgsComputeAppliedCustomerBalance(proto: unknown): CustomerBalanceApplicationInput;
408
+ /**
409
+ * @public
410
+ * @deprecated Platform dispatch handles wire/SDK conversion.
411
+ */
412
+ function prepareResultComputeAppliedCustomerBalance(result: CustomerBalanceApplicationResult): CustomerBalanceApplicationResult;
413
+ /* Excluded from this release type: $platformWrapComputeAppliedCustomerBalance */
414
+ /**
415
+ * @public
416
+ * @deprecated Platform dispatch handles wire/SDK conversion.
417
+ */
418
+ const prepareArgs: typeof prepareArgsComputeAppliedCustomerBalance;
419
+ /**
420
+ * @public
421
+ * @deprecated Platform dispatch handles wire/SDK conversion.
422
+ */
423
+ const prepareResult: typeof prepareResultComputeAppliedCustomerBalance;
424
+ /**
425
+ * Determines how much of the customer's balance to apply toward a bill total. The script receives the invoice total and current customer balance, then returns how much of that balance to apply.
426
+ * @public
427
+ */
428
+ type ComputeAppliedCustomerBalanceFunction<Config> = (request: CustomerBalanceApplicationInput, config: Config, context: Context) => CustomerBalanceApplicationResult;
429
+ }
430
+
431
+ /**
432
+ * @example
433
+ * ```ts
434
+ * import type { Billing, Context } from '@stripe/extensibility-sdk';
435
+ *
436
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
437
+ * interface MyBalanceAppConfig {}
438
+ *
439
+ * export default class MyBalanceApp implements Billing.CustomerBalanceApplication<MyBalanceAppConfig> {
440
+ * computeAppliedCustomerBalance(
441
+ * request: Billing.CustomerBalanceApplication.CustomerBalanceApplicationInput,
442
+ * _config: MyBalanceAppConfig,
443
+ * _context: Context
444
+ * ) {
445
+ * // TODO: implement your customer balance logic here
446
+ *
447
+ * return {
448
+ * appliedCustomerBalance: request.customerBalance,
449
+ * };
450
+ * }
451
+ * }
452
+ *
453
+ * ```
454
+ * @public
455
+ */
456
+ declare interface CustomerBalanceApplication<Config> {
457
+ computeAppliedCustomerBalance: CustomerBalanceApplication.ComputeAppliedCustomerBalanceFunction<Config>;
458
+ }
459
+
64
460
  /**
65
461
  * Arbitrary-precision decimal type for billing calculations.
66
462
  *
@@ -293,8 +689,235 @@ export declare const DecimalRoundingPresets: Readonly<{
293
689
  */
294
690
  export declare const DEFAULT_DIV_PRECISION = 34;
295
691
 
692
+ /** @public */
693
+ declare namespace DiscountCalculation {
694
+ /** @public */
695
+ type BillingReason = 'automatic_pending_invoice_item_invoice' | 'manual' | 'quote_accept' | 'subscription_cancel' | 'subscription_create' | 'subscription_cycle' | 'subscription_threshold' | 'subscription_trial_ended' | 'subscription_update' | 'subscription' | 'upcoming';
696
+ /** @public */
697
+ type PricingTierMode = 'graduated' | 'volume';
698
+ /** @public */
699
+ type PriceType = 'one_time' | 'recurring';
700
+ /** @public */
701
+ type PricingScheme = 'per_unit' | 'tiered';
702
+ /** @public */
703
+ type UsageType = 'licensed' | 'metered';
704
+ /** @public */
705
+ type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
706
+ /**
707
+ * The result of a discount calculation.
708
+ * @public
709
+ */
710
+ interface DiscountResult {
711
+ /** The computed discount to apply. */
712
+ discount: Discount;
713
+ }
714
+ /**
715
+ * A discount to apply to a discountable item.
716
+ * @public
717
+ */
718
+ interface Discount {
719
+ /** The discount amount to subtract from the discountable item. */
720
+ amount: MonetaryAmount;
721
+ }
722
+ /**
723
+ * An item eligible for discount calculation, containing its line items and billing context.
724
+ * @public
725
+ */
726
+ interface DiscountableItem {
727
+ /** The individual line items that make up the discountable item. */
728
+ lineItems: DiscountableLineItem[];
729
+ /** The total gross amount of the discountable item before any discounts. */
730
+ grossAmount: MonetaryAmount;
731
+ /** The customer associated with the discountable item. */
732
+ customer?: Customer;
733
+ /** The reason this item is being billed. */
734
+ billingReason?: BillingReason;
735
+ /** The subscription associated with the discountable item. */
736
+ subscription?: Subscription;
737
+ }
738
+ /**
739
+ * The subscription associated with the discountable item.
740
+ * @public
741
+ */
742
+ interface Subscription {
743
+ /** The unique identifier of the subscription. */
744
+ id: string;
745
+ /** The Unix timestamp of the billing cycle anchor. */
746
+ billingCycleAnchor?: number;
747
+ /** The structured billing cycle anchor configuration. */
748
+ billingCycleAnchorConfig?: BillingCycleAnchorConfig;
749
+ /** Custom key-value pairs attached to the subscription. */
750
+ metadata: Record<string, string>;
751
+ }
752
+ /**
753
+ * Configuration for the billing cycle anchor, specifying when recurring billing periods start.
754
+ * @public
755
+ */
756
+ interface BillingCycleAnchorConfig {
757
+ /** The month component of the billing cycle anchor. */
758
+ month: number;
759
+ /** The day of the month for the billing cycle anchor. */
760
+ dayOfMonth: number;
761
+ /** The hour component of the billing cycle anchor. */
762
+ hour: number;
763
+ /** The minute component of the billing cycle anchor. */
764
+ minute: number;
765
+ /** The second component of the billing cycle anchor. */
766
+ second: number;
767
+ }
768
+ /**
769
+ * The customer associated with the discountable item.
770
+ * @public
771
+ */
772
+ interface Customer {
773
+ /** The unique identifier of the customer. */
774
+ id: string;
775
+ /** Custom key-value pairs attached to the customer. */
776
+ metadata: Record<string, string>;
777
+ }
778
+ /**
779
+ * A single line item within a discountable item.
780
+ * @public
781
+ */
782
+ interface DiscountableLineItem {
783
+ /** The subtotal amount of this line item. */
784
+ subtotal: MonetaryAmount;
785
+ /** The quantity of this line item. */
786
+ quantity?: Decimal;
787
+ /** The billing period this line item covers. */
788
+ period: AnyTimeRange;
789
+ /** The price information for this line item. */
790
+ price?: Price;
791
+ }
792
+ /**
793
+ * The price associated with a line item.
794
+ * @public
795
+ */
796
+ interface Price {
797
+ /** The unique identifier for the price. */
798
+ id: string;
799
+ /** The product this price belongs to. */
800
+ product?: Product;
801
+ /** The recurring pricing configuration, if applicable. */
802
+ recurring?: RecurringPrice;
803
+ /** The billing scheme, either per-unit or tiered. */
804
+ billingScheme?: PricingScheme;
805
+ /** The pricing tiers, applicable for tiered billing schemes. */
806
+ tiers: PriceTier[];
807
+ /** The price type, either one-time or recurring. */
808
+ type?: PriceType;
809
+ /** The tiering mode, either graduated or volume. */
810
+ tiersMode?: PricingTierMode;
811
+ /** Key-value metadata attached to the price. */
812
+ metadata: Record<string, string>;
813
+ /** The unit amount of the price. */
814
+ unitAmount?: Decimal;
815
+ }
816
+ /**
817
+ * A tier within a tiered pricing structure.
818
+ * @public
819
+ */
820
+ interface PriceTier {
821
+ /** The flat fee charged for this tier. */
822
+ flatAmount?: Decimal;
823
+ /** The per-unit price for this tier. */
824
+ unitAmount?: Decimal;
825
+ /** The upper bound of the tier range. */
826
+ upTo?: Decimal;
827
+ }
828
+ /**
829
+ * The recurring pricing configuration for a price.
830
+ * @public
831
+ */
832
+ interface RecurringPrice {
833
+ /** The billing interval for the recurring price. */
834
+ interval: RecurringPriceInterval;
835
+ /** The number of intervals between each billing cycle. */
836
+ intervalCount: number;
837
+ /** The usage type, either licensed or metered. */
838
+ usageType?: UsageType;
839
+ /** The identifier of the meter tracking usage for this price. */
840
+ meter?: string;
841
+ }
842
+ /**
843
+ * The product associated with a price.
844
+ * @public
845
+ */
846
+ interface Product {
847
+ /** The unique identifier of the product. */
848
+ id: string;
849
+ /** The name of the product. */
850
+ name: string;
851
+ /** Custom key-value pairs attached to the product. */
852
+ metadata: Record<string, string>;
853
+ }
854
+ /**
855
+ * @public
856
+ * @deprecated Platform dispatch handles wire/SDK conversion.
857
+ */
858
+ function prepareArgsComputeDiscounts(proto: unknown): DiscountableItem;
859
+ /**
860
+ * @public
861
+ * @deprecated Platform dispatch handles wire/SDK conversion.
862
+ */
863
+ function prepareResultComputeDiscounts(result: DiscountResult): DiscountResult;
864
+ /* Excluded from this release type: $platformWrapComputeDiscounts */
865
+ /**
866
+ * @public
867
+ * @deprecated Platform dispatch handles wire/SDK conversion.
868
+ */
869
+ const prepareArgs: typeof prepareArgsComputeDiscounts;
870
+ /**
871
+ * @public
872
+ * @deprecated Platform dispatch handles wire/SDK conversion.
873
+ */
874
+ const prepareResult: typeof prepareResultComputeDiscounts;
875
+ /**
876
+ * Computes discount amounts for a discountable item and returns a discount result.
877
+ * @public
878
+ */
879
+ type ComputeDiscountsFunction<Config> = (request: DiscountableItem, config: Config, context: Context) => DiscountResult;
880
+ }
881
+
882
+ /**
883
+ * @example
884
+ * ```ts
885
+ * import type { Billing, Context } from '@stripe/extensibility-sdk';
886
+ *
887
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
888
+ * interface MyDiscountCalculationConfig {}
889
+ *
890
+ * export default class MyDiscountCalculation implements Billing.Bill
891
+ * .DiscountCalculation<MyDiscountCalculationConfig> {
892
+ * computeDiscounts(
893
+ * request: Billing.Bill.DiscountCalculation.DiscountableItem,
894
+ * _config: MyDiscountCalculationConfig,
895
+ * _context: Context
896
+ * ) {
897
+ * // TODO: implement your discount logic here
898
+ *
899
+ * return {
900
+ * discount: { amount: request.grossAmount },
901
+ * };
902
+ * }
903
+ * }
904
+ *
905
+ * ```
906
+ * @public
907
+ */
908
+ declare interface DiscountCalculation<Config> {
909
+ computeDiscounts: DiscountCalculation.ComputeDiscountsFunction<Config>;
910
+ }
911
+
296
912
  /* Excluded from this release type: _EnumSpec */
297
913
 
914
+ declare namespace Extend {
915
+ export {
916
+ Workflows_2 as Workflows
917
+ }
918
+ }
919
+ export { Extend }
920
+
298
921
  /**
299
922
  * Extracts the string literal type of the `object` property from T.
300
923
  *
@@ -337,6 +960,117 @@ export declare const Integer: {
337
960
  */
338
961
  export declare type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
339
962
 
963
+ /** @public */
964
+ declare namespace InvoiceCollectionSetting {
965
+ /** @public */
966
+ type ParentType = 'billing_cadence' | 'contract' | 'quote' | 'standalone' | 'subscription_schedule' | 'subscription';
967
+ /** @public */
968
+ type PaymentMethodType = 'ach_credit_transfer' | 'ach_debit' | 'affirm' | 'afterpay_clearpay' | 'alipay' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' | 'boleto' | 'card' | 'cashapp' | 'eps' | 'fpx' | 'giropay' | 'grabpay' | 'ideal' | 'klarna' | 'konbini' | 'link' | 'multibanco' | 'oxxo' | 'p24' | 'paynow' | 'paypal' | 'promptpay' | 'sepa_credit_transfer' | 'sepa_debit' | 'sofort' | 'us_bank_account' | 'wechat_pay';
969
+ /** @public */
970
+ type CollectionMethod = 'charge_automatically' | 'send_invoice';
971
+ /**
972
+ * The result of the invoice collection settings override extension.
973
+ * @public
974
+ */
975
+ interface InvoiceCollectionResponse {
976
+ /** Override the auto-advancement setting. Set to false to keep the invoice in draft. Return null to use the default. */
977
+ autoAdvance?: boolean;
978
+ }
979
+ /** @public */
980
+ type InvoiceCollectionRequest = ({
981
+ customer: Customer;
982
+ payer: 'customer';
983
+ } | {
984
+ otherPayer: string;
985
+ payer: 'other';
986
+ }) & {
987
+ collectionSettings: CollectionSettings;
988
+ parent: Parent;
989
+ };
990
+ /** @public */
991
+ interface Customer {
992
+ id: string;
993
+ metadata: Record<string, string>;
994
+ }
995
+ /**
996
+ * The parent resource that triggered the invoice creation.
997
+ * @public
998
+ */
999
+ interface Parent {
1000
+ /** The type of parent resource (for example, subscription or contract). */
1001
+ type: ParentType;
1002
+ /** Custom key-value pairs attached to the parent resource. */
1003
+ metadata: Record<string, string>;
1004
+ }
1005
+ /**
1006
+ * The collection settings for an invoice.
1007
+ * @public
1008
+ */
1009
+ interface CollectionSettings {
1010
+ /** Whether the invoice automatically advances through its lifecycle. */
1011
+ autoAdvance: boolean;
1012
+ /** The payment collection method: charge_automatically or send_invoice. */
1013
+ collectionMethod: CollectionMethod;
1014
+ /** The delay before the invoice is finalized, in hours. */
1015
+ finalizationGracePeriod: number;
1016
+ /** The payment methods configured for this invoice. */
1017
+ paymentMethods: PaymentMethodType[];
1018
+ }
1019
+ /**
1020
+ * @public
1021
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1022
+ */
1023
+ function prepareArgsCollectionOverride(proto: unknown): InvoiceCollectionRequest;
1024
+ /**
1025
+ * @public
1026
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1027
+ */
1028
+ function prepareResultCollectionOverride(result: InvoiceCollectionResponse): InvoiceCollectionResponse;
1029
+ /* Excluded from this release type: $platformWrapCollectionOverride */
1030
+ /**
1031
+ * @public
1032
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1033
+ */
1034
+ const prepareArgs: typeof prepareArgsCollectionOverride;
1035
+ /**
1036
+ * @public
1037
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1038
+ */
1039
+ const prepareResult: typeof prepareResultCollectionOverride;
1040
+ /**
1041
+ * Overrides invoice collection settings before a draft invoice is created.
1042
+ * @public
1043
+ */
1044
+ type CollectionOverrideFunction<Config> = (request: InvoiceCollectionRequest, config: Config, context: Context) => InvoiceCollectionResponse;
1045
+ }
1046
+
1047
+ /**
1048
+ * @example
1049
+ * ```ts
1050
+ * import type { Billing, Context } from '@stripe/extensibility-sdk';
1051
+ *
1052
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1053
+ * interface MyInvoiceCollectionSettingConfig {}
1054
+ *
1055
+ * export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
1056
+ * collectionOverride(
1057
+ * _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
1058
+ * _config: MyInvoiceCollectionSettingConfig,
1059
+ * _context: Context
1060
+ * ) {
1061
+ * // TODO: implement your collection setting logic here
1062
+ *
1063
+ * return {};
1064
+ * }
1065
+ * }
1066
+ *
1067
+ * ```
1068
+ * @public
1069
+ */
1070
+ declare interface InvoiceCollectionSetting<Config> {
1071
+ collectionOverride: InvoiceCollectionSetting.CollectionOverrideFunction<Config>;
1072
+ }
1073
+
340
1074
  /**
341
1075
  * Check whether a value is a `Decimal` instance.
342
1076
  *
@@ -378,6 +1112,25 @@ export declare interface MonetaryAmount {
378
1112
 
379
1113
  /* Excluded from this release type: _OneofFieldDescriptor */
380
1114
 
1115
+ /**
1116
+ * Represents a one-time event occurring at a specific date.
1117
+ * @public
1118
+ */
1119
+ declare interface OneTime {
1120
+ /** The date and time of the event. */
1121
+ at: Date;
1122
+ }
1123
+
1124
+ /**
1125
+ * Represents a percentage number value (0-100).
1126
+ * @format percent
1127
+ * @public
1128
+ */
1129
+ export declare interface Percent {
1130
+ /** The percentage value. */
1131
+ value: number;
1132
+ }
1133
+
381
1134
  /**
382
1135
  * A branded non-negative integer — a `number` guaranteed to be an integer ≥ 0.
383
1136
  *
@@ -407,12 +1160,525 @@ export declare const PositiveInteger: {
407
1160
  is: (value: number) => value is PositiveInteger;
408
1161
  };
409
1162
 
1163
+ /** @public */
1164
+ declare namespace Prorations {
1165
+ /** @public */
1166
+ type PricingTierMode = 'graduated' | 'volume';
1167
+ /** @public */
1168
+ type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
1169
+ /** @public */
1170
+ type PriceType = 'one_time' | 'recurring';
1171
+ /** @public */
1172
+ type PricingScheme = 'per_unit' | 'tiered';
1173
+ /** @public */
1174
+ type UsageType = 'licensed' | 'metered';
1175
+ /** @public */
1176
+ type ItemType = 'credit' | 'debit';
1177
+ /**
1178
+ * The result of the prorations extension.
1179
+ * @public
1180
+ */
1181
+ interface ProrateItemsResult {
1182
+ /** The items with computed proration factors. */
1183
+ items: ItemWithProration[];
1184
+ }
1185
+ /**
1186
+ * An item with a computed proration factor.
1187
+ * @public
1188
+ */
1189
+ interface ItemWithProration {
1190
+ /** The unique identifier of the item, matching a key from the input. */
1191
+ key: string;
1192
+ /** The computed proration factor. Positive for charges, negative for credits. */
1193
+ prorationFactor: Decimal;
1194
+ /** The displayed period for the invoice line item. */
1195
+ lineItemPeriod: TimeRange;
1196
+ }
1197
+ /**
1198
+ * The input to the prorations extension.
1199
+ * @public
1200
+ */
1201
+ interface ProrateItemsInput {
1202
+ /** The list of items that can have their proration factor and line item period modified. */
1203
+ items: ProratableItem[];
1204
+ }
1205
+ /** @public */
1206
+ type ProratableItem = ({
1207
+ customPricingUnitOverageRate: CustomPricingUnitOverageRate;
1208
+ priceKind: 'customPricingUnitOverageRate';
1209
+ } | {
1210
+ licenseFee: LicenseFee;
1211
+ priceKind: 'licenseFee';
1212
+ } | {
1213
+ otherPriceKind: string;
1214
+ priceKind: 'other';
1215
+ } | {
1216
+ price: Price;
1217
+ priceKind: 'price';
1218
+ } | {
1219
+ priceKind: 'rateCardRate';
1220
+ rateCardRate: RateCardRate;
1221
+ }) & {
1222
+ correspondingDebit?: PreviousDebit;
1223
+ currentProrationFactor: Decimal;
1224
+ isProration: boolean;
1225
+ key: string;
1226
+ priceIntervalDuration: number;
1227
+ servicePeriod: TimeRange;
1228
+ type: ItemType;
1229
+ };
1230
+ /**
1231
+ * Information about a previous debit that a credit item offsets.
1232
+ * @public
1233
+ */
1234
+ interface PreviousDebit {
1235
+ /** The service period of the corresponding debit. */
1236
+ servicePeriod: TimeRange;
1237
+ }
1238
+ /** @public */
1239
+ interface CustomPricingUnitOverageRate {
1240
+ id: string;
1241
+ metadata: Record<string, string>;
1242
+ rateCard: RateCard;
1243
+ customPricingUnit: string;
1244
+ unitAmount: Decimal;
1245
+ }
1246
+ /** @public */
1247
+ interface RateCard {
1248
+ id: string;
1249
+ currency: Currency;
1250
+ }
1251
+ /** @public */
1252
+ interface RateCardRate {
1253
+ id: string;
1254
+ metadata: Record<string, string>;
1255
+ rateCard: RateCard;
1256
+ tieringMode?: PricingTierMode;
1257
+ tiers: RateCardRateTier[];
1258
+ unitAmount?: Decimal;
1259
+ }
1260
+ /** @public */
1261
+ interface RateCardRateTier {
1262
+ flatAmount?: Decimal;
1263
+ unitAmount?: Decimal;
1264
+ upTo?: Decimal;
1265
+ }
1266
+ /** @public */
1267
+ interface LicenseFee {
1268
+ id: string;
1269
+ lookupKey?: string;
1270
+ metadata: Record<string, string>;
1271
+ serviceInterval: RecurringPriceInterval;
1272
+ serviceIntervalCount: number;
1273
+ tieringMode?: PricingTierMode;
1274
+ tiers: LicenseFeeTier[];
1275
+ currency: Currency;
1276
+ unitAmount?: Decimal;
1277
+ }
1278
+ /** @public */
1279
+ interface LicenseFeeTier {
1280
+ flatAmount?: Decimal;
1281
+ unitAmount?: Decimal;
1282
+ upTo?: Decimal;
1283
+ }
1284
+ /** @public */
1285
+ interface Price {
1286
+ id: string;
1287
+ product: Product;
1288
+ recurring?: RecurringPrice;
1289
+ billingScheme: PricingScheme;
1290
+ tiers: PriceTier[];
1291
+ type: PriceType;
1292
+ tiersMode?: PricingTierMode;
1293
+ metadata: Record<string, string>;
1294
+ currency: Currency;
1295
+ unitAmount?: Decimal;
1296
+ }
1297
+ /** @public */
1298
+ interface PriceTier {
1299
+ flatAmount?: Decimal;
1300
+ unitAmount?: Decimal;
1301
+ upTo?: number;
1302
+ }
1303
+ /** @public */
1304
+ interface RecurringPrice {
1305
+ interval: RecurringPriceInterval;
1306
+ intervalCount: number;
1307
+ usageType?: UsageType;
1308
+ meter?: string;
1309
+ }
1310
+ /** @public */
1311
+ interface Product {
1312
+ id: string;
1313
+ name: string;
1314
+ metadata: Record<string, string>;
1315
+ }
1316
+ /**
1317
+ * @public
1318
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1319
+ */
1320
+ function prepareArgsProrateItems(proto: unknown): ProrateItemsInput;
1321
+ /**
1322
+ * @public
1323
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1324
+ */
1325
+ function prepareResultProrateItems(result: ProrateItemsResult): ProrateItemsResult;
1326
+ /* Excluded from this release type: $platformWrapProrateItems */
1327
+ /**
1328
+ * @public
1329
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1330
+ */
1331
+ const prepareArgs: typeof prepareArgsProrateItems;
1332
+ /**
1333
+ * @public
1334
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1335
+ */
1336
+ const prepareResult: typeof prepareResultProrateItems;
1337
+ /**
1338
+ * Calculates prorated amounts for subscription items when changes occur mid-billing period. The script receives the invoice items, then returns computed proration factors for each item.
1339
+ * @public
1340
+ */
1341
+ type ProrateItemsFunction<Config> = (request: ProrateItemsInput, config: Config, context: Context) => ProrateItemsResult;
1342
+ }
1343
+
1344
+ /**
1345
+ * @example
1346
+ * ```ts
1347
+ * import type { Billing, Context } from '@stripe/extensibility-sdk';
1348
+ *
1349
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1350
+ * interface MyProrationsConfig {}
1351
+ *
1352
+ * export default class MyProrations implements Billing.Prorations<MyProrationsConfig> {
1353
+ * prorateItems(
1354
+ * _request: Billing.Prorations.ProrateItemsInput,
1355
+ * _config: MyProrationsConfig,
1356
+ * _context: Context
1357
+ * ) {
1358
+ * // TODO: implement your proration logic here
1359
+ *
1360
+ * return {
1361
+ * items: [],
1362
+ * };
1363
+ * }
1364
+ * }
1365
+ *
1366
+ * ```
1367
+ * @public
1368
+ */
1369
+ declare interface Prorations<Config> {
1370
+ prorateItems: Prorations.ProrateItemsFunction<Config>;
1371
+ }
1372
+
410
1373
  /* Excluded from this release type: _ProtoEnum */
411
1374
 
412
1375
  /* Excluded from this release type: _ProtoWireToType */
413
1376
 
414
1377
  /* Excluded from this release type: _ProtoWireToTypeStrategy */
415
1378
 
1379
+ /** @public */
1380
+ declare namespace RecurringBillingItemHandling {
1381
+ /** @public */
1382
+ type PricingTierMode = 'graduated' | 'volume';
1383
+ /** @public */
1384
+ type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
1385
+ /** @public */
1386
+ type PriceType = 'one_time' | 'recurring';
1387
+ /** @public */
1388
+ type PricingScheme = 'per_unit' | 'tiered';
1389
+ /** @public */
1390
+ type UsageType = 'licensed' | 'metered';
1391
+ /** @public */
1392
+ type ItemType = 'credit' | 'debit';
1393
+ /**
1394
+ * The result of the group items extension.
1395
+ * @public
1396
+ */
1397
+ interface GroupItemsResult {
1398
+ /** The groups of items, each corresponding to a separate invoice. */
1399
+ groups: ItemGroup[];
1400
+ }
1401
+ /**
1402
+ * A group of items to place on a single invoice.
1403
+ * @public
1404
+ */
1405
+ interface ItemGroup {
1406
+ /** The items in this group. */
1407
+ items: GroupedItem[];
1408
+ /** Whether this group sets the latest invoice reference on the subscription. */
1409
+ setsLatestInvoice: boolean;
1410
+ }
1411
+ /**
1412
+ * An item assigned to a group.
1413
+ * @public
1414
+ */
1415
+ interface GroupedItem {
1416
+ /** The unique identifier of the item, matching a key from the input. */
1417
+ key: string;
1418
+ }
1419
+ /**
1420
+ * The input to the group items extension.
1421
+ * @public
1422
+ */
1423
+ interface GroupItemsInput {
1424
+ /** The list of items to group across invoices. */
1425
+ items: Item[];
1426
+ }
1427
+ /** @public */
1428
+ type Item = ({
1429
+ customPricingUnitOverageRate: CustomPricingUnitOverageRate;
1430
+ priceKind: 'customPricingUnitOverageRate';
1431
+ } | {
1432
+ licenseFee: LicenseFee;
1433
+ priceKind: 'licenseFee';
1434
+ } | {
1435
+ otherPriceKind: string;
1436
+ priceKind: 'other';
1437
+ } | {
1438
+ price: Price;
1439
+ priceKind: 'price';
1440
+ } | {
1441
+ priceKind: 'rateCardRate';
1442
+ rateCardRate: RateCardRate;
1443
+ }) & {
1444
+ isProration: boolean;
1445
+ key: string;
1446
+ prorationFactor: Decimal;
1447
+ servicePeriod: AnyTimeRange;
1448
+ type: ItemType;
1449
+ };
1450
+ /** @public */
1451
+ interface CustomPricingUnitOverageRate {
1452
+ id: string;
1453
+ metadata: Record<string, string>;
1454
+ rateCard: RateCard;
1455
+ customPricingUnit: string;
1456
+ unitAmount: Decimal;
1457
+ }
1458
+ /** @public */
1459
+ interface RateCard {
1460
+ id: string;
1461
+ currency: Currency;
1462
+ }
1463
+ /** @public */
1464
+ interface RateCardRate {
1465
+ id: string;
1466
+ metadata: Record<string, string>;
1467
+ rateCard: RateCard;
1468
+ tieringMode?: PricingTierMode;
1469
+ tiers: RateCardRateTier[];
1470
+ unitAmount?: Decimal;
1471
+ }
1472
+ /** @public */
1473
+ interface RateCardRateTier {
1474
+ flatAmount?: Decimal;
1475
+ unitAmount?: Decimal;
1476
+ upTo?: Decimal;
1477
+ }
1478
+ /** @public */
1479
+ interface LicenseFee {
1480
+ id: string;
1481
+ lookupKey?: string;
1482
+ metadata: Record<string, string>;
1483
+ serviceInterval: RecurringPriceInterval;
1484
+ serviceIntervalCount: number;
1485
+ tieringMode?: PricingTierMode;
1486
+ tiers: LicenseFeeTier[];
1487
+ currency: Currency;
1488
+ unitAmount?: Decimal;
1489
+ }
1490
+ /** @public */
1491
+ interface LicenseFeeTier {
1492
+ flatAmount?: Decimal;
1493
+ unitAmount?: Decimal;
1494
+ upTo?: Decimal;
1495
+ }
1496
+ /** @public */
1497
+ interface Price {
1498
+ id: string;
1499
+ product: Product;
1500
+ recurring?: RecurringPrice;
1501
+ billingScheme: PricingScheme;
1502
+ tiers: PriceTier[];
1503
+ type: PriceType;
1504
+ tiersMode?: PricingTierMode;
1505
+ metadata: Record<string, string>;
1506
+ currency: Currency;
1507
+ unitAmount?: Decimal;
1508
+ }
1509
+ /** @public */
1510
+ interface PriceTier {
1511
+ flatAmount?: Decimal;
1512
+ unitAmount?: Decimal;
1513
+ upTo?: number;
1514
+ }
1515
+ /** @public */
1516
+ interface RecurringPrice {
1517
+ interval: RecurringPriceInterval;
1518
+ intervalCount: number;
1519
+ usageType?: UsageType;
1520
+ meter?: string;
1521
+ }
1522
+ /** @public */
1523
+ interface Product {
1524
+ id: string;
1525
+ name: string;
1526
+ metadata: Record<string, string>;
1527
+ }
1528
+ /**
1529
+ * The result of the filter items extension.
1530
+ * @public
1531
+ */
1532
+ interface FilterItemsResult {
1533
+ /** The items to include on the invoice. */
1534
+ items: ItemToInvoice[];
1535
+ }
1536
+ /**
1537
+ * An item selected for inclusion on the invoice.
1538
+ * @public
1539
+ */
1540
+ interface ItemToInvoice {
1541
+ /** The unique identifier of the item, matching a key from the input. */
1542
+ key: string;
1543
+ }
1544
+ /**
1545
+ * The input to the filter items extension.
1546
+ * @public
1547
+ */
1548
+ interface FilterItemsInput {
1549
+ /** The list of items to evaluate for inclusion on the invoice. */
1550
+ items: Item[];
1551
+ }
1552
+ /**
1553
+ * The result of the before item creation extension.
1554
+ * @public
1555
+ */
1556
+ interface BeforeItemCreationResult {
1557
+ /** The items with their creation strategies. */
1558
+ items: ItemWithCreationStrategy[];
1559
+ }
1560
+ /** @public */
1561
+ type ItemWithCreationStrategy = ({
1562
+ creationStrategy: 'other';
1563
+ otherCreationStrategy: string;
1564
+ } | { creationStrategy: 'doNotCreate' } | { creationStrategy: 'invoice' }) & { key: string };
1565
+ /** @public */
1566
+ type Invoice = Record<string, never>;
1567
+ /** @public */
1568
+ type DoNotCreate = Record<string, never>;
1569
+ /**
1570
+ * The input to the before item creation extension.
1571
+ * @public
1572
+ */
1573
+ interface BeforeItemCreationInput {
1574
+ /** The list of items to evaluate for creation. */
1575
+ items: Item[];
1576
+ }
1577
+ /**
1578
+ * @public
1579
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1580
+ */
1581
+ function prepareArgsBeforeItemCreation(proto: unknown): BeforeItemCreationInput;
1582
+ /**
1583
+ * @public
1584
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1585
+ */
1586
+ function prepareResultBeforeItemCreation(result: BeforeItemCreationResult): BeforeItemCreationResult;
1587
+ /* Excluded from this release type: $platformWrapBeforeItemCreation */
1588
+ /**
1589
+ * @public
1590
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1591
+ */
1592
+ function prepareArgsFilterItems(proto: unknown): FilterItemsInput;
1593
+ /**
1594
+ * @public
1595
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1596
+ */
1597
+ function prepareResultFilterItems(result: FilterItemsResult): FilterItemsResult;
1598
+ /* Excluded from this release type: $platformWrapFilterItems */
1599
+ /**
1600
+ * @public
1601
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1602
+ */
1603
+ function prepareArgsGroupItems(proto: unknown): GroupItemsInput;
1604
+ /**
1605
+ * @public
1606
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1607
+ */
1608
+ function prepareResultGroupItems(result: GroupItemsResult): GroupItemsResult;
1609
+ /* Excluded from this release type: $platformWrapGroupItems */
1610
+ /**
1611
+ * Runs before invoice items are created. Decides whether each item should be created or skipped.
1612
+ * @public
1613
+ */
1614
+ type BeforeItemCreationFunction<Config> = (request: BeforeItemCreationInput, config: Config, context: Context) => BeforeItemCreationResult;
1615
+ /**
1616
+ * Runs before invoices are created. Decides which items to include on the invoice. Items not included are deferred as pending invoice items.
1617
+ * @public
1618
+ */
1619
+ type FilterItemsFunction<Config> = (request: FilterItemsInput, config: Config, context: Context) => FilterItemsResult;
1620
+ /**
1621
+ * Runs before invoices are created. Decides how items are grouped across one or more invoices.
1622
+ * @public
1623
+ */
1624
+ type GroupItemsFunction<Config> = (request: GroupItemsInput, config: Config, context: Context) => GroupItemsResult;
1625
+ }
1626
+
1627
+ /**
1628
+ * @example
1629
+ * ```ts
1630
+ * import type { Billing, Context } from '@stripe/extensibility-sdk';
1631
+ *
1632
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1633
+ * interface MyRecurringBillingItemHandlingConfig {}
1634
+ *
1635
+ * export default class MyRecurringBillingItemHandling implements Billing.RecurringBillingItemHandling<MyRecurringBillingItemHandlingConfig> {
1636
+ * beforeItemCreation(
1637
+ * _request: Billing.RecurringBillingItemHandling.BeforeItemCreationInput,
1638
+ * _config: MyRecurringBillingItemHandlingConfig,
1639
+ * _context: Context
1640
+ * ) {
1641
+ * // TODO: implement your before-item-creation logic here
1642
+ *
1643
+ * return {
1644
+ * items: [],
1645
+ * };
1646
+ * }
1647
+ *
1648
+ * filterItems(
1649
+ * _request: Billing.RecurringBillingItemHandling.FilterItemsInput,
1650
+ * _config: MyRecurringBillingItemHandlingConfig,
1651
+ * _context: Context
1652
+ * ) {
1653
+ * // TODO: implement your filter-items logic here
1654
+ *
1655
+ * return {
1656
+ * items: [],
1657
+ * };
1658
+ * }
1659
+ *
1660
+ * groupItems(
1661
+ * _request: Billing.RecurringBillingItemHandling.GroupItemsInput,
1662
+ * _config: MyRecurringBillingItemHandlingConfig,
1663
+ * _context: Context
1664
+ * ) {
1665
+ * // TODO: implement your group-items logic here
1666
+ *
1667
+ * return {
1668
+ * groups: [],
1669
+ * };
1670
+ * }
1671
+ * }
1672
+ *
1673
+ * ```
1674
+ * @public
1675
+ */
1676
+ declare interface RecurringBillingItemHandling<Config> {
1677
+ beforeItemCreation: RecurringBillingItemHandling.BeforeItemCreationFunction<Config>;
1678
+ filterItems: RecurringBillingItemHandling.FilterItemsFunction<Config>;
1679
+ groupItems: RecurringBillingItemHandling.GroupItemsFunction<Config>;
1680
+ }
1681
+
416
1682
  /**
417
1683
  * Object reference — a typed pointer to another API resource.
418
1684
  *
@@ -482,6 +1748,17 @@ export declare const StreetAddress: { create: (address: string) => StreetAddress
482
1748
  /** The type of the opaque Stripe type-tag symbol used in SDK scalar types. @public */
483
1749
  export declare type StripeTypeSymbol = typeof __stripeType;
484
1750
 
1751
+ /**
1752
+ * Represents a time period with start and end dates.
1753
+ * @public
1754
+ */
1755
+ declare interface TimeRange {
1756
+ /** The beginning date of the range. */
1757
+ startDate: Date;
1758
+ /** The ending date of the range. */
1759
+ endDate: Date;
1760
+ }
1761
+
485
1762
  /** A branded string representing an ISO 8601 datetime. @public */
486
1763
  export declare type Timestamp = {
487
1764
  readonly [__brand]: 'Timestamp';
@@ -539,4 +1816,16 @@ export declare class WireWriteError extends Error {
539
1816
  /* Excluded from this release type: name */
540
1817
  }
541
1818
 
1819
+ declare namespace Workflows {
1820
+ export {
1821
+ CustomAction
1822
+ }
1823
+ }
1824
+
1825
+ declare namespace Workflows_2 {
1826
+ export {
1827
+ CustomAction_2 as CustomAction
1828
+ }
1829
+ }
1830
+
542
1831
  export { }