@stripe/extensibility-sdk 0.22.4

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 (113) hide show
  1. package/LICENSE.md +19 -0
  2. package/dist/config-values/generate.cjs +262 -0
  3. package/dist/config-values/generate.d.ts +38 -0
  4. package/dist/config-values/generate.d.ts.map +1 -0
  5. package/dist/config-values/generate.js +232 -0
  6. package/dist/config-values/parse.d.ts +87 -0
  7. package/dist/config-values/parse.d.ts.map +1 -0
  8. package/dist/extensibility-sdk-alpha.d.ts +542 -0
  9. package/dist/extensibility-sdk-beta.d.ts +542 -0
  10. package/dist/extensibility-sdk-config-values-alpha.d.ts +27 -0
  11. package/dist/extensibility-sdk-config-values-beta.d.ts +27 -0
  12. package/dist/extensibility-sdk-config-values-internal.d.ts +118 -0
  13. package/dist/extensibility-sdk-config-values-public.d.ts +27 -0
  14. package/dist/extensibility-sdk-extensions-alpha.d.ts +1592 -0
  15. package/dist/extensibility-sdk-extensions-beta.d.ts +1592 -0
  16. package/dist/extensibility-sdk-extensions-internal.d.ts +1655 -0
  17. package/dist/extensibility-sdk-extensions-public.d.ts +1592 -0
  18. package/dist/extensibility-sdk-internal-alpha.d.ts +9 -0
  19. package/dist/extensibility-sdk-internal-beta.d.ts +9 -0
  20. package/dist/extensibility-sdk-internal-internal.d.ts +23 -0
  21. package/dist/extensibility-sdk-internal-public.d.ts +9 -0
  22. package/dist/extensibility-sdk-internal.d.ts +915 -0
  23. package/dist/extensibility-sdk-jsonschema-alpha.d.ts +3 -0
  24. package/dist/extensibility-sdk-jsonschema-beta.d.ts +3 -0
  25. package/dist/extensibility-sdk-jsonschema-internal.d.ts +15 -0
  26. package/dist/extensibility-sdk-jsonschema-public.d.ts +3 -0
  27. package/dist/extensibility-sdk-public.d.ts +542 -0
  28. package/dist/extensibility-sdk-stdlib-alpha.d.ts +531 -0
  29. package/dist/extensibility-sdk-stdlib-beta.d.ts +531 -0
  30. package/dist/extensibility-sdk-stdlib-internal.d.ts +904 -0
  31. package/dist/extensibility-sdk-stdlib-public.d.ts +531 -0
  32. package/dist/extensions/billing/bill/discount_calculation.d.ts +226 -0
  33. package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -0
  34. package/dist/extensions/billing/bill/index.d.ts +2 -0
  35. package/dist/extensions/billing/bill/index.d.ts.map +1 -0
  36. package/dist/extensions/billing/customer_balance_application.d.ts +82 -0
  37. package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -0
  38. package/dist/extensions/billing/index.d.ts +8 -0
  39. package/dist/extensions/billing/index.d.ts.map +1 -0
  40. package/dist/extensions/billing/invoice_collection_setting.d.ts +117 -0
  41. package/dist/extensions/billing/invoice_collection_setting.d.ts.map +1 -0
  42. package/dist/extensions/billing/prorations.d.ts +222 -0
  43. package/dist/extensions/billing/prorations.d.ts.map +1 -0
  44. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +326 -0
  45. package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -0
  46. package/dist/extensions/billing/types.d.ts +33 -0
  47. package/dist/extensions/billing/types.d.ts.map +1 -0
  48. package/dist/extensions/context.d.ts +9 -0
  49. package/dist/extensions/context.d.ts.map +1 -0
  50. package/dist/extensions/core/index.d.ts +3 -0
  51. package/dist/extensions/core/index.d.ts.map +1 -0
  52. package/dist/extensions/core/workflows/custom_action.d.ts +142 -0
  53. package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -0
  54. package/dist/extensions/core/workflows/index.d.ts +2 -0
  55. package/dist/extensions/core/workflows/index.d.ts.map +1 -0
  56. package/dist/extensions/extend/index.d.ts +3 -0
  57. package/dist/extensions/extend/index.d.ts.map +1 -0
  58. package/dist/extensions/extend/workflows/custom_action.d.ts +142 -0
  59. package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -0
  60. package/dist/extensions/extend/workflows/index.d.ts +2 -0
  61. package/dist/extensions/extend/workflows/index.d.ts.map +1 -0
  62. package/dist/extensions/index.cjs +2356 -0
  63. package/dist/extensions/index.d.ts +9 -0
  64. package/dist/extensions/index.d.ts.map +1 -0
  65. package/dist/extensions/index.js +2435 -0
  66. package/dist/extensions/registry.d.ts +19 -0
  67. package/dist/extensions/registry.d.ts.map +1 -0
  68. package/dist/extensions/types.d.ts +10 -0
  69. package/dist/extensions/types.d.ts.map +1 -0
  70. package/dist/index.cjs +1519 -0
  71. package/dist/index.d.ts +12 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +1460 -0
  74. package/dist/internal.cjs +156 -0
  75. package/dist/internal.d.ts +3 -0
  76. package/dist/internal.d.ts.map +1 -0
  77. package/dist/internal.js +128 -0
  78. package/dist/jsonschema.cjs +18 -0
  79. package/dist/jsonschema.d.ts +2 -0
  80. package/dist/jsonschema.d.ts.map +1 -0
  81. package/dist/jsonschema.js +0 -0
  82. package/dist/stdlib/brand.d.ts +27 -0
  83. package/dist/stdlib/brand.d.ts.map +1 -0
  84. package/dist/stdlib/decimal.d.ts +324 -0
  85. package/dist/stdlib/decimal.d.ts.map +1 -0
  86. package/dist/stdlib/extension-method.d.ts +27 -0
  87. package/dist/stdlib/extension-method.d.ts.map +1 -0
  88. package/dist/stdlib/generated.d.ts +15 -0
  89. package/dist/stdlib/generated.d.ts.map +1 -0
  90. package/dist/stdlib/index.cjs +1519 -0
  91. package/dist/stdlib/index.d.ts +18 -0
  92. package/dist/stdlib/index.d.ts.map +1 -0
  93. package/dist/stdlib/index.js +1460 -0
  94. package/dist/stdlib/refs.d.ts +62 -0
  95. package/dist/stdlib/refs.d.ts.map +1 -0
  96. package/dist/stdlib/scalars.d.ts +141 -0
  97. package/dist/stdlib/scalars.d.ts.map +1 -0
  98. package/dist/stdlib/transform-strategies.d.ts +74 -0
  99. package/dist/stdlib/transform-strategies.d.ts.map +1 -0
  100. package/dist/stdlib/transforms.d.ts +97 -0
  101. package/dist/stdlib/transforms.d.ts.map +1 -0
  102. package/dist/stdlib/type-utils.d.ts +9 -0
  103. package/dist/stdlib/type-utils.d.ts.map +1 -0
  104. package/dist/stdlib/types.d.ts +281 -0
  105. package/dist/stdlib/types.d.ts.map +1 -0
  106. package/dist/stdlib/utils.d.ts +7 -0
  107. package/dist/stdlib/utils.d.ts.map +1 -0
  108. package/dist/tsconfig.build.tsbuildinfo +1 -0
  109. package/package.json +111 -0
  110. package/tslibs/5.9.3/lib.es2022.egress.d.ts +4328 -0
  111. package/tslibs/5.9.3/lib.es2022.restricted.d.ts +4067 -0
  112. package/tslibs/lib.egress.globals.d.ts +112 -0
  113. package/tslibs/lib.restricted.globals.d.ts +1 -0
@@ -0,0 +1,1592 @@
1
+ /**
2
+ * Opaque brand symbol used as a property key in SDK branded types.
3
+ *
4
+ * @remarks
5
+ * You do not need to use this directly — it is already embedded in
6
+ * branded values returned by factory functions like {@link (Integer:type)}.create().
7
+ * The `unique symbol` key makes the brand non-enumerable and impossible
8
+ * to forge without access to this symbol.
9
+ *
10
+ * @public
11
+ */
12
+ declare const __brand: unique symbol;
13
+
14
+ /* Excluded from this release type: __decimalBrand */
15
+
16
+ /**
17
+ * Opaque type-tag symbol used by SDK scalar types to carry Stripe type metadata.
18
+ *
19
+ * @remarks
20
+ * You do not need to use this directly — it is already embedded in
21
+ * branded values returned by factory functions like {@link (Integer:type)}.create().
22
+ *
23
+ * @public
24
+ */
25
+ declare const __stripeType: unique symbol;
26
+
27
+ /** @public */
28
+ declare type AnyTimeRange = {
29
+ value: 'oneTime';
30
+ at: Date;
31
+ } | {
32
+ value: 'timeRange';
33
+ startDate: Date;
34
+ endDate: Date;
35
+ } | {
36
+ value: 'other';
37
+ otherValue: string;
38
+ };
39
+
40
+ declare namespace Bill {
41
+ export {
42
+ DiscountCalculation
43
+ }
44
+ }
45
+
46
+ declare namespace Billing {
47
+ export {
48
+ CustomerBalanceApplication,
49
+ InvoiceCollectionSetting,
50
+ Prorations,
51
+ RecurringBillingItemHandling,
52
+ Bill,
53
+ OneTime,
54
+ TimeRange,
55
+ AnyTimeRange,
56
+ Currency,
57
+ MonetaryAmount
58
+ }
59
+ }
60
+ export { Billing }
61
+
62
+ /* Excluded from this release type: _ConfigApplicationContext */
63
+
64
+ /** @public */
65
+ export declare interface Context {
66
+ type: string;
67
+ id: string;
68
+ livemode: boolean;
69
+ stripeContext?: string;
70
+ clockTime?: string;
71
+ }
72
+
73
+ declare namespace Core {
74
+ export {
75
+ Workflows
76
+ }
77
+ }
78
+ export { Core }
79
+
80
+ /** @public */
81
+ 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';
82
+
83
+ /** @public */
84
+ declare namespace CustomAction {
85
+ /**
86
+ * Response payload for GetFormState.
87
+ * @public
88
+ */
89
+ interface GetFormStateResponse {
90
+ /** 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. */
91
+ values: Record<string, unknown>;
92
+ /** Per-field configuration keyed by field name. */
93
+ config: Record<string, FormStateFieldConfig>;
94
+ }
95
+ /**
96
+ * Configuration for a single form field, returned by GetFormState.
97
+ * @public
98
+ */
99
+ interface FormStateFieldConfig {
100
+ /** Dropdown options for `dynamic_select` fields. */
101
+ options: SelectOption[];
102
+ /** 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. */
103
+ schema: Record<string, unknown>;
104
+ /** Whether the field is disabled (non-interactive). */
105
+ disabled?: boolean;
106
+ /** Whether the field is hidden from the form. */
107
+ hidden?: boolean;
108
+ /** Warning message displayed on the field. You can still save the workflow. */
109
+ warning?: string;
110
+ /** Error message displayed on the field. Blocks saving the workflow. */
111
+ error?: string;
112
+ }
113
+ /**
114
+ * An option in a dynamic_select dropdown.
115
+ * @public
116
+ */
117
+ interface SelectOption {
118
+ value: string;
119
+ label: string;
120
+ }
121
+ /**
122
+ * Request payload for GetFormState, sent at configuration time.
123
+ * @public
124
+ */
125
+ interface GetFormStateRequest {
126
+ /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
127
+ values: Record<string, unknown>;
128
+ /** 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. */
129
+ changedField?: string;
130
+ }
131
+ /** @public */
132
+ type ExecuteCustomActionResponse = Record<string, never>;
133
+ /**
134
+ * **************************************************************************** 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.
135
+ * @public
136
+ */
137
+ interface ExecuteCustomActionRequest {
138
+ /** 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. */
139
+ customInput: Record<string, unknown>;
140
+ }
141
+ /**
142
+ * @public
143
+ * @deprecated Platform dispatch handles wire/SDK conversion.
144
+ */
145
+ function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
146
+ /**
147
+ * @public
148
+ * @deprecated Platform dispatch handles wire/SDK conversion.
149
+ */
150
+ function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
151
+ /* Excluded from this release type: $platformWrapExecute */
152
+ /**
153
+ * @public
154
+ * @deprecated Platform dispatch handles wire/SDK conversion.
155
+ */
156
+ function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
157
+ /**
158
+ * @public
159
+ * @deprecated Platform dispatch handles wire/SDK conversion.
160
+ */
161
+ function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
162
+ /* Excluded from this release type: $platformWrapGetFormState */
163
+ /**
164
+ * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
165
+ * @public
166
+ */
167
+ type ExecuteFunction<Config extends Record<string, unknown>> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
168
+ /**
169
+ * 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.
170
+ * @public
171
+ */
172
+ type GetFormStateFunction<Config extends Record<string, unknown>> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
173
+ }
174
+
175
+ /**
176
+ * @example
177
+ * ```ts
178
+ * import type { Core } from '@stripe/extensibility-sdk/extensions';
179
+ * import type { Context } from '@stripe/extensibility-sdk/extensions';
180
+ *
181
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
182
+ * interface MyCustomActionConfig extends Record<string, unknown> {}
183
+ *
184
+ * export default class MyCustomAction implements Core.Workflows
185
+ * .CustomAction<MyCustomActionConfig> {
186
+ * execute(
187
+ * _request: Core.Workflows.CustomAction.ExecuteCustomActionRequest,
188
+ * _config: MyCustomActionConfig,
189
+ * _context: Context
190
+ * ) {
191
+ * // TODO: implement your action logic here
192
+ *
193
+ * return {};
194
+ * }
195
+ *
196
+ * getFormState(
197
+ * _request: Core.Workflows.CustomAction.GetFormStateRequest,
198
+ * _config: MyCustomActionConfig,
199
+ * _context: Context
200
+ * ) {
201
+ * // TODO: implement your logic here
202
+ *
203
+ * return {
204
+ * values: {},
205
+ * config: {},
206
+ * };
207
+ * }
208
+ * }
209
+ *
210
+ * ```
211
+ * @public
212
+ */
213
+ declare interface CustomAction<Config extends Record<string, unknown>> {
214
+ execute: CustomAction.ExecuteFunction<Config>;
215
+ getFormState?: CustomAction.GetFormStateFunction<Config>;
216
+ }
217
+
218
+ /** @public */
219
+ declare namespace CustomAction_2 {
220
+ /**
221
+ * Response payload for GetFormState.
222
+ * @public
223
+ */
224
+ interface GetFormStateResponse {
225
+ /** 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. */
226
+ values: Record<string, unknown>;
227
+ /** Per-field configuration keyed by field name. */
228
+ config: Record<string, FormStateFieldConfig>;
229
+ }
230
+ /**
231
+ * Configuration for a single form field, returned by GetFormState.
232
+ * @public
233
+ */
234
+ interface FormStateFieldConfig {
235
+ /** Dropdown options for `dynamic_select` fields. */
236
+ options: SelectOption[];
237
+ /** 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. */
238
+ schema: Record<string, unknown>;
239
+ /** Whether the field is disabled (non-interactive). */
240
+ disabled?: boolean;
241
+ /** Whether the field is hidden from the form. */
242
+ hidden?: boolean;
243
+ /** Warning message displayed on the field. You can still save the workflow. */
244
+ warning?: string;
245
+ /** Error message displayed on the field. Blocks saving the workflow. */
246
+ error?: string;
247
+ }
248
+ /**
249
+ * An option in a dynamic_select dropdown.
250
+ * @public
251
+ */
252
+ interface SelectOption {
253
+ value: string;
254
+ label: string;
255
+ }
256
+ /**
257
+ * Request payload for GetFormState, sent at configuration time.
258
+ * @public
259
+ */
260
+ interface GetFormStateRequest {
261
+ /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
262
+ values: Record<string, unknown>;
263
+ /** 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. */
264
+ changedField?: string;
265
+ }
266
+ /** @public */
267
+ type ExecuteCustomActionResponse = Record<string, never>;
268
+ /**
269
+ * Request payload for executing a custom action, provided at workflow runtime.
270
+ * @public
271
+ */
272
+ interface ExecuteCustomActionRequest {
273
+ /** 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. */
274
+ customInput: Record<string, unknown>;
275
+ }
276
+ /**
277
+ * @public
278
+ * @deprecated Platform dispatch handles wire/SDK conversion.
279
+ */
280
+ function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
281
+ /**
282
+ * @public
283
+ * @deprecated Platform dispatch handles wire/SDK conversion.
284
+ */
285
+ function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
286
+ /* Excluded from this release type: $platformWrapExecute */
287
+ /**
288
+ * @public
289
+ * @deprecated Platform dispatch handles wire/SDK conversion.
290
+ */
291
+ function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
292
+ /**
293
+ * @public
294
+ * @deprecated Platform dispatch handles wire/SDK conversion.
295
+ */
296
+ function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
297
+ /* Excluded from this release type: $platformWrapGetFormState */
298
+ /**
299
+ * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
300
+ * @public
301
+ */
302
+ type ExecuteFunction<Config extends Record<string, unknown>> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
303
+ /**
304
+ * 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.
305
+ * @public
306
+ */
307
+ type GetFormStateFunction<Config extends Record<string, unknown>> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
308
+ }
309
+
310
+ /**
311
+ * @example
312
+ * ```ts
313
+ * import type { Extend } from '@stripe/extensibility-sdk/extensions';
314
+ * import type { Context } from '@stripe/extensibility-sdk/extensions';
315
+ *
316
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
317
+ * interface MyCustomActionConfig extends Record<string, unknown> {}
318
+ *
319
+ * export default class MyCustomAction implements Extend.Workflows
320
+ * .CustomAction<MyCustomActionConfig> {
321
+ * execute(
322
+ * _request: Extend.Workflows.CustomAction.ExecuteCustomActionRequest,
323
+ * _config: MyCustomActionConfig,
324
+ * _context: Context
325
+ * ) {
326
+ * // TODO: implement your action logic here
327
+ *
328
+ * return {};
329
+ * }
330
+ *
331
+ * getFormState(
332
+ * _request: Extend.Workflows.CustomAction.GetFormStateRequest,
333
+ * _config: MyCustomActionConfig,
334
+ * _context: Context
335
+ * ) {
336
+ * // TODO: implement your logic here
337
+ *
338
+ * return {
339
+ * values: {},
340
+ * config: {},
341
+ * };
342
+ * }
343
+ * }
344
+ *
345
+ * ```
346
+ * @public
347
+ */
348
+ declare interface CustomAction_2<Config extends Record<string, unknown>> {
349
+ execute: CustomAction_2.ExecuteFunction<Config>;
350
+ getFormState?: CustomAction_2.GetFormStateFunction<Config>;
351
+ }
352
+
353
+ /** @public */
354
+ declare namespace CustomerBalanceApplication {
355
+ /**
356
+ * The result of computing how much customer balance to apply to a bill.
357
+ * @public
358
+ */
359
+ interface CustomerBalanceApplicationResult {
360
+ /** 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. */
361
+ appliedCustomerBalance: MonetaryAmount;
362
+ }
363
+ /**
364
+ * The bill details provided as input to the customer balance application extension.
365
+ * @public
366
+ */
367
+ interface CustomerBalanceApplicationInput {
368
+ /** The total amount of the invoice before applying any customer balance. */
369
+ totalAmount: MonetaryAmount;
370
+ /** The current customer balance available to apply. Positive values indicate debits (the customer owes money), negative values indicate credits. */
371
+ customerBalance: MonetaryAmount;
372
+ }
373
+ /**
374
+ * @public
375
+ * @deprecated Platform dispatch handles wire/SDK conversion.
376
+ */
377
+ function prepareArgsComputeAppliedCustomerBalance(proto: unknown): CustomerBalanceApplicationInput;
378
+ /**
379
+ * @public
380
+ * @deprecated Platform dispatch handles wire/SDK conversion.
381
+ */
382
+ function prepareResultComputeAppliedCustomerBalance(result: CustomerBalanceApplicationResult): CustomerBalanceApplicationResult;
383
+ /* Excluded from this release type: $platformWrapComputeAppliedCustomerBalance */
384
+ /**
385
+ * @public
386
+ * @deprecated Platform dispatch handles wire/SDK conversion.
387
+ */
388
+ const prepareArgs: typeof prepareArgsComputeAppliedCustomerBalance;
389
+ /**
390
+ * @public
391
+ * @deprecated Platform dispatch handles wire/SDK conversion.
392
+ */
393
+ const prepareResult: typeof prepareResultComputeAppliedCustomerBalance;
394
+ /**
395
+ * 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.
396
+ * @public
397
+ */
398
+ type ComputeAppliedCustomerBalanceFunction<Config extends Record<string, unknown>> = (request: CustomerBalanceApplicationInput, config: Config, context: Context) => CustomerBalanceApplicationResult;
399
+ }
400
+
401
+ /**
402
+ * @example
403
+ * ```ts
404
+ * import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
405
+ *
406
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
407
+ * interface MyCustomerBalanceApplicationConfig extends Record<string, unknown> {}
408
+ *
409
+ * export default class MyCustomerBalanceApplication implements Billing.CustomerBalanceApplication<MyCustomerBalanceApplicationConfig> {
410
+ * computeAppliedCustomerBalance(
411
+ * request: Billing.CustomerBalanceApplication.CustomerBalanceApplicationInput,
412
+ * _config: MyCustomerBalanceApplicationConfig,
413
+ * _context: Context
414
+ * ) {
415
+ * // TODO: implement your customer balance logic here
416
+ *
417
+ * return {
418
+ * appliedCustomerBalance: request.customerBalance,
419
+ * };
420
+ * }
421
+ * }
422
+ *
423
+ * ```
424
+ * @public
425
+ */
426
+ declare interface CustomerBalanceApplication<Config extends Record<string, unknown>> {
427
+ computeAppliedCustomerBalance: CustomerBalanceApplication.ComputeAppliedCustomerBalanceFunction<Config>;
428
+ }
429
+
430
+ /**
431
+ * Arbitrary-precision decimal type for billing calculations.
432
+ *
433
+ * @remarks
434
+ * `Decimal` values are created by the {@link (Decimal:variable) | Decimal companion object}
435
+ * and store values as `coefficient × 10^exponent` using `BigInt`. They avoid
436
+ * every common binary floating-point pitfall — `Decimal.from('0.1').add(Decimal.from('0.2'))`
437
+ * is exactly `0.3`.
438
+ *
439
+ * Instances are immutable (frozen) and all arithmetic returns a new
440
+ * `Decimal`. The public type carries two brand symbols so the type system
441
+ * prevents accidental assignment from plain `number`, `string`, or
442
+ * `bigint`.
443
+ *
444
+ * Create values via the companion object:
445
+ *
446
+ * @example
447
+ * ```ts
448
+ * import { Decimal, RoundDirection } from '@stripe/extensibility-sdk/stdlib';
449
+ *
450
+ * const price = Decimal.from('19.99');
451
+ * const tax = price.mul(Decimal.from('0.0825'));
452
+ * const total = price.add(tax);
453
+ *
454
+ * console.log(total.toFixed(2, 'half-up')); // "21.64"
455
+ * console.log(JSON.stringify({ total })); // '{"total":"21.639175"}'
456
+ * console.log(total.toFixed(2, 'half-even')); // "21.64"
457
+ * ```
458
+ *
459
+ * @public
460
+ */
461
+ export declare interface Decimal {
462
+ /* Excluded from this release type: [__brand] */
463
+ /* Excluded from this release type: [__decimalBrand] */
464
+ /* Excluded from this release type: [__stripeType] */
465
+ /**
466
+ * Return the sum of this value and `other`.
467
+ * @public
468
+ */
469
+ add(other: Decimal): Decimal;
470
+ /**
471
+ * Return the difference of this value and `other`.
472
+ * @public
473
+ */
474
+ sub(other: Decimal): Decimal;
475
+ /**
476
+ * Return the product of this value and `other`.
477
+ * @public
478
+ */
479
+ mul(other: Decimal): Decimal;
480
+ /**
481
+ * Return the quotient of this value divided by `other`.
482
+ * @public
483
+ */
484
+ div(other: Decimal, precision: number, direction: RoundDirection): Decimal;
485
+ /**
486
+ * Three-way comparison: returns `-1`, `0`, or `1`.
487
+ * @public
488
+ */
489
+ cmp(other: Decimal): -1 | 0 | 1;
490
+ /**
491
+ * Return `true` if this value is numerically equal to `other`.
492
+ * @public
493
+ */
494
+ eq(other: Decimal): boolean;
495
+ /**
496
+ * Return `true` if this value is strictly less than `other`.
497
+ * @public
498
+ */
499
+ lt(other: Decimal): boolean;
500
+ /**
501
+ * Return `true` if this value is less than or equal to `other`.
502
+ * @public
503
+ */
504
+ lte(other: Decimal): boolean;
505
+ /**
506
+ * Return `true` if this value is strictly greater than `other`.
507
+ * @public
508
+ */
509
+ gt(other: Decimal): boolean;
510
+ /**
511
+ * Return `true` if this value is greater than or equal to `other`.
512
+ * @public
513
+ */
514
+ gte(other: Decimal): boolean;
515
+ /**
516
+ * Return `true` if this value is exactly zero.
517
+ * @public
518
+ */
519
+ isZero(): boolean;
520
+ /**
521
+ * Return `true` if this value is strictly less than zero.
522
+ * @public
523
+ */
524
+ isNegative(): boolean;
525
+ /**
526
+ * Return `true` if this value is strictly greater than zero.
527
+ * @public
528
+ */
529
+ isPositive(): boolean;
530
+ /**
531
+ * Return the additive inverse of this value.
532
+ * @public
533
+ */
534
+ neg(): Decimal;
535
+ /**
536
+ * Return the absolute value.
537
+ * @public
538
+ */
539
+ abs(): Decimal;
540
+ /**
541
+ * Round this value to the specified precision.
542
+ * @public
543
+ */
544
+ round(direction: RoundDirection, options: DecimalRoundingOptions | keyof typeof DecimalRoundingPresets): Decimal;
545
+ /**
546
+ * Return the canonical string representation.
547
+ * @public
548
+ */
549
+ toString(): string;
550
+ /**
551
+ * Return the JSON-serializable string representation.
552
+ * @public
553
+ */
554
+ toJSON(): string;
555
+ /**
556
+ * Convert to a JavaScript `number` (lossy).
557
+ * @public
558
+ */
559
+ toNumber(): number;
560
+ /**
561
+ * Format as a fixed-point string with exactly `decimalPlaces` digits.
562
+ * @public
563
+ */
564
+ toFixed(decimalPlaces: number, direction: RoundDirection): string;
565
+ /**
566
+ * Rejects implicit coercion; explicit `String(d)` and template literals still work.
567
+ * @public
568
+ */
569
+ [Symbol.toPrimitive](hint: 'default' | 'number' | 'string'): string;
570
+ /**
571
+ * Returns the string representation; invoked by the JavaScript engine as a fallback coercion path.
572
+ * @public
573
+ */
574
+ valueOf(): string;
575
+ }
576
+
577
+ /**
578
+ * Companion object for creating `Decimal` instances.
579
+ *
580
+ * @public
581
+ */
582
+ export declare const Decimal: {
583
+ from(value: bigint | number | string): Decimal;
584
+ zero: Decimal;
585
+ };
586
+
587
+ /**
588
+ * Precision specification for `Decimal.round()`.
589
+ *
590
+ * @remarks
591
+ * Two modes are supported:
592
+ * - `"decimal-places"` — round to a fixed number of digits after the decimal point.
593
+ * - `"significant-figures"` — round to a fixed number of significant digits.
594
+ *
595
+ * @example
596
+ * ```ts
597
+ * // Round to 2 decimal places
598
+ * amount.round('half-even', { mode: 'decimal-places', value: 2 });
599
+ *
600
+ * // Round to 4 significant figures
601
+ * amount.round('half-up', { mode: 'significant-figures', value: 4 });
602
+ * ```
603
+ *
604
+ * @public
605
+ */
606
+ export declare interface DecimalRoundingOptions {
607
+ /** Whether to count digits from the decimal point (`"decimal-places"`) or from the most significant digit (`"significant-figures"`). */
608
+ mode: 'decimal-places' | 'significant-figures';
609
+ /**
610
+ * The number of digits to retain. Interpreted as decimal places when
611
+ * `mode` is `"decimal-places"`, or as significant figures when `mode`
612
+ * is `"significant-figures"`.
613
+ * @public
614
+ */
615
+ value: number;
616
+ }
617
+
618
+ /**
619
+ * Built-in rounding presets keyed by semantic name.
620
+ *
621
+ * @remarks
622
+ * Stripe defines the full set of supported preset names accepted by
623
+ * `Decimal.round()`.
624
+ *
625
+ * | Preset | Equivalent DecimalRoundingOptions |
626
+ * | ------------------- | ----------------------------------------------------- |
627
+ * | `"ubb-usage-count"` | `{ mode: "significant-figures", value: 15 }` |
628
+ * | `"v1-api"` | `{ mode: "decimal-places", value: 12 }` |
629
+ *
630
+ * @public
631
+ */
632
+ export declare const DecimalRoundingPresets: Readonly<{
633
+ 'ubb-usage-count': Readonly<{
634
+ mode: "significant-figures";
635
+ value: number;
636
+ }>;
637
+ 'v1-api': Readonly<{
638
+ mode: "decimal-places";
639
+ value: number;
640
+ }>;
641
+ }>;
642
+
643
+ /** @public */
644
+ declare namespace DiscountCalculation {
645
+ /** @public */
646
+ type BillingReason = 'automatic_pending_invoice_item_invoice' | 'manual' | 'subscription' | 'subscription_create' | 'subscription_cycle' | 'subscription_cancel' | 'subscription_threshold' | 'subscription_trial_ended' | 'subscription_update' | 'upcoming' | 'quote_accept';
647
+ /** @public */
648
+ type PricingTierMode = 'graduated' | 'volume';
649
+ /** @public */
650
+ type PriceType = 'one_time' | 'recurring';
651
+ /** @public */
652
+ type PricingScheme = 'per_unit' | 'tiered';
653
+ /** @public */
654
+ type UsageType = 'licensed' | 'metered';
655
+ /** @public */
656
+ type RecurringPriceInterval = 'day' | 'week' | 'month' | 'year';
657
+ /**
658
+ * The result of a discount calculation.
659
+ * @public
660
+ */
661
+ interface DiscountResult {
662
+ /** The computed discount to apply. */
663
+ discount: Discount;
664
+ }
665
+ /**
666
+ * A discount to apply to a discountable item.
667
+ * @public
668
+ */
669
+ interface Discount {
670
+ /** The discount amount to subtract from the discountable item. */
671
+ amount: MonetaryAmount;
672
+ }
673
+ /**
674
+ * An item eligible for discount calculation, containing its line items and billing context.
675
+ * @public
676
+ */
677
+ interface DiscountableItem {
678
+ /** The individual line items that make up the discountable item. */
679
+ lineItems: DiscountableLineItem[];
680
+ /** The total gross amount of the discountable item before any discounts. */
681
+ grossAmount: MonetaryAmount;
682
+ /** The customer associated with the discountable item. */
683
+ customer?: Customer;
684
+ /** The reason this item is being billed. */
685
+ billingReason?: BillingReason;
686
+ /** The subscription associated with the discountable item. */
687
+ subscription?: Subscription;
688
+ }
689
+ /**
690
+ * The subscription associated with the discountable item.
691
+ * @public
692
+ */
693
+ interface Subscription {
694
+ /** The unique identifier of the subscription. */
695
+ id: string;
696
+ /** The Unix timestamp of the billing cycle anchor. */
697
+ billingCycleAnchor?: number;
698
+ /** The structured billing cycle anchor configuration. */
699
+ billingCycleAnchorConfig?: BillingCycleAnchorConfig;
700
+ /** Custom key-value pairs attached to the subscription. */
701
+ metadata: Record<string, string>;
702
+ }
703
+ /**
704
+ * Configuration for the billing cycle anchor, specifying when recurring billing periods start.
705
+ * @public
706
+ */
707
+ interface BillingCycleAnchorConfig {
708
+ /** The month component of the billing cycle anchor. */
709
+ month: number;
710
+ /** The day of the month for the billing cycle anchor. */
711
+ dayOfMonth: number;
712
+ /** The hour component of the billing cycle anchor. */
713
+ hour: number;
714
+ /** The minute component of the billing cycle anchor. */
715
+ minute: number;
716
+ /** The second component of the billing cycle anchor. */
717
+ second: number;
718
+ }
719
+ /**
720
+ * The customer associated with the discountable item.
721
+ * @public
722
+ */
723
+ interface Customer {
724
+ /** The unique identifier of the customer. */
725
+ id: string;
726
+ /** Custom key-value pairs attached to the customer. */
727
+ metadata: Record<string, string>;
728
+ }
729
+ /**
730
+ * A single line item within a discountable item.
731
+ * @public
732
+ */
733
+ interface DiscountableLineItem {
734
+ /** The subtotal amount of this line item. */
735
+ subtotal: MonetaryAmount;
736
+ /** The quantity of this line item. */
737
+ quantity?: Decimal;
738
+ /** The billing period this line item covers. */
739
+ period: AnyTimeRange;
740
+ /** The price information for this line item. */
741
+ price?: Price;
742
+ }
743
+ /**
744
+ * The price associated with a line item.
745
+ * @public
746
+ */
747
+ interface Price {
748
+ /** The unique identifier for the price. */
749
+ id: string;
750
+ /** The product this price belongs to. */
751
+ product?: Product;
752
+ /** The recurring pricing configuration, if applicable. */
753
+ recurring?: RecurringPrice;
754
+ /** The billing scheme, either per-unit or tiered. */
755
+ billingScheme?: PricingScheme;
756
+ /** The pricing tiers, applicable for tiered billing schemes. */
757
+ tiers: PriceTier[];
758
+ /** The price type, either one-time or recurring. */
759
+ type?: PriceType;
760
+ /** The tiering mode, either graduated or volume. */
761
+ tiersMode?: PricingTierMode;
762
+ /** Key-value metadata attached to the price. */
763
+ metadata: Record<string, string>;
764
+ /** The unit amount of the price. */
765
+ unitAmount?: Decimal;
766
+ }
767
+ /**
768
+ * A tier within a tiered pricing structure.
769
+ * @public
770
+ */
771
+ interface PriceTier {
772
+ /** The flat fee charged for this tier. */
773
+ flatAmount?: Decimal;
774
+ /** The per-unit price for this tier. */
775
+ unitAmount?: Decimal;
776
+ /** The upper bound of the tier range. */
777
+ upTo?: Decimal;
778
+ }
779
+ /**
780
+ * The recurring pricing configuration for a price.
781
+ * @public
782
+ */
783
+ interface RecurringPrice {
784
+ /** The billing interval for the recurring price. */
785
+ interval: RecurringPriceInterval;
786
+ /** The number of intervals between each billing cycle. */
787
+ intervalCount: number;
788
+ /** The usage type, either licensed or metered. */
789
+ usageType?: UsageType;
790
+ /** The identifier of the meter tracking usage for this price. */
791
+ meter?: string;
792
+ }
793
+ /**
794
+ * The product associated with a price.
795
+ * @public
796
+ */
797
+ interface Product {
798
+ /** The unique identifier of the product. */
799
+ id: string;
800
+ /** The name of the product. */
801
+ name: string;
802
+ /** Custom key-value pairs attached to the product. */
803
+ metadata: Record<string, string>;
804
+ }
805
+ /**
806
+ * @public
807
+ * @deprecated Platform dispatch handles wire/SDK conversion.
808
+ */
809
+ function prepareArgsComputeDiscounts(proto: unknown): DiscountableItem;
810
+ /**
811
+ * @public
812
+ * @deprecated Platform dispatch handles wire/SDK conversion.
813
+ */
814
+ function prepareResultComputeDiscounts(result: DiscountResult): DiscountResult;
815
+ /* Excluded from this release type: $platformWrapComputeDiscounts */
816
+ /**
817
+ * @public
818
+ * @deprecated Platform dispatch handles wire/SDK conversion.
819
+ */
820
+ const prepareArgs: typeof prepareArgsComputeDiscounts;
821
+ /**
822
+ * @public
823
+ * @deprecated Platform dispatch handles wire/SDK conversion.
824
+ */
825
+ const prepareResult: typeof prepareResultComputeDiscounts;
826
+ /**
827
+ * Computes discount amounts for a discountable item and returns a discount result.
828
+ * @public
829
+ */
830
+ type ComputeDiscountsFunction<Config extends Record<string, unknown>> = (request: DiscountableItem, config: Config, context: Context) => DiscountResult;
831
+ }
832
+
833
+ /**
834
+ * @example
835
+ * ```ts
836
+ * import type { Billing } from '@stripe/extensibility-sdk/extensions';
837
+ * import type { Context } from '@stripe/extensibility-sdk/extensions';
838
+ *
839
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
840
+ * interface MyDiscountCalculationConfig extends Record<string, unknown> {}
841
+ *
842
+ * export default class MyDiscountCalculation implements Billing.Bill
843
+ * .DiscountCalculation<MyDiscountCalculationConfig> {
844
+ * computeDiscounts(
845
+ * request: Billing.Bill.DiscountCalculation.DiscountableItem,
846
+ * _config: MyDiscountCalculationConfig,
847
+ * _context: Context
848
+ * ) {
849
+ * // TODO: implement your discount logic here
850
+ *
851
+ * return {
852
+ * discount: { amount: request.grossAmount },
853
+ * };
854
+ * }
855
+ * }
856
+ *
857
+ * ```
858
+ * @public
859
+ */
860
+ declare interface DiscountCalculation<Config extends Record<string, unknown>> {
861
+ computeDiscounts: DiscountCalculation.ComputeDiscountsFunction<Config>;
862
+ }
863
+
864
+ declare namespace Extend {
865
+ export {
866
+ Workflows_2 as Workflows
867
+ }
868
+ }
869
+ export { Extend }
870
+
871
+ /** @public */
872
+ declare namespace InvoiceCollectionSetting {
873
+ /** @public */
874
+ type ParentType = 'subscription' | 'contract' | 'quote' | 'billing_cadence' | 'subscription_schedule' | 'standalone';
875
+ /** @public */
876
+ type PaymentMethodType = 'card' | 'ach_debit' | 'ach_credit_transfer' | 'sepa_debit' | 'sepa_credit_transfer' | 'bacs_debit' | 'au_becs_debit' | 'us_bank_account' | 'link' | 'boleto' | 'oxxo' | 'ideal' | 'bancontact' | 'giropay' | 'eps' | 'p24' | 'sofort' | 'alipay' | 'wechat_pay' | 'klarna' | 'affirm' | 'afterpay_clearpay' | 'cashapp' | 'paypal' | 'multibanco' | 'konbini' | 'promptpay' | 'paynow' | 'grabpay' | 'fpx';
877
+ /** @public */
878
+ type CollectionMethod = 'send_invoice' | 'charge_automatically';
879
+ /**
880
+ * The result of the invoice collection settings override extension.
881
+ * @public
882
+ */
883
+ interface InvoiceCollectionResponse {
884
+ /** Override the auto-advancement setting. Set to false to keep the invoice in draft. Return null to use the default. */
885
+ autoAdvance?: boolean;
886
+ }
887
+ /** @public */
888
+ type InvoiceCollectionRequest = {
889
+ /** The current collection settings that would be applied to the invoice. */
890
+ collectionSettings: CollectionSettings;
891
+ /** The billing resource that triggered invoice creation. */
892
+ parent: Parent;
893
+ } & ({
894
+ payer: 'customer';
895
+ customer: Customer;
896
+ } | {
897
+ payer: 'other';
898
+ otherPayer: string;
899
+ });
900
+ /** @public */
901
+ interface Customer {
902
+ id: string;
903
+ metadata: Record<string, string>;
904
+ }
905
+ /**
906
+ * The parent resource that triggered the invoice creation.
907
+ * @public
908
+ */
909
+ interface Parent {
910
+ /** The type of parent resource (for example, subscription or contract). */
911
+ type: ParentType;
912
+ /** Custom key-value pairs attached to the parent resource. */
913
+ metadata: Record<string, string>;
914
+ }
915
+ /**
916
+ * The collection settings for an invoice.
917
+ * @public
918
+ */
919
+ interface CollectionSettings {
920
+ /** Whether the invoice automatically advances through its lifecycle. */
921
+ autoAdvance: boolean;
922
+ /** The payment collection method: charge_automatically or send_invoice. */
923
+ collectionMethod: CollectionMethod;
924
+ /** The delay before the invoice is finalized, in hours. */
925
+ finalizationGracePeriod: number;
926
+ /** The payment methods configured for this invoice. */
927
+ paymentMethods: PaymentMethodType[];
928
+ }
929
+ /**
930
+ * @public
931
+ * @deprecated Platform dispatch handles wire/SDK conversion.
932
+ */
933
+ function prepareArgsCollectionOverride(proto: unknown): InvoiceCollectionRequest;
934
+ /**
935
+ * @public
936
+ * @deprecated Platform dispatch handles wire/SDK conversion.
937
+ */
938
+ function prepareResultCollectionOverride(result: InvoiceCollectionResponse): InvoiceCollectionResponse;
939
+ /* Excluded from this release type: $platformWrapCollectionOverride */
940
+ /**
941
+ * @public
942
+ * @deprecated Platform dispatch handles wire/SDK conversion.
943
+ */
944
+ const prepareArgs: typeof prepareArgsCollectionOverride;
945
+ /**
946
+ * @public
947
+ * @deprecated Platform dispatch handles wire/SDK conversion.
948
+ */
949
+ const prepareResult: typeof prepareResultCollectionOverride;
950
+ /**
951
+ * Overrides invoice collection settings before a draft invoice is created.
952
+ * @public
953
+ */
954
+ type CollectionOverrideFunction<Config extends Record<string, unknown>> = (request: InvoiceCollectionRequest, config: Config, context: Context) => InvoiceCollectionResponse;
955
+ }
956
+
957
+ /**
958
+ * @example
959
+ * ```ts
960
+ * import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
961
+ *
962
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
963
+ * interface MyInvoiceCollectionSettingConfig extends Record<string, unknown> {}
964
+ *
965
+ * export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
966
+ * collectionOverride(
967
+ * _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
968
+ * _config: MyInvoiceCollectionSettingConfig,
969
+ * _context: Context
970
+ * ) {
971
+ * // TODO: implement your collection setting logic here
972
+ *
973
+ * return {};
974
+ * }
975
+ * }
976
+ *
977
+ * ```
978
+ * @public
979
+ */
980
+ declare interface InvoiceCollectionSetting<Config extends Record<string, unknown>> {
981
+ collectionOverride: InvoiceCollectionSetting.CollectionOverrideFunction<Config>;
982
+ }
983
+
984
+ /**
985
+ * Represents a monetary value with amount and currency.
986
+ * @format monetary-amount
987
+ * @public
988
+ */
989
+ declare interface MonetaryAmount {
990
+ /** The numerical value. */
991
+ amount: Decimal;
992
+ /** The currency code. */
993
+ currency: Currency;
994
+ }
995
+
996
+ /**
997
+ * Represents a one-time event occurring at a specific date.
998
+ * @public
999
+ */
1000
+ declare interface OneTime {
1001
+ /** The date and time of the event. */
1002
+ at: Date;
1003
+ }
1004
+
1005
+ /**
1006
+ * Represents a percentage number value (0-100).
1007
+ * @format percent
1008
+ * @public
1009
+ */
1010
+ export declare interface Percent {
1011
+ /** The percentage value. */
1012
+ value: number;
1013
+ }
1014
+
1015
+ /** @public */
1016
+ declare namespace Prorations {
1017
+ /** @public */
1018
+ type PricingTierMode = 'graduated' | 'volume';
1019
+ /** @public */
1020
+ type RecurringPriceInterval = 'day' | 'week' | 'month' | 'year';
1021
+ /** @public */
1022
+ type PriceType = 'one_time' | 'recurring';
1023
+ /** @public */
1024
+ type PricingScheme = 'per_unit' | 'tiered';
1025
+ /** @public */
1026
+ type UsageType = 'licensed' | 'metered';
1027
+ /** @public */
1028
+ type ItemType = 'credit' | 'debit';
1029
+ /**
1030
+ * The result of the prorations extension.
1031
+ * @public
1032
+ */
1033
+ interface ProrateItemsResult {
1034
+ /** The items with computed proration factors. */
1035
+ items: ItemWithProration[];
1036
+ }
1037
+ /**
1038
+ * An item with a computed proration factor.
1039
+ * @public
1040
+ */
1041
+ interface ItemWithProration {
1042
+ /** The unique identifier of the item, matching a key from the input. */
1043
+ key: string;
1044
+ /** The computed proration factor. Positive for charges, negative for credits. */
1045
+ prorationFactor: Decimal;
1046
+ /** The displayed period for the invoice line item. */
1047
+ lineItemPeriod: TimeRange;
1048
+ }
1049
+ /**
1050
+ * The input to the prorations extension.
1051
+ * @public
1052
+ */
1053
+ interface ProrateItemsInput {
1054
+ /** The list of items that can have their proration factor and line item period modified. */
1055
+ items: ProratableItem[];
1056
+ }
1057
+ /** @public */
1058
+ type ProratableItem = {
1059
+ /** Unique identifier for the item. */
1060
+ key: string;
1061
+ /** Either CREDIT or DEBIT based on whether the item is a credit or debit. */
1062
+ type: ItemType;
1063
+ /** Whether the item was generated from a proration event. */
1064
+ isProration: boolean;
1065
+ /** The time period this item covers. */
1066
+ servicePeriod: TimeRange;
1067
+ /** The default proration factor calculated by Stripe. */
1068
+ currentProrationFactor: Decimal;
1069
+ /** The duration of the price interval in seconds. */
1070
+ priceIntervalDuration: number;
1071
+ /** Information about the corresponding debit that a CREDIT item credits against. */
1072
+ correspondingDebit?: PreviousDebit;
1073
+ } & ({
1074
+ priceKind: 'price';
1075
+ price: Price;
1076
+ } | {
1077
+ priceKind: 'licenseFee';
1078
+ licenseFee: LicenseFee;
1079
+ } | {
1080
+ priceKind: 'rateCardRate';
1081
+ rateCardRate: RateCardRate;
1082
+ } | {
1083
+ priceKind: 'customPricingUnitOverageRate';
1084
+ customPricingUnitOverageRate: CustomPricingUnitOverageRate;
1085
+ } | {
1086
+ priceKind: 'other';
1087
+ otherPriceKind: string;
1088
+ });
1089
+ /**
1090
+ * Information about a previous debit that a credit item offsets.
1091
+ * @public
1092
+ */
1093
+ interface PreviousDebit {
1094
+ /** The service period of the corresponding debit. */
1095
+ servicePeriod: TimeRange;
1096
+ }
1097
+ /** @public */
1098
+ interface CustomPricingUnitOverageRate {
1099
+ id: string;
1100
+ metadata: Record<string, string>;
1101
+ rateCard: RateCard;
1102
+ customPricingUnit: string;
1103
+ unitAmount: Decimal;
1104
+ }
1105
+ /** @public */
1106
+ interface RateCard {
1107
+ id: string;
1108
+ currency: Currency;
1109
+ }
1110
+ /** @public */
1111
+ interface RateCardRate {
1112
+ id: string;
1113
+ metadata: Record<string, string>;
1114
+ rateCard: RateCard;
1115
+ tieringMode?: PricingTierMode;
1116
+ tiers: RateCardRateTier[];
1117
+ unitAmount?: Decimal;
1118
+ }
1119
+ /** @public */
1120
+ interface RateCardRateTier {
1121
+ flatAmount?: Decimal;
1122
+ unitAmount?: Decimal;
1123
+ upTo?: Decimal;
1124
+ }
1125
+ /** @public */
1126
+ interface LicenseFee {
1127
+ id: string;
1128
+ lookupKey?: string;
1129
+ metadata: Record<string, string>;
1130
+ serviceInterval: RecurringPriceInterval;
1131
+ serviceIntervalCount: number;
1132
+ tieringMode?: PricingTierMode;
1133
+ tiers: LicenseFeeTier[];
1134
+ currency: Currency;
1135
+ unitAmount?: Decimal;
1136
+ }
1137
+ /** @public */
1138
+ interface LicenseFeeTier {
1139
+ flatAmount?: Decimal;
1140
+ unitAmount?: Decimal;
1141
+ upTo?: Decimal;
1142
+ }
1143
+ /** @public */
1144
+ interface Price {
1145
+ id: string;
1146
+ product: Product;
1147
+ recurring?: RecurringPrice;
1148
+ billingScheme: PricingScheme;
1149
+ tiers: PriceTier[];
1150
+ type: PriceType;
1151
+ tiersMode?: PricingTierMode;
1152
+ metadata: Record<string, string>;
1153
+ currency: Currency;
1154
+ unitAmount?: Decimal;
1155
+ }
1156
+ /** @public */
1157
+ interface PriceTier {
1158
+ flatAmount?: Decimal;
1159
+ unitAmount?: Decimal;
1160
+ upTo?: number;
1161
+ }
1162
+ /** @public */
1163
+ interface RecurringPrice {
1164
+ interval: RecurringPriceInterval;
1165
+ intervalCount: number;
1166
+ usageType?: UsageType;
1167
+ meter?: string;
1168
+ }
1169
+ /** @public */
1170
+ interface Product {
1171
+ id: string;
1172
+ name: string;
1173
+ metadata: Record<string, string>;
1174
+ }
1175
+ /**
1176
+ * @public
1177
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1178
+ */
1179
+ function prepareArgsProrateItems(proto: unknown): ProrateItemsInput;
1180
+ /**
1181
+ * @public
1182
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1183
+ */
1184
+ function prepareResultProrateItems(result: ProrateItemsResult): ProrateItemsResult;
1185
+ /* Excluded from this release type: $platformWrapProrateItems */
1186
+ /**
1187
+ * @public
1188
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1189
+ */
1190
+ const prepareArgs: typeof prepareArgsProrateItems;
1191
+ /**
1192
+ * @public
1193
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1194
+ */
1195
+ const prepareResult: typeof prepareResultProrateItems;
1196
+ /**
1197
+ * 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.
1198
+ * @public
1199
+ */
1200
+ type ProrateItemsFunction<Config extends Record<string, unknown>> = (request: ProrateItemsInput, config: Config, context: Context) => ProrateItemsResult;
1201
+ }
1202
+
1203
+ /**
1204
+ * @example
1205
+ * ```ts
1206
+ * import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
1207
+ *
1208
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1209
+ * interface MyProrationsConfig extends Record<string, unknown> {}
1210
+ *
1211
+ * export default class MyProrations implements Billing.Prorations<MyProrationsConfig> {
1212
+ * prorateItems(
1213
+ * _request: Billing.Prorations.ProrateItemsInput,
1214
+ * _config: MyProrationsConfig,
1215
+ * _context: Context
1216
+ * ) {
1217
+ * // TODO: implement your proration logic here
1218
+ *
1219
+ * return {
1220
+ * items: [],
1221
+ * };
1222
+ * }
1223
+ * }
1224
+ *
1225
+ * ```
1226
+ * @public
1227
+ */
1228
+ declare interface Prorations<Config extends Record<string, unknown>> {
1229
+ prorateItems: Prorations.ProrateItemsFunction<Config>;
1230
+ }
1231
+
1232
+ /** @public */
1233
+ declare namespace RecurringBillingItemHandling {
1234
+ /** @public */
1235
+ type PricingTierMode = 'graduated' | 'volume';
1236
+ /** @public */
1237
+ type RecurringPriceInterval = 'day' | 'week' | 'month' | 'year';
1238
+ /** @public */
1239
+ type PriceType = 'one_time' | 'recurring';
1240
+ /** @public */
1241
+ type PricingScheme = 'per_unit' | 'tiered';
1242
+ /** @public */
1243
+ type UsageType = 'licensed' | 'metered';
1244
+ /** @public */
1245
+ type ItemType = 'credit' | 'debit';
1246
+ /**
1247
+ * The result of the group items extension.
1248
+ * @public
1249
+ */
1250
+ interface GroupItemsResult {
1251
+ /** The groups of items, each corresponding to a separate invoice. */
1252
+ groups: ItemGroup[];
1253
+ }
1254
+ /**
1255
+ * A group of items to place on a single invoice.
1256
+ * @public
1257
+ */
1258
+ interface ItemGroup {
1259
+ /** The items in this group. */
1260
+ items: GroupedItem[];
1261
+ /** Whether this group sets the latest invoice reference on the subscription. */
1262
+ setsLatestInvoice: boolean;
1263
+ }
1264
+ /**
1265
+ * An item assigned to a group.
1266
+ * @public
1267
+ */
1268
+ interface GroupedItem {
1269
+ /** The unique identifier of the item, matching a key from the input. */
1270
+ key: string;
1271
+ }
1272
+ /**
1273
+ * The input to the group items extension.
1274
+ * @public
1275
+ */
1276
+ interface GroupItemsInput {
1277
+ /** The list of items to group across invoices. */
1278
+ items: Item[];
1279
+ }
1280
+ /** @public */
1281
+ type Item = {
1282
+ /** Unique identifier for the item. */
1283
+ key: string;
1284
+ /** Either CREDIT or DEBIT based on whether the item is a credit or debit. */
1285
+ type: ItemType;
1286
+ /** Whether the item was generated from a proration event. */
1287
+ isProration: boolean;
1288
+ /** The time period this item covers. */
1289
+ servicePeriod: AnyTimeRange;
1290
+ /** The proration factor for this item. */
1291
+ prorationFactor: Decimal;
1292
+ } & ({
1293
+ priceKind: 'price';
1294
+ price: Price;
1295
+ } | {
1296
+ priceKind: 'licenseFee';
1297
+ licenseFee: LicenseFee;
1298
+ } | {
1299
+ priceKind: 'rateCardRate';
1300
+ rateCardRate: RateCardRate;
1301
+ } | {
1302
+ priceKind: 'customPricingUnitOverageRate';
1303
+ customPricingUnitOverageRate: CustomPricingUnitOverageRate;
1304
+ } | {
1305
+ priceKind: 'other';
1306
+ otherPriceKind: string;
1307
+ });
1308
+ /** @public */
1309
+ interface CustomPricingUnitOverageRate {
1310
+ id: string;
1311
+ metadata: Record<string, string>;
1312
+ rateCard: RateCard;
1313
+ customPricingUnit: string;
1314
+ unitAmount: Decimal;
1315
+ }
1316
+ /** @public */
1317
+ interface RateCard {
1318
+ id: string;
1319
+ currency: Currency;
1320
+ }
1321
+ /** @public */
1322
+ interface RateCardRate {
1323
+ id: string;
1324
+ metadata: Record<string, string>;
1325
+ rateCard: RateCard;
1326
+ tieringMode?: PricingTierMode;
1327
+ tiers: RateCardRateTier[];
1328
+ unitAmount?: Decimal;
1329
+ }
1330
+ /** @public */
1331
+ interface RateCardRateTier {
1332
+ flatAmount?: Decimal;
1333
+ unitAmount?: Decimal;
1334
+ upTo?: Decimal;
1335
+ }
1336
+ /** @public */
1337
+ interface LicenseFee {
1338
+ id: string;
1339
+ lookupKey?: string;
1340
+ metadata: Record<string, string>;
1341
+ serviceInterval: RecurringPriceInterval;
1342
+ serviceIntervalCount: number;
1343
+ tieringMode?: PricingTierMode;
1344
+ tiers: LicenseFeeTier[];
1345
+ currency: Currency;
1346
+ unitAmount?: Decimal;
1347
+ }
1348
+ /** @public */
1349
+ interface LicenseFeeTier {
1350
+ flatAmount?: Decimal;
1351
+ unitAmount?: Decimal;
1352
+ upTo?: Decimal;
1353
+ }
1354
+ /** @public */
1355
+ interface Price {
1356
+ id: string;
1357
+ product: Product;
1358
+ recurring?: RecurringPrice;
1359
+ billingScheme: PricingScheme;
1360
+ tiers: PriceTier[];
1361
+ type: PriceType;
1362
+ tiersMode?: PricingTierMode;
1363
+ metadata: Record<string, string>;
1364
+ currency: Currency;
1365
+ unitAmount?: Decimal;
1366
+ }
1367
+ /** @public */
1368
+ interface PriceTier {
1369
+ flatAmount?: Decimal;
1370
+ unitAmount?: Decimal;
1371
+ upTo?: number;
1372
+ }
1373
+ /** @public */
1374
+ interface RecurringPrice {
1375
+ interval: RecurringPriceInterval;
1376
+ intervalCount: number;
1377
+ usageType?: UsageType;
1378
+ meter?: string;
1379
+ }
1380
+ /** @public */
1381
+ interface Product {
1382
+ id: string;
1383
+ name: string;
1384
+ metadata: Record<string, string>;
1385
+ }
1386
+ /**
1387
+ * The result of the filter items extension.
1388
+ * @public
1389
+ */
1390
+ interface FilterItemsResult {
1391
+ /** The items to include on the invoice. */
1392
+ items: ItemToInvoice[];
1393
+ }
1394
+ /**
1395
+ * An item selected for inclusion on the invoice.
1396
+ * @public
1397
+ */
1398
+ interface ItemToInvoice {
1399
+ /** The unique identifier of the item, matching a key from the input. */
1400
+ key: string;
1401
+ }
1402
+ /**
1403
+ * The input to the filter items extension.
1404
+ * @public
1405
+ */
1406
+ interface FilterItemsInput {
1407
+ /** The list of items to evaluate for inclusion on the invoice. */
1408
+ items: Item[];
1409
+ }
1410
+ /**
1411
+ * The result of the before item creation extension.
1412
+ * @public
1413
+ */
1414
+ interface BeforeItemCreationResult {
1415
+ /** The items with their creation strategies. */
1416
+ items: ItemWithCreationStrategy[];
1417
+ }
1418
+ /** @public */
1419
+ type ItemWithCreationStrategy = {
1420
+ /** The unique identifier of the item, matching a key from the input. */
1421
+ key: string;
1422
+ } & ({
1423
+ creationStrategy: 'doNotCreate';
1424
+ } | {
1425
+ creationStrategy: 'invoice';
1426
+ } | {
1427
+ creationStrategy: 'other';
1428
+ otherCreationStrategy: string;
1429
+ });
1430
+ /** @public */
1431
+ type Invoice = Record<string, never>;
1432
+ /** @public */
1433
+ type DoNotCreate = Record<string, never>;
1434
+ /**
1435
+ * The input to the before item creation extension.
1436
+ * @public
1437
+ */
1438
+ interface BeforeItemCreationInput {
1439
+ /** The list of items to evaluate for creation. */
1440
+ items: Item[];
1441
+ }
1442
+ /**
1443
+ * @public
1444
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1445
+ */
1446
+ function prepareArgsBeforeItemCreation(proto: unknown): BeforeItemCreationInput;
1447
+ /**
1448
+ * @public
1449
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1450
+ */
1451
+ function prepareResultBeforeItemCreation(result: BeforeItemCreationResult): BeforeItemCreationResult;
1452
+ /* Excluded from this release type: $platformWrapBeforeItemCreation */
1453
+ /**
1454
+ * @public
1455
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1456
+ */
1457
+ function prepareArgsFilterItems(proto: unknown): FilterItemsInput;
1458
+ /**
1459
+ * @public
1460
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1461
+ */
1462
+ function prepareResultFilterItems(result: FilterItemsResult): FilterItemsResult;
1463
+ /* Excluded from this release type: $platformWrapFilterItems */
1464
+ /**
1465
+ * @public
1466
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1467
+ */
1468
+ function prepareArgsGroupItems(proto: unknown): GroupItemsInput;
1469
+ /**
1470
+ * @public
1471
+ * @deprecated Platform dispatch handles wire/SDK conversion.
1472
+ */
1473
+ function prepareResultGroupItems(result: GroupItemsResult): GroupItemsResult;
1474
+ /* Excluded from this release type: $platformWrapGroupItems */
1475
+ /**
1476
+ * Runs before invoice items are created. Decides whether each item should be created or skipped.
1477
+ * @public
1478
+ */
1479
+ type BeforeItemCreationFunction<Config extends Record<string, unknown>> = (request: BeforeItemCreationInput, config: Config, context: Context) => BeforeItemCreationResult;
1480
+ /**
1481
+ * Runs before invoices are created. Decides which items to include on the invoice. Items not included are deferred as pending invoice items.
1482
+ * @public
1483
+ */
1484
+ type FilterItemsFunction<Config extends Record<string, unknown>> = (request: FilterItemsInput, config: Config, context: Context) => FilterItemsResult;
1485
+ /**
1486
+ * Runs before invoices are created. Decides how items are grouped across one or more invoices.
1487
+ * @public
1488
+ */
1489
+ type GroupItemsFunction<Config extends Record<string, unknown>> = (request: GroupItemsInput, config: Config, context: Context) => GroupItemsResult;
1490
+ }
1491
+
1492
+ /**
1493
+ * @example
1494
+ * ```ts
1495
+ * import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
1496
+ *
1497
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1498
+ * interface MyRecurringBillingItemHandlingConfig extends Record<string, unknown> {}
1499
+ *
1500
+ * export default class MyRecurringBillingItemHandling implements Billing.RecurringBillingItemHandling<MyRecurringBillingItemHandlingConfig> {
1501
+ * beforeItemCreation(
1502
+ * _request: Billing.RecurringBillingItemHandling.BeforeItemCreationInput,
1503
+ * _config: MyRecurringBillingItemHandlingConfig,
1504
+ * _context: Context
1505
+ * ) {
1506
+ * // TODO: implement your before-item-creation logic here
1507
+ *
1508
+ * return {
1509
+ * items: [],
1510
+ * };
1511
+ * }
1512
+ *
1513
+ * filterItems(
1514
+ * _request: Billing.RecurringBillingItemHandling.FilterItemsInput,
1515
+ * _config: MyRecurringBillingItemHandlingConfig,
1516
+ * _context: Context
1517
+ * ) {
1518
+ * // TODO: implement your filter-items logic here
1519
+ *
1520
+ * return {
1521
+ * items: [],
1522
+ * };
1523
+ * }
1524
+ *
1525
+ * groupItems(
1526
+ * _request: Billing.RecurringBillingItemHandling.GroupItemsInput,
1527
+ * _config: MyRecurringBillingItemHandlingConfig,
1528
+ * _context: Context
1529
+ * ) {
1530
+ * // TODO: implement your group-items logic here
1531
+ *
1532
+ * return {
1533
+ * groups: [],
1534
+ * };
1535
+ * }
1536
+ * }
1537
+ *
1538
+ * ```
1539
+ * @public
1540
+ */
1541
+ declare interface RecurringBillingItemHandling<Config extends Record<string, unknown>> {
1542
+ beforeItemCreation: RecurringBillingItemHandling.BeforeItemCreationFunction<Config>;
1543
+ filterItems: RecurringBillingItemHandling.FilterItemsFunction<Config>;
1544
+ groupItems: RecurringBillingItemHandling.GroupItemsFunction<Config>;
1545
+ }
1546
+
1547
+ /**
1548
+ * Rounding direction for Decimal operations.
1549
+ *
1550
+ * @remarks
1551
+ * Seven modes corresponding to
1552
+ * {@link https://standards.ieee.org/ieee/754/6210/ | IEEE 754-2019} §4.3
1553
+ * rounding-direction attributes:
1554
+ *
1555
+ * | Direction | IEEE 754 name | Behavior | Examples (→ integer) |
1556
+ * | -------------- | ----------------------- | --------------------------------- | ------------------------------------- |
1557
+ * | `'ceil'` | `roundTowardPositive` | Toward +∞ | 1.1→2, -1.1→-1 |
1558
+ * | `'floor'` | `roundTowardNegative` | Toward -∞ | 1.9→1, -1.1→-2 |
1559
+ * | `'round-down'` | `roundTowardZero` | Toward zero (truncate) | 1.9→1, -1.9→-1 |
1560
+ * | `'round-up'` | — | Away from zero | 1.1→2, -1.1→-2 |
1561
+ * | `'half-up'` | `roundTiesToAway` | Nearest; ties away from zero | 0.5→1, -0.5→-1, 1.4→1 |
1562
+ * | `'half-down'` | — | Nearest; ties toward zero | 0.5→0, -0.5→0, 1.6→2 |
1563
+ * | `'half-even'` | `roundTiesToEven` | Nearest; ties to even (banker's) | 0.5→0, 1.5→2, 2.5→2, 3.5→4 |
1564
+ *
1565
+ * @public
1566
+ */
1567
+ export declare type RoundDirection = 'ceil' | 'floor' | 'half-down' | 'half-even' | 'half-up' | 'round-down' | 'round-up';
1568
+
1569
+ /**
1570
+ * Represents a time period with start and end dates.
1571
+ * @public
1572
+ */
1573
+ declare interface TimeRange {
1574
+ /** The beginning date of the range. */
1575
+ startDate: Date;
1576
+ /** The ending date of the range. */
1577
+ endDate: Date;
1578
+ }
1579
+
1580
+ declare namespace Workflows {
1581
+ export {
1582
+ CustomAction
1583
+ }
1584
+ }
1585
+
1586
+ declare namespace Workflows_2 {
1587
+ export {
1588
+ CustomAction_2 as CustomAction
1589
+ }
1590
+ }
1591
+
1592
+ export { }