@stripe/extensibility-sdk 0.22.4 → 0.23.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.
- package/dist/api-surface.d.ts.map +1 -0
- package/dist/config-values/generate.cjs +1 -1
- package/dist/config-values/generate.d.ts +2 -2
- package/dist/config-values/generate.d.ts.map +1 -1
- package/dist/config-values/generate.js +1 -1
- package/dist/extensibility-sdk-alpha.d.ts +1293 -1
- package/dist/extensibility-sdk-beta.d.ts +1293 -1
- package/dist/extensibility-sdk-config-values-internal.d.ts +2 -2
- package/dist/extensibility-sdk-extensions-alpha.d.ts +56 -77
- package/dist/extensibility-sdk-extensions-beta.d.ts +56 -77
- package/dist/extensibility-sdk-extensions-internal.d.ts +67 -110
- package/dist/extensibility-sdk-extensions-public.d.ts +56 -77
- package/dist/extensibility-sdk-internal.d.ts +1304 -1
- package/dist/extensibility-sdk-public.d.ts +1293 -1
- package/dist/extensions/billing/bill/discount_calculation.d.ts +3 -5
- package/dist/extensions/billing/customer_balance_application.d.ts +1 -3
- package/dist/extensions/billing/invoice_collection_setting.d.ts +11 -15
- package/dist/extensions/billing/prorations.d.ts +21 -30
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts +23 -41
- package/dist/extensions/billing/types.d.ts +4 -4
- package/dist/extensions/core/workflows/custom_action.d.ts +2 -6
- package/dist/extensions/extend/workflows/custom_action.d.ts +2 -6
- package/dist/index.cjs +2317 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2320 -0
- package/dist/stdlib/decimal.d.ts +4 -40
- package/dist/stdlib/refs.d.ts +7 -21
- package/dist/stdlib/scalars.d.ts +16 -71
- package/dist/stdlib/type-utils.d.ts +1 -3
- package/dist/stdlib/types.d.ts +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -10
- package/dist/extensibility-sdk-jsonschema-alpha.d.ts +0 -3
- package/dist/extensibility-sdk-jsonschema-beta.d.ts +0 -3
- package/dist/extensibility-sdk-jsonschema-internal.d.ts +0 -15
- package/dist/extensibility-sdk-jsonschema-public.d.ts +0 -3
- package/dist/jsonschema.cjs +0 -18
- package/dist/jsonschema.d.ts +0 -2
- package/dist/jsonschema.d.ts.map +0 -1
- 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
|
|
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,372 @@ 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 extends Record<string, unknown>> = (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 extends Record<string, unknown>> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* import type { Core } from '@stripe/extensibility-sdk/extensions';
|
|
211
|
+
* import type { Context } from '@stripe/extensibility-sdk/extensions';
|
|
212
|
+
*
|
|
213
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
214
|
+
* interface MyCustomActionConfig extends Record<string, unknown> {}
|
|
215
|
+
*
|
|
216
|
+
* export default class MyCustomAction implements Core.Workflows
|
|
217
|
+
* .CustomAction<MyCustomActionConfig> {
|
|
218
|
+
* execute(
|
|
219
|
+
* _request: Core.Workflows.CustomAction.ExecuteCustomActionRequest,
|
|
220
|
+
* _config: MyCustomActionConfig,
|
|
221
|
+
* _context: Context
|
|
222
|
+
* ) {
|
|
223
|
+
* // TODO: implement your action logic here
|
|
224
|
+
*
|
|
225
|
+
* return {};
|
|
226
|
+
* }
|
|
227
|
+
*
|
|
228
|
+
* getFormState(
|
|
229
|
+
* _request: Core.Workflows.CustomAction.GetFormStateRequest,
|
|
230
|
+
* _config: MyCustomActionConfig,
|
|
231
|
+
* _context: Context
|
|
232
|
+
* ) {
|
|
233
|
+
* // TODO: implement your logic here
|
|
234
|
+
*
|
|
235
|
+
* return {
|
|
236
|
+
* values: {},
|
|
237
|
+
* config: {},
|
|
238
|
+
* };
|
|
239
|
+
* }
|
|
240
|
+
* }
|
|
241
|
+
*
|
|
242
|
+
* ```
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
declare interface CustomAction<Config extends Record<string, unknown>> {
|
|
246
|
+
execute: CustomAction.ExecuteFunction<Config>;
|
|
247
|
+
getFormState?: CustomAction.GetFormStateFunction<Config>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** @public */
|
|
251
|
+
declare namespace CustomAction_2 {
|
|
252
|
+
/**
|
|
253
|
+
* Response payload for GetFormState.
|
|
254
|
+
* @public
|
|
255
|
+
*/
|
|
256
|
+
interface GetFormStateResponse {
|
|
257
|
+
/** 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. */
|
|
258
|
+
values: Record<string, unknown>;
|
|
259
|
+
/** Per-field configuration keyed by field name. */
|
|
260
|
+
config: Record<string, FormStateFieldConfig>;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Configuration for a single form field, returned by GetFormState.
|
|
264
|
+
* @public
|
|
265
|
+
*/
|
|
266
|
+
interface FormStateFieldConfig {
|
|
267
|
+
/** Dropdown options for `dynamic_select` fields. */
|
|
268
|
+
options: SelectOption[];
|
|
269
|
+
/** 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. */
|
|
270
|
+
schema: Record<string, unknown>;
|
|
271
|
+
/** Whether the field is disabled (non-interactive). */
|
|
272
|
+
disabled?: boolean;
|
|
273
|
+
/** Whether the field is hidden from the form. */
|
|
274
|
+
hidden?: boolean;
|
|
275
|
+
/** Warning message displayed on the field. You can still save the workflow. */
|
|
276
|
+
warning?: string;
|
|
277
|
+
/** Error message displayed on the field. Blocks saving the workflow. */
|
|
278
|
+
error?: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* An option in a dynamic_select dropdown.
|
|
282
|
+
* @public
|
|
283
|
+
*/
|
|
284
|
+
interface SelectOption {
|
|
285
|
+
value: string;
|
|
286
|
+
label: string;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Request payload for GetFormState, sent at configuration time.
|
|
290
|
+
* @public
|
|
291
|
+
*/
|
|
292
|
+
interface GetFormStateRequest {
|
|
293
|
+
/** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
|
|
294
|
+
values: Record<string, unknown>;
|
|
295
|
+
/** 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. */
|
|
296
|
+
changedField?: string;
|
|
297
|
+
}
|
|
298
|
+
/** @public */
|
|
299
|
+
type ExecuteCustomActionResponse = Record<string, never>;
|
|
300
|
+
/**
|
|
301
|
+
* Request payload for executing a custom action, provided at workflow runtime.
|
|
302
|
+
* @public
|
|
303
|
+
*/
|
|
304
|
+
interface ExecuteCustomActionRequest {
|
|
305
|
+
/** 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. */
|
|
306
|
+
customInput: Record<string, unknown>;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* @public
|
|
310
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
311
|
+
*/
|
|
312
|
+
function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
|
|
313
|
+
/**
|
|
314
|
+
* @public
|
|
315
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
316
|
+
*/
|
|
317
|
+
function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
|
|
318
|
+
/* Excluded from this release type: $platformWrapExecute */
|
|
319
|
+
/**
|
|
320
|
+
* @public
|
|
321
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
322
|
+
*/
|
|
323
|
+
function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
|
|
324
|
+
/**
|
|
325
|
+
* @public
|
|
326
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
327
|
+
*/
|
|
328
|
+
function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
|
|
329
|
+
/* Excluded from this release type: $platformWrapGetFormState */
|
|
330
|
+
/**
|
|
331
|
+
* Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
|
|
332
|
+
* @public
|
|
333
|
+
*/
|
|
334
|
+
type ExecuteFunction<Config extends Record<string, unknown>> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
|
|
335
|
+
/**
|
|
336
|
+
* 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.
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
type GetFormStateFunction<Config extends Record<string, unknown>> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* import type { Extend } from '@stripe/extensibility-sdk/extensions';
|
|
346
|
+
* import type { Context } from '@stripe/extensibility-sdk/extensions';
|
|
347
|
+
*
|
|
348
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
349
|
+
* interface MyCustomActionConfig extends Record<string, unknown> {}
|
|
350
|
+
*
|
|
351
|
+
* export default class MyCustomAction implements Extend.Workflows
|
|
352
|
+
* .CustomAction<MyCustomActionConfig> {
|
|
353
|
+
* execute(
|
|
354
|
+
* _request: Extend.Workflows.CustomAction.ExecuteCustomActionRequest,
|
|
355
|
+
* _config: MyCustomActionConfig,
|
|
356
|
+
* _context: Context
|
|
357
|
+
* ) {
|
|
358
|
+
* // TODO: implement your action logic here
|
|
359
|
+
*
|
|
360
|
+
* return {};
|
|
361
|
+
* }
|
|
362
|
+
*
|
|
363
|
+
* getFormState(
|
|
364
|
+
* _request: Extend.Workflows.CustomAction.GetFormStateRequest,
|
|
365
|
+
* _config: MyCustomActionConfig,
|
|
366
|
+
* _context: Context
|
|
367
|
+
* ) {
|
|
368
|
+
* // TODO: implement your logic here
|
|
369
|
+
*
|
|
370
|
+
* return {
|
|
371
|
+
* values: {},
|
|
372
|
+
* config: {},
|
|
373
|
+
* };
|
|
374
|
+
* }
|
|
375
|
+
* }
|
|
376
|
+
*
|
|
377
|
+
* ```
|
|
378
|
+
* @public
|
|
379
|
+
*/
|
|
380
|
+
declare interface CustomAction_2<Config extends Record<string, unknown>> {
|
|
381
|
+
execute: CustomAction_2.ExecuteFunction<Config>;
|
|
382
|
+
getFormState?: CustomAction_2.GetFormStateFunction<Config>;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** @public */
|
|
386
|
+
declare namespace CustomerBalanceApplication {
|
|
387
|
+
/**
|
|
388
|
+
* The result of computing how much customer balance to apply to a bill.
|
|
389
|
+
* @public
|
|
390
|
+
*/
|
|
391
|
+
interface CustomerBalanceApplicationResult {
|
|
392
|
+
/** 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. */
|
|
393
|
+
appliedCustomerBalance: MonetaryAmount;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* The bill details provided as input to the customer balance application extension.
|
|
397
|
+
* @public
|
|
398
|
+
*/
|
|
399
|
+
interface CustomerBalanceApplicationInput {
|
|
400
|
+
/** The total amount of the invoice before applying any customer balance. */
|
|
401
|
+
totalAmount: MonetaryAmount;
|
|
402
|
+
/** The current customer balance available to apply. Positive values indicate debits (the customer owes money), negative values indicate credits. */
|
|
403
|
+
customerBalance: MonetaryAmount;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* @public
|
|
407
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
408
|
+
*/
|
|
409
|
+
function prepareArgsComputeAppliedCustomerBalance(proto: unknown): CustomerBalanceApplicationInput;
|
|
410
|
+
/**
|
|
411
|
+
* @public
|
|
412
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
413
|
+
*/
|
|
414
|
+
function prepareResultComputeAppliedCustomerBalance(result: CustomerBalanceApplicationResult): CustomerBalanceApplicationResult;
|
|
415
|
+
/* Excluded from this release type: $platformWrapComputeAppliedCustomerBalance */
|
|
416
|
+
/**
|
|
417
|
+
* @public
|
|
418
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
419
|
+
*/
|
|
420
|
+
const prepareArgs: typeof prepareArgsComputeAppliedCustomerBalance;
|
|
421
|
+
/**
|
|
422
|
+
* @public
|
|
423
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
424
|
+
*/
|
|
425
|
+
const prepareResult: typeof prepareResultComputeAppliedCustomerBalance;
|
|
426
|
+
/**
|
|
427
|
+
* 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.
|
|
428
|
+
* @public
|
|
429
|
+
*/
|
|
430
|
+
type ComputeAppliedCustomerBalanceFunction<Config extends Record<string, unknown>> = (request: CustomerBalanceApplicationInput, config: Config, context: Context) => CustomerBalanceApplicationResult;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* @example
|
|
435
|
+
* ```ts
|
|
436
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
|
|
437
|
+
*
|
|
438
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
439
|
+
* interface MyCustomerBalanceApplicationConfig extends Record<string, unknown> {}
|
|
440
|
+
*
|
|
441
|
+
* export default class MyCustomerBalanceApplication implements Billing.CustomerBalanceApplication<MyCustomerBalanceApplicationConfig> {
|
|
442
|
+
* computeAppliedCustomerBalance(
|
|
443
|
+
* request: Billing.CustomerBalanceApplication.CustomerBalanceApplicationInput,
|
|
444
|
+
* _config: MyCustomerBalanceApplicationConfig,
|
|
445
|
+
* _context: Context
|
|
446
|
+
* ) {
|
|
447
|
+
* // TODO: implement your customer balance logic here
|
|
448
|
+
*
|
|
449
|
+
* return {
|
|
450
|
+
* appliedCustomerBalance: request.customerBalance,
|
|
451
|
+
* };
|
|
452
|
+
* }
|
|
453
|
+
* }
|
|
454
|
+
*
|
|
455
|
+
* ```
|
|
456
|
+
* @public
|
|
457
|
+
*/
|
|
458
|
+
declare interface CustomerBalanceApplication<Config extends Record<string, unknown>> {
|
|
459
|
+
computeAppliedCustomerBalance: CustomerBalanceApplication.ComputeAppliedCustomerBalanceFunction<Config>;
|
|
460
|
+
}
|
|
461
|
+
|
|
64
462
|
/**
|
|
65
463
|
* Arbitrary-precision decimal type for billing calculations.
|
|
66
464
|
*
|
|
@@ -293,8 +691,236 @@ export declare const DecimalRoundingPresets: Readonly<{
|
|
|
293
691
|
*/
|
|
294
692
|
export declare const DEFAULT_DIV_PRECISION = 34;
|
|
295
693
|
|
|
694
|
+
/** @public */
|
|
695
|
+
declare namespace DiscountCalculation {
|
|
696
|
+
/** @public */
|
|
697
|
+
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';
|
|
698
|
+
/** @public */
|
|
699
|
+
type PricingTierMode = 'graduated' | 'volume';
|
|
700
|
+
/** @public */
|
|
701
|
+
type PriceType = 'one_time' | 'recurring';
|
|
702
|
+
/** @public */
|
|
703
|
+
type PricingScheme = 'per_unit' | 'tiered';
|
|
704
|
+
/** @public */
|
|
705
|
+
type UsageType = 'licensed' | 'metered';
|
|
706
|
+
/** @public */
|
|
707
|
+
type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
|
|
708
|
+
/**
|
|
709
|
+
* The result of a discount calculation.
|
|
710
|
+
* @public
|
|
711
|
+
*/
|
|
712
|
+
interface DiscountResult {
|
|
713
|
+
/** The computed discount to apply. */
|
|
714
|
+
discount: Discount;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* A discount to apply to a discountable item.
|
|
718
|
+
* @public
|
|
719
|
+
*/
|
|
720
|
+
interface Discount {
|
|
721
|
+
/** The discount amount to subtract from the discountable item. */
|
|
722
|
+
amount: MonetaryAmount;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* An item eligible for discount calculation, containing its line items and billing context.
|
|
726
|
+
* @public
|
|
727
|
+
*/
|
|
728
|
+
interface DiscountableItem {
|
|
729
|
+
/** The individual line items that make up the discountable item. */
|
|
730
|
+
lineItems: DiscountableLineItem[];
|
|
731
|
+
/** The total gross amount of the discountable item before any discounts. */
|
|
732
|
+
grossAmount: MonetaryAmount;
|
|
733
|
+
/** The customer associated with the discountable item. */
|
|
734
|
+
customer?: Customer;
|
|
735
|
+
/** The reason this item is being billed. */
|
|
736
|
+
billingReason?: BillingReason;
|
|
737
|
+
/** The subscription associated with the discountable item. */
|
|
738
|
+
subscription?: Subscription;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* The subscription associated with the discountable item.
|
|
742
|
+
* @public
|
|
743
|
+
*/
|
|
744
|
+
interface Subscription {
|
|
745
|
+
/** The unique identifier of the subscription. */
|
|
746
|
+
id: string;
|
|
747
|
+
/** The Unix timestamp of the billing cycle anchor. */
|
|
748
|
+
billingCycleAnchor?: number;
|
|
749
|
+
/** The structured billing cycle anchor configuration. */
|
|
750
|
+
billingCycleAnchorConfig?: BillingCycleAnchorConfig;
|
|
751
|
+
/** Custom key-value pairs attached to the subscription. */
|
|
752
|
+
metadata: Record<string, string>;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Configuration for the billing cycle anchor, specifying when recurring billing periods start.
|
|
756
|
+
* @public
|
|
757
|
+
*/
|
|
758
|
+
interface BillingCycleAnchorConfig {
|
|
759
|
+
/** The month component of the billing cycle anchor. */
|
|
760
|
+
month: number;
|
|
761
|
+
/** The day of the month for the billing cycle anchor. */
|
|
762
|
+
dayOfMonth: number;
|
|
763
|
+
/** The hour component of the billing cycle anchor. */
|
|
764
|
+
hour: number;
|
|
765
|
+
/** The minute component of the billing cycle anchor. */
|
|
766
|
+
minute: number;
|
|
767
|
+
/** The second component of the billing cycle anchor. */
|
|
768
|
+
second: number;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* The customer associated with the discountable item.
|
|
772
|
+
* @public
|
|
773
|
+
*/
|
|
774
|
+
interface Customer {
|
|
775
|
+
/** The unique identifier of the customer. */
|
|
776
|
+
id: string;
|
|
777
|
+
/** Custom key-value pairs attached to the customer. */
|
|
778
|
+
metadata: Record<string, string>;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* A single line item within a discountable item.
|
|
782
|
+
* @public
|
|
783
|
+
*/
|
|
784
|
+
interface DiscountableLineItem {
|
|
785
|
+
/** The subtotal amount of this line item. */
|
|
786
|
+
subtotal: MonetaryAmount;
|
|
787
|
+
/** The quantity of this line item. */
|
|
788
|
+
quantity?: Decimal;
|
|
789
|
+
/** The billing period this line item covers. */
|
|
790
|
+
period: AnyTimeRange;
|
|
791
|
+
/** The price information for this line item. */
|
|
792
|
+
price?: Price;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* The price associated with a line item.
|
|
796
|
+
* @public
|
|
797
|
+
*/
|
|
798
|
+
interface Price {
|
|
799
|
+
/** The unique identifier for the price. */
|
|
800
|
+
id: string;
|
|
801
|
+
/** The product this price belongs to. */
|
|
802
|
+
product?: Product;
|
|
803
|
+
/** The recurring pricing configuration, if applicable. */
|
|
804
|
+
recurring?: RecurringPrice;
|
|
805
|
+
/** The billing scheme, either per-unit or tiered. */
|
|
806
|
+
billingScheme?: PricingScheme;
|
|
807
|
+
/** The pricing tiers, applicable for tiered billing schemes. */
|
|
808
|
+
tiers: PriceTier[];
|
|
809
|
+
/** The price type, either one-time or recurring. */
|
|
810
|
+
type?: PriceType;
|
|
811
|
+
/** The tiering mode, either graduated or volume. */
|
|
812
|
+
tiersMode?: PricingTierMode;
|
|
813
|
+
/** Key-value metadata attached to the price. */
|
|
814
|
+
metadata: Record<string, string>;
|
|
815
|
+
/** The unit amount of the price. */
|
|
816
|
+
unitAmount?: Decimal;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* A tier within a tiered pricing structure.
|
|
820
|
+
* @public
|
|
821
|
+
*/
|
|
822
|
+
interface PriceTier {
|
|
823
|
+
/** The flat fee charged for this tier. */
|
|
824
|
+
flatAmount?: Decimal;
|
|
825
|
+
/** The per-unit price for this tier. */
|
|
826
|
+
unitAmount?: Decimal;
|
|
827
|
+
/** The upper bound of the tier range. */
|
|
828
|
+
upTo?: Decimal;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* The recurring pricing configuration for a price.
|
|
832
|
+
* @public
|
|
833
|
+
*/
|
|
834
|
+
interface RecurringPrice {
|
|
835
|
+
/** The billing interval for the recurring price. */
|
|
836
|
+
interval: RecurringPriceInterval;
|
|
837
|
+
/** The number of intervals between each billing cycle. */
|
|
838
|
+
intervalCount: number;
|
|
839
|
+
/** The usage type, either licensed or metered. */
|
|
840
|
+
usageType?: UsageType;
|
|
841
|
+
/** The identifier of the meter tracking usage for this price. */
|
|
842
|
+
meter?: string;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* The product associated with a price.
|
|
846
|
+
* @public
|
|
847
|
+
*/
|
|
848
|
+
interface Product {
|
|
849
|
+
/** The unique identifier of the product. */
|
|
850
|
+
id: string;
|
|
851
|
+
/** The name of the product. */
|
|
852
|
+
name: string;
|
|
853
|
+
/** Custom key-value pairs attached to the product. */
|
|
854
|
+
metadata: Record<string, string>;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* @public
|
|
858
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
859
|
+
*/
|
|
860
|
+
function prepareArgsComputeDiscounts(proto: unknown): DiscountableItem;
|
|
861
|
+
/**
|
|
862
|
+
* @public
|
|
863
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
864
|
+
*/
|
|
865
|
+
function prepareResultComputeDiscounts(result: DiscountResult): DiscountResult;
|
|
866
|
+
/* Excluded from this release type: $platformWrapComputeDiscounts */
|
|
867
|
+
/**
|
|
868
|
+
* @public
|
|
869
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
870
|
+
*/
|
|
871
|
+
const prepareArgs: typeof prepareArgsComputeDiscounts;
|
|
872
|
+
/**
|
|
873
|
+
* @public
|
|
874
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
875
|
+
*/
|
|
876
|
+
const prepareResult: typeof prepareResultComputeDiscounts;
|
|
877
|
+
/**
|
|
878
|
+
* Computes discount amounts for a discountable item and returns a discount result.
|
|
879
|
+
* @public
|
|
880
|
+
*/
|
|
881
|
+
type ComputeDiscountsFunction<Config extends Record<string, unknown>> = (request: DiscountableItem, config: Config, context: Context) => DiscountResult;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* @example
|
|
886
|
+
* ```ts
|
|
887
|
+
* import type { Billing } from '@stripe/extensibility-sdk/extensions';
|
|
888
|
+
* import type { Context } from '@stripe/extensibility-sdk/extensions';
|
|
889
|
+
*
|
|
890
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
891
|
+
* interface MyDiscountCalculationConfig extends Record<string, unknown> {}
|
|
892
|
+
*
|
|
893
|
+
* export default class MyDiscountCalculation implements Billing.Bill
|
|
894
|
+
* .DiscountCalculation<MyDiscountCalculationConfig> {
|
|
895
|
+
* computeDiscounts(
|
|
896
|
+
* request: Billing.Bill.DiscountCalculation.DiscountableItem,
|
|
897
|
+
* _config: MyDiscountCalculationConfig,
|
|
898
|
+
* _context: Context
|
|
899
|
+
* ) {
|
|
900
|
+
* // TODO: implement your discount logic here
|
|
901
|
+
*
|
|
902
|
+
* return {
|
|
903
|
+
* discount: { amount: request.grossAmount },
|
|
904
|
+
* };
|
|
905
|
+
* }
|
|
906
|
+
* }
|
|
907
|
+
*
|
|
908
|
+
* ```
|
|
909
|
+
* @public
|
|
910
|
+
*/
|
|
911
|
+
declare interface DiscountCalculation<Config extends Record<string, unknown>> {
|
|
912
|
+
computeDiscounts: DiscountCalculation.ComputeDiscountsFunction<Config>;
|
|
913
|
+
}
|
|
914
|
+
|
|
296
915
|
/* Excluded from this release type: _EnumSpec */
|
|
297
916
|
|
|
917
|
+
declare namespace Extend {
|
|
918
|
+
export {
|
|
919
|
+
Workflows_2 as Workflows
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
export { Extend }
|
|
923
|
+
|
|
298
924
|
/**
|
|
299
925
|
* Extracts the string literal type of the `object` property from T.
|
|
300
926
|
*
|
|
@@ -337,6 +963,117 @@ export declare const Integer: {
|
|
|
337
963
|
*/
|
|
338
964
|
export declare type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
|
|
339
965
|
|
|
966
|
+
/** @public */
|
|
967
|
+
declare namespace InvoiceCollectionSetting {
|
|
968
|
+
/** @public */
|
|
969
|
+
type ParentType = 'billing_cadence' | 'contract' | 'quote' | 'standalone' | 'subscription_schedule' | 'subscription';
|
|
970
|
+
/** @public */
|
|
971
|
+
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';
|
|
972
|
+
/** @public */
|
|
973
|
+
type CollectionMethod = 'charge_automatically' | 'send_invoice';
|
|
974
|
+
/**
|
|
975
|
+
* The result of the invoice collection settings override extension.
|
|
976
|
+
* @public
|
|
977
|
+
*/
|
|
978
|
+
interface InvoiceCollectionResponse {
|
|
979
|
+
/** Override the auto-advancement setting. Set to false to keep the invoice in draft. Return null to use the default. */
|
|
980
|
+
autoAdvance?: boolean;
|
|
981
|
+
}
|
|
982
|
+
/** @public */
|
|
983
|
+
type InvoiceCollectionRequest = ({
|
|
984
|
+
customer: Customer;
|
|
985
|
+
payer: 'customer';
|
|
986
|
+
} | {
|
|
987
|
+
otherPayer: string;
|
|
988
|
+
payer: 'other';
|
|
989
|
+
}) & {
|
|
990
|
+
collectionSettings: CollectionSettings;
|
|
991
|
+
parent: Parent;
|
|
992
|
+
};
|
|
993
|
+
/** @public */
|
|
994
|
+
interface Customer {
|
|
995
|
+
id: string;
|
|
996
|
+
metadata: Record<string, string>;
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* The parent resource that triggered the invoice creation.
|
|
1000
|
+
* @public
|
|
1001
|
+
*/
|
|
1002
|
+
interface Parent {
|
|
1003
|
+
/** The type of parent resource (for example, subscription or contract). */
|
|
1004
|
+
type: ParentType;
|
|
1005
|
+
/** Custom key-value pairs attached to the parent resource. */
|
|
1006
|
+
metadata: Record<string, string>;
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* The collection settings for an invoice.
|
|
1010
|
+
* @public
|
|
1011
|
+
*/
|
|
1012
|
+
interface CollectionSettings {
|
|
1013
|
+
/** Whether the invoice automatically advances through its lifecycle. */
|
|
1014
|
+
autoAdvance: boolean;
|
|
1015
|
+
/** The payment collection method: charge_automatically or send_invoice. */
|
|
1016
|
+
collectionMethod: CollectionMethod;
|
|
1017
|
+
/** The delay before the invoice is finalized, in hours. */
|
|
1018
|
+
finalizationGracePeriod: number;
|
|
1019
|
+
/** The payment methods configured for this invoice. */
|
|
1020
|
+
paymentMethods: PaymentMethodType[];
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* @public
|
|
1024
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1025
|
+
*/
|
|
1026
|
+
function prepareArgsCollectionOverride(proto: unknown): InvoiceCollectionRequest;
|
|
1027
|
+
/**
|
|
1028
|
+
* @public
|
|
1029
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1030
|
+
*/
|
|
1031
|
+
function prepareResultCollectionOverride(result: InvoiceCollectionResponse): InvoiceCollectionResponse;
|
|
1032
|
+
/* Excluded from this release type: $platformWrapCollectionOverride */
|
|
1033
|
+
/**
|
|
1034
|
+
* @public
|
|
1035
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1036
|
+
*/
|
|
1037
|
+
const prepareArgs: typeof prepareArgsCollectionOverride;
|
|
1038
|
+
/**
|
|
1039
|
+
* @public
|
|
1040
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1041
|
+
*/
|
|
1042
|
+
const prepareResult: typeof prepareResultCollectionOverride;
|
|
1043
|
+
/**
|
|
1044
|
+
* Overrides invoice collection settings before a draft invoice is created.
|
|
1045
|
+
* @public
|
|
1046
|
+
*/
|
|
1047
|
+
type CollectionOverrideFunction<Config extends Record<string, unknown>> = (request: InvoiceCollectionRequest, config: Config, context: Context) => InvoiceCollectionResponse;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```ts
|
|
1053
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
|
|
1054
|
+
*
|
|
1055
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
1056
|
+
* interface MyInvoiceCollectionSettingConfig extends Record<string, unknown> {}
|
|
1057
|
+
*
|
|
1058
|
+
* export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
|
|
1059
|
+
* collectionOverride(
|
|
1060
|
+
* _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
|
|
1061
|
+
* _config: MyInvoiceCollectionSettingConfig,
|
|
1062
|
+
* _context: Context
|
|
1063
|
+
* ) {
|
|
1064
|
+
* // TODO: implement your collection setting logic here
|
|
1065
|
+
*
|
|
1066
|
+
* return {};
|
|
1067
|
+
* }
|
|
1068
|
+
* }
|
|
1069
|
+
*
|
|
1070
|
+
* ```
|
|
1071
|
+
* @public
|
|
1072
|
+
*/
|
|
1073
|
+
declare interface InvoiceCollectionSetting<Config extends Record<string, unknown>> {
|
|
1074
|
+
collectionOverride: InvoiceCollectionSetting.CollectionOverrideFunction<Config>;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
340
1077
|
/**
|
|
341
1078
|
* Check whether a value is a `Decimal` instance.
|
|
342
1079
|
*
|
|
@@ -378,6 +1115,25 @@ export declare interface MonetaryAmount {
|
|
|
378
1115
|
|
|
379
1116
|
/* Excluded from this release type: _OneofFieldDescriptor */
|
|
380
1117
|
|
|
1118
|
+
/**
|
|
1119
|
+
* Represents a one-time event occurring at a specific date.
|
|
1120
|
+
* @public
|
|
1121
|
+
*/
|
|
1122
|
+
declare interface OneTime {
|
|
1123
|
+
/** The date and time of the event. */
|
|
1124
|
+
at: Date;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* Represents a percentage number value (0-100).
|
|
1129
|
+
* @format percent
|
|
1130
|
+
* @public
|
|
1131
|
+
*/
|
|
1132
|
+
export declare interface Percent {
|
|
1133
|
+
/** The percentage value. */
|
|
1134
|
+
value: number;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
381
1137
|
/**
|
|
382
1138
|
* A branded non-negative integer — a `number` guaranteed to be an integer ≥ 0.
|
|
383
1139
|
*
|
|
@@ -407,12 +1163,525 @@ export declare const PositiveInteger: {
|
|
|
407
1163
|
is: (value: number) => value is PositiveInteger;
|
|
408
1164
|
};
|
|
409
1165
|
|
|
1166
|
+
/** @public */
|
|
1167
|
+
declare namespace Prorations {
|
|
1168
|
+
/** @public */
|
|
1169
|
+
type PricingTierMode = 'graduated' | 'volume';
|
|
1170
|
+
/** @public */
|
|
1171
|
+
type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
|
|
1172
|
+
/** @public */
|
|
1173
|
+
type PriceType = 'one_time' | 'recurring';
|
|
1174
|
+
/** @public */
|
|
1175
|
+
type PricingScheme = 'per_unit' | 'tiered';
|
|
1176
|
+
/** @public */
|
|
1177
|
+
type UsageType = 'licensed' | 'metered';
|
|
1178
|
+
/** @public */
|
|
1179
|
+
type ItemType = 'credit' | 'debit';
|
|
1180
|
+
/**
|
|
1181
|
+
* The result of the prorations extension.
|
|
1182
|
+
* @public
|
|
1183
|
+
*/
|
|
1184
|
+
interface ProrateItemsResult {
|
|
1185
|
+
/** The items with computed proration factors. */
|
|
1186
|
+
items: ItemWithProration[];
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* An item with a computed proration factor.
|
|
1190
|
+
* @public
|
|
1191
|
+
*/
|
|
1192
|
+
interface ItemWithProration {
|
|
1193
|
+
/** The unique identifier of the item, matching a key from the input. */
|
|
1194
|
+
key: string;
|
|
1195
|
+
/** The computed proration factor. Positive for charges, negative for credits. */
|
|
1196
|
+
prorationFactor: Decimal;
|
|
1197
|
+
/** The displayed period for the invoice line item. */
|
|
1198
|
+
lineItemPeriod: TimeRange;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* The input to the prorations extension.
|
|
1202
|
+
* @public
|
|
1203
|
+
*/
|
|
1204
|
+
interface ProrateItemsInput {
|
|
1205
|
+
/** The list of items that can have their proration factor and line item period modified. */
|
|
1206
|
+
items: ProratableItem[];
|
|
1207
|
+
}
|
|
1208
|
+
/** @public */
|
|
1209
|
+
type ProratableItem = ({
|
|
1210
|
+
customPricingUnitOverageRate: CustomPricingUnitOverageRate;
|
|
1211
|
+
priceKind: 'customPricingUnitOverageRate';
|
|
1212
|
+
} | {
|
|
1213
|
+
licenseFee: LicenseFee;
|
|
1214
|
+
priceKind: 'licenseFee';
|
|
1215
|
+
} | {
|
|
1216
|
+
otherPriceKind: string;
|
|
1217
|
+
priceKind: 'other';
|
|
1218
|
+
} | {
|
|
1219
|
+
price: Price;
|
|
1220
|
+
priceKind: 'price';
|
|
1221
|
+
} | {
|
|
1222
|
+
priceKind: 'rateCardRate';
|
|
1223
|
+
rateCardRate: RateCardRate;
|
|
1224
|
+
}) & {
|
|
1225
|
+
correspondingDebit?: PreviousDebit;
|
|
1226
|
+
currentProrationFactor: Decimal;
|
|
1227
|
+
isProration: boolean;
|
|
1228
|
+
key: string;
|
|
1229
|
+
priceIntervalDuration: number;
|
|
1230
|
+
servicePeriod: TimeRange;
|
|
1231
|
+
type: ItemType;
|
|
1232
|
+
};
|
|
1233
|
+
/**
|
|
1234
|
+
* Information about a previous debit that a credit item offsets.
|
|
1235
|
+
* @public
|
|
1236
|
+
*/
|
|
1237
|
+
interface PreviousDebit {
|
|
1238
|
+
/** The service period of the corresponding debit. */
|
|
1239
|
+
servicePeriod: TimeRange;
|
|
1240
|
+
}
|
|
1241
|
+
/** @public */
|
|
1242
|
+
interface CustomPricingUnitOverageRate {
|
|
1243
|
+
id: string;
|
|
1244
|
+
metadata: Record<string, string>;
|
|
1245
|
+
rateCard: RateCard;
|
|
1246
|
+
customPricingUnit: string;
|
|
1247
|
+
unitAmount: Decimal;
|
|
1248
|
+
}
|
|
1249
|
+
/** @public */
|
|
1250
|
+
interface RateCard {
|
|
1251
|
+
id: string;
|
|
1252
|
+
currency: Currency;
|
|
1253
|
+
}
|
|
1254
|
+
/** @public */
|
|
1255
|
+
interface RateCardRate {
|
|
1256
|
+
id: string;
|
|
1257
|
+
metadata: Record<string, string>;
|
|
1258
|
+
rateCard: RateCard;
|
|
1259
|
+
tieringMode?: PricingTierMode;
|
|
1260
|
+
tiers: RateCardRateTier[];
|
|
1261
|
+
unitAmount?: Decimal;
|
|
1262
|
+
}
|
|
1263
|
+
/** @public */
|
|
1264
|
+
interface RateCardRateTier {
|
|
1265
|
+
flatAmount?: Decimal;
|
|
1266
|
+
unitAmount?: Decimal;
|
|
1267
|
+
upTo?: Decimal;
|
|
1268
|
+
}
|
|
1269
|
+
/** @public */
|
|
1270
|
+
interface LicenseFee {
|
|
1271
|
+
id: string;
|
|
1272
|
+
lookupKey?: string;
|
|
1273
|
+
metadata: Record<string, string>;
|
|
1274
|
+
serviceInterval: RecurringPriceInterval;
|
|
1275
|
+
serviceIntervalCount: number;
|
|
1276
|
+
tieringMode?: PricingTierMode;
|
|
1277
|
+
tiers: LicenseFeeTier[];
|
|
1278
|
+
currency: Currency;
|
|
1279
|
+
unitAmount?: Decimal;
|
|
1280
|
+
}
|
|
1281
|
+
/** @public */
|
|
1282
|
+
interface LicenseFeeTier {
|
|
1283
|
+
flatAmount?: Decimal;
|
|
1284
|
+
unitAmount?: Decimal;
|
|
1285
|
+
upTo?: Decimal;
|
|
1286
|
+
}
|
|
1287
|
+
/** @public */
|
|
1288
|
+
interface Price {
|
|
1289
|
+
id: string;
|
|
1290
|
+
product: Product;
|
|
1291
|
+
recurring?: RecurringPrice;
|
|
1292
|
+
billingScheme: PricingScheme;
|
|
1293
|
+
tiers: PriceTier[];
|
|
1294
|
+
type: PriceType;
|
|
1295
|
+
tiersMode?: PricingTierMode;
|
|
1296
|
+
metadata: Record<string, string>;
|
|
1297
|
+
currency: Currency;
|
|
1298
|
+
unitAmount?: Decimal;
|
|
1299
|
+
}
|
|
1300
|
+
/** @public */
|
|
1301
|
+
interface PriceTier {
|
|
1302
|
+
flatAmount?: Decimal;
|
|
1303
|
+
unitAmount?: Decimal;
|
|
1304
|
+
upTo?: number;
|
|
1305
|
+
}
|
|
1306
|
+
/** @public */
|
|
1307
|
+
interface RecurringPrice {
|
|
1308
|
+
interval: RecurringPriceInterval;
|
|
1309
|
+
intervalCount: number;
|
|
1310
|
+
usageType?: UsageType;
|
|
1311
|
+
meter?: string;
|
|
1312
|
+
}
|
|
1313
|
+
/** @public */
|
|
1314
|
+
interface Product {
|
|
1315
|
+
id: string;
|
|
1316
|
+
name: string;
|
|
1317
|
+
metadata: Record<string, string>;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* @public
|
|
1321
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1322
|
+
*/
|
|
1323
|
+
function prepareArgsProrateItems(proto: unknown): ProrateItemsInput;
|
|
1324
|
+
/**
|
|
1325
|
+
* @public
|
|
1326
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1327
|
+
*/
|
|
1328
|
+
function prepareResultProrateItems(result: ProrateItemsResult): ProrateItemsResult;
|
|
1329
|
+
/* Excluded from this release type: $platformWrapProrateItems */
|
|
1330
|
+
/**
|
|
1331
|
+
* @public
|
|
1332
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1333
|
+
*/
|
|
1334
|
+
const prepareArgs: typeof prepareArgsProrateItems;
|
|
1335
|
+
/**
|
|
1336
|
+
* @public
|
|
1337
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1338
|
+
*/
|
|
1339
|
+
const prepareResult: typeof prepareResultProrateItems;
|
|
1340
|
+
/**
|
|
1341
|
+
* 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.
|
|
1342
|
+
* @public
|
|
1343
|
+
*/
|
|
1344
|
+
type ProrateItemsFunction<Config extends Record<string, unknown>> = (request: ProrateItemsInput, config: Config, context: Context) => ProrateItemsResult;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* @example
|
|
1349
|
+
* ```ts
|
|
1350
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
|
|
1351
|
+
*
|
|
1352
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
1353
|
+
* interface MyProrationsConfig extends Record<string, unknown> {}
|
|
1354
|
+
*
|
|
1355
|
+
* export default class MyProrations implements Billing.Prorations<MyProrationsConfig> {
|
|
1356
|
+
* prorateItems(
|
|
1357
|
+
* _request: Billing.Prorations.ProrateItemsInput,
|
|
1358
|
+
* _config: MyProrationsConfig,
|
|
1359
|
+
* _context: Context
|
|
1360
|
+
* ) {
|
|
1361
|
+
* // TODO: implement your proration logic here
|
|
1362
|
+
*
|
|
1363
|
+
* return {
|
|
1364
|
+
* items: [],
|
|
1365
|
+
* };
|
|
1366
|
+
* }
|
|
1367
|
+
* }
|
|
1368
|
+
*
|
|
1369
|
+
* ```
|
|
1370
|
+
* @public
|
|
1371
|
+
*/
|
|
1372
|
+
declare interface Prorations<Config extends Record<string, unknown>> {
|
|
1373
|
+
prorateItems: Prorations.ProrateItemsFunction<Config>;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
410
1376
|
/* Excluded from this release type: _ProtoEnum */
|
|
411
1377
|
|
|
412
1378
|
/* Excluded from this release type: _ProtoWireToType */
|
|
413
1379
|
|
|
414
1380
|
/* Excluded from this release type: _ProtoWireToTypeStrategy */
|
|
415
1381
|
|
|
1382
|
+
/** @public */
|
|
1383
|
+
declare namespace RecurringBillingItemHandling {
|
|
1384
|
+
/** @public */
|
|
1385
|
+
type PricingTierMode = 'graduated' | 'volume';
|
|
1386
|
+
/** @public */
|
|
1387
|
+
type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
|
|
1388
|
+
/** @public */
|
|
1389
|
+
type PriceType = 'one_time' | 'recurring';
|
|
1390
|
+
/** @public */
|
|
1391
|
+
type PricingScheme = 'per_unit' | 'tiered';
|
|
1392
|
+
/** @public */
|
|
1393
|
+
type UsageType = 'licensed' | 'metered';
|
|
1394
|
+
/** @public */
|
|
1395
|
+
type ItemType = 'credit' | 'debit';
|
|
1396
|
+
/**
|
|
1397
|
+
* The result of the group items extension.
|
|
1398
|
+
* @public
|
|
1399
|
+
*/
|
|
1400
|
+
interface GroupItemsResult {
|
|
1401
|
+
/** The groups of items, each corresponding to a separate invoice. */
|
|
1402
|
+
groups: ItemGroup[];
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* A group of items to place on a single invoice.
|
|
1406
|
+
* @public
|
|
1407
|
+
*/
|
|
1408
|
+
interface ItemGroup {
|
|
1409
|
+
/** The items in this group. */
|
|
1410
|
+
items: GroupedItem[];
|
|
1411
|
+
/** Whether this group sets the latest invoice reference on the subscription. */
|
|
1412
|
+
setsLatestInvoice: boolean;
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* An item assigned to a group.
|
|
1416
|
+
* @public
|
|
1417
|
+
*/
|
|
1418
|
+
interface GroupedItem {
|
|
1419
|
+
/** The unique identifier of the item, matching a key from the input. */
|
|
1420
|
+
key: string;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* The input to the group items extension.
|
|
1424
|
+
* @public
|
|
1425
|
+
*/
|
|
1426
|
+
interface GroupItemsInput {
|
|
1427
|
+
/** The list of items to group across invoices. */
|
|
1428
|
+
items: Item[];
|
|
1429
|
+
}
|
|
1430
|
+
/** @public */
|
|
1431
|
+
type Item = ({
|
|
1432
|
+
customPricingUnitOverageRate: CustomPricingUnitOverageRate;
|
|
1433
|
+
priceKind: 'customPricingUnitOverageRate';
|
|
1434
|
+
} | {
|
|
1435
|
+
licenseFee: LicenseFee;
|
|
1436
|
+
priceKind: 'licenseFee';
|
|
1437
|
+
} | {
|
|
1438
|
+
otherPriceKind: string;
|
|
1439
|
+
priceKind: 'other';
|
|
1440
|
+
} | {
|
|
1441
|
+
price: Price;
|
|
1442
|
+
priceKind: 'price';
|
|
1443
|
+
} | {
|
|
1444
|
+
priceKind: 'rateCardRate';
|
|
1445
|
+
rateCardRate: RateCardRate;
|
|
1446
|
+
}) & {
|
|
1447
|
+
isProration: boolean;
|
|
1448
|
+
key: string;
|
|
1449
|
+
prorationFactor: Decimal;
|
|
1450
|
+
servicePeriod: AnyTimeRange;
|
|
1451
|
+
type: ItemType;
|
|
1452
|
+
};
|
|
1453
|
+
/** @public */
|
|
1454
|
+
interface CustomPricingUnitOverageRate {
|
|
1455
|
+
id: string;
|
|
1456
|
+
metadata: Record<string, string>;
|
|
1457
|
+
rateCard: RateCard;
|
|
1458
|
+
customPricingUnit: string;
|
|
1459
|
+
unitAmount: Decimal;
|
|
1460
|
+
}
|
|
1461
|
+
/** @public */
|
|
1462
|
+
interface RateCard {
|
|
1463
|
+
id: string;
|
|
1464
|
+
currency: Currency;
|
|
1465
|
+
}
|
|
1466
|
+
/** @public */
|
|
1467
|
+
interface RateCardRate {
|
|
1468
|
+
id: string;
|
|
1469
|
+
metadata: Record<string, string>;
|
|
1470
|
+
rateCard: RateCard;
|
|
1471
|
+
tieringMode?: PricingTierMode;
|
|
1472
|
+
tiers: RateCardRateTier[];
|
|
1473
|
+
unitAmount?: Decimal;
|
|
1474
|
+
}
|
|
1475
|
+
/** @public */
|
|
1476
|
+
interface RateCardRateTier {
|
|
1477
|
+
flatAmount?: Decimal;
|
|
1478
|
+
unitAmount?: Decimal;
|
|
1479
|
+
upTo?: Decimal;
|
|
1480
|
+
}
|
|
1481
|
+
/** @public */
|
|
1482
|
+
interface LicenseFee {
|
|
1483
|
+
id: string;
|
|
1484
|
+
lookupKey?: string;
|
|
1485
|
+
metadata: Record<string, string>;
|
|
1486
|
+
serviceInterval: RecurringPriceInterval;
|
|
1487
|
+
serviceIntervalCount: number;
|
|
1488
|
+
tieringMode?: PricingTierMode;
|
|
1489
|
+
tiers: LicenseFeeTier[];
|
|
1490
|
+
currency: Currency;
|
|
1491
|
+
unitAmount?: Decimal;
|
|
1492
|
+
}
|
|
1493
|
+
/** @public */
|
|
1494
|
+
interface LicenseFeeTier {
|
|
1495
|
+
flatAmount?: Decimal;
|
|
1496
|
+
unitAmount?: Decimal;
|
|
1497
|
+
upTo?: Decimal;
|
|
1498
|
+
}
|
|
1499
|
+
/** @public */
|
|
1500
|
+
interface Price {
|
|
1501
|
+
id: string;
|
|
1502
|
+
product: Product;
|
|
1503
|
+
recurring?: RecurringPrice;
|
|
1504
|
+
billingScheme: PricingScheme;
|
|
1505
|
+
tiers: PriceTier[];
|
|
1506
|
+
type: PriceType;
|
|
1507
|
+
tiersMode?: PricingTierMode;
|
|
1508
|
+
metadata: Record<string, string>;
|
|
1509
|
+
currency: Currency;
|
|
1510
|
+
unitAmount?: Decimal;
|
|
1511
|
+
}
|
|
1512
|
+
/** @public */
|
|
1513
|
+
interface PriceTier {
|
|
1514
|
+
flatAmount?: Decimal;
|
|
1515
|
+
unitAmount?: Decimal;
|
|
1516
|
+
upTo?: number;
|
|
1517
|
+
}
|
|
1518
|
+
/** @public */
|
|
1519
|
+
interface RecurringPrice {
|
|
1520
|
+
interval: RecurringPriceInterval;
|
|
1521
|
+
intervalCount: number;
|
|
1522
|
+
usageType?: UsageType;
|
|
1523
|
+
meter?: string;
|
|
1524
|
+
}
|
|
1525
|
+
/** @public */
|
|
1526
|
+
interface Product {
|
|
1527
|
+
id: string;
|
|
1528
|
+
name: string;
|
|
1529
|
+
metadata: Record<string, string>;
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* The result of the filter items extension.
|
|
1533
|
+
* @public
|
|
1534
|
+
*/
|
|
1535
|
+
interface FilterItemsResult {
|
|
1536
|
+
/** The items to include on the invoice. */
|
|
1537
|
+
items: ItemToInvoice[];
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* An item selected for inclusion on the invoice.
|
|
1541
|
+
* @public
|
|
1542
|
+
*/
|
|
1543
|
+
interface ItemToInvoice {
|
|
1544
|
+
/** The unique identifier of the item, matching a key from the input. */
|
|
1545
|
+
key: string;
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* The input to the filter items extension.
|
|
1549
|
+
* @public
|
|
1550
|
+
*/
|
|
1551
|
+
interface FilterItemsInput {
|
|
1552
|
+
/** The list of items to evaluate for inclusion on the invoice. */
|
|
1553
|
+
items: Item[];
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* The result of the before item creation extension.
|
|
1557
|
+
* @public
|
|
1558
|
+
*/
|
|
1559
|
+
interface BeforeItemCreationResult {
|
|
1560
|
+
/** The items with their creation strategies. */
|
|
1561
|
+
items: ItemWithCreationStrategy[];
|
|
1562
|
+
}
|
|
1563
|
+
/** @public */
|
|
1564
|
+
type ItemWithCreationStrategy = ({
|
|
1565
|
+
creationStrategy: 'other';
|
|
1566
|
+
otherCreationStrategy: string;
|
|
1567
|
+
} | { creationStrategy: 'doNotCreate' } | { creationStrategy: 'invoice' }) & { key: string };
|
|
1568
|
+
/** @public */
|
|
1569
|
+
type Invoice = Record<string, never>;
|
|
1570
|
+
/** @public */
|
|
1571
|
+
type DoNotCreate = Record<string, never>;
|
|
1572
|
+
/**
|
|
1573
|
+
* The input to the before item creation extension.
|
|
1574
|
+
* @public
|
|
1575
|
+
*/
|
|
1576
|
+
interface BeforeItemCreationInput {
|
|
1577
|
+
/** The list of items to evaluate for creation. */
|
|
1578
|
+
items: Item[];
|
|
1579
|
+
}
|
|
1580
|
+
/**
|
|
1581
|
+
* @public
|
|
1582
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1583
|
+
*/
|
|
1584
|
+
function prepareArgsBeforeItemCreation(proto: unknown): BeforeItemCreationInput;
|
|
1585
|
+
/**
|
|
1586
|
+
* @public
|
|
1587
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1588
|
+
*/
|
|
1589
|
+
function prepareResultBeforeItemCreation(result: BeforeItemCreationResult): BeforeItemCreationResult;
|
|
1590
|
+
/* Excluded from this release type: $platformWrapBeforeItemCreation */
|
|
1591
|
+
/**
|
|
1592
|
+
* @public
|
|
1593
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1594
|
+
*/
|
|
1595
|
+
function prepareArgsFilterItems(proto: unknown): FilterItemsInput;
|
|
1596
|
+
/**
|
|
1597
|
+
* @public
|
|
1598
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1599
|
+
*/
|
|
1600
|
+
function prepareResultFilterItems(result: FilterItemsResult): FilterItemsResult;
|
|
1601
|
+
/* Excluded from this release type: $platformWrapFilterItems */
|
|
1602
|
+
/**
|
|
1603
|
+
* @public
|
|
1604
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1605
|
+
*/
|
|
1606
|
+
function prepareArgsGroupItems(proto: unknown): GroupItemsInput;
|
|
1607
|
+
/**
|
|
1608
|
+
* @public
|
|
1609
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
1610
|
+
*/
|
|
1611
|
+
function prepareResultGroupItems(result: GroupItemsResult): GroupItemsResult;
|
|
1612
|
+
/* Excluded from this release type: $platformWrapGroupItems */
|
|
1613
|
+
/**
|
|
1614
|
+
* Runs before invoice items are created. Decides whether each item should be created or skipped.
|
|
1615
|
+
* @public
|
|
1616
|
+
*/
|
|
1617
|
+
type BeforeItemCreationFunction<Config extends Record<string, unknown>> = (request: BeforeItemCreationInput, config: Config, context: Context) => BeforeItemCreationResult;
|
|
1618
|
+
/**
|
|
1619
|
+
* Runs before invoices are created. Decides which items to include on the invoice. Items not included are deferred as pending invoice items.
|
|
1620
|
+
* @public
|
|
1621
|
+
*/
|
|
1622
|
+
type FilterItemsFunction<Config extends Record<string, unknown>> = (request: FilterItemsInput, config: Config, context: Context) => FilterItemsResult;
|
|
1623
|
+
/**
|
|
1624
|
+
* Runs before invoices are created. Decides how items are grouped across one or more invoices.
|
|
1625
|
+
* @public
|
|
1626
|
+
*/
|
|
1627
|
+
type GroupItemsFunction<Config extends Record<string, unknown>> = (request: GroupItemsInput, config: Config, context: Context) => GroupItemsResult;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* @example
|
|
1632
|
+
* ```ts
|
|
1633
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
|
|
1634
|
+
*
|
|
1635
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
1636
|
+
* interface MyRecurringBillingItemHandlingConfig extends Record<string, unknown> {}
|
|
1637
|
+
*
|
|
1638
|
+
* export default class MyRecurringBillingItemHandling implements Billing.RecurringBillingItemHandling<MyRecurringBillingItemHandlingConfig> {
|
|
1639
|
+
* beforeItemCreation(
|
|
1640
|
+
* _request: Billing.RecurringBillingItemHandling.BeforeItemCreationInput,
|
|
1641
|
+
* _config: MyRecurringBillingItemHandlingConfig,
|
|
1642
|
+
* _context: Context
|
|
1643
|
+
* ) {
|
|
1644
|
+
* // TODO: implement your before-item-creation logic here
|
|
1645
|
+
*
|
|
1646
|
+
* return {
|
|
1647
|
+
* items: [],
|
|
1648
|
+
* };
|
|
1649
|
+
* }
|
|
1650
|
+
*
|
|
1651
|
+
* filterItems(
|
|
1652
|
+
* _request: Billing.RecurringBillingItemHandling.FilterItemsInput,
|
|
1653
|
+
* _config: MyRecurringBillingItemHandlingConfig,
|
|
1654
|
+
* _context: Context
|
|
1655
|
+
* ) {
|
|
1656
|
+
* // TODO: implement your filter-items logic here
|
|
1657
|
+
*
|
|
1658
|
+
* return {
|
|
1659
|
+
* items: [],
|
|
1660
|
+
* };
|
|
1661
|
+
* }
|
|
1662
|
+
*
|
|
1663
|
+
* groupItems(
|
|
1664
|
+
* _request: Billing.RecurringBillingItemHandling.GroupItemsInput,
|
|
1665
|
+
* _config: MyRecurringBillingItemHandlingConfig,
|
|
1666
|
+
* _context: Context
|
|
1667
|
+
* ) {
|
|
1668
|
+
* // TODO: implement your group-items logic here
|
|
1669
|
+
*
|
|
1670
|
+
* return {
|
|
1671
|
+
* groups: [],
|
|
1672
|
+
* };
|
|
1673
|
+
* }
|
|
1674
|
+
* }
|
|
1675
|
+
*
|
|
1676
|
+
* ```
|
|
1677
|
+
* @public
|
|
1678
|
+
*/
|
|
1679
|
+
declare interface RecurringBillingItemHandling<Config extends Record<string, unknown>> {
|
|
1680
|
+
beforeItemCreation: RecurringBillingItemHandling.BeforeItemCreationFunction<Config>;
|
|
1681
|
+
filterItems: RecurringBillingItemHandling.FilterItemsFunction<Config>;
|
|
1682
|
+
groupItems: RecurringBillingItemHandling.GroupItemsFunction<Config>;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
416
1685
|
/**
|
|
417
1686
|
* Object reference — a typed pointer to another API resource.
|
|
418
1687
|
*
|
|
@@ -482,6 +1751,17 @@ export declare const StreetAddress: { create: (address: string) => StreetAddress
|
|
|
482
1751
|
/** The type of the opaque Stripe type-tag symbol used in SDK scalar types. @public */
|
|
483
1752
|
export declare type StripeTypeSymbol = typeof __stripeType;
|
|
484
1753
|
|
|
1754
|
+
/**
|
|
1755
|
+
* Represents a time period with start and end dates.
|
|
1756
|
+
* @public
|
|
1757
|
+
*/
|
|
1758
|
+
declare interface TimeRange {
|
|
1759
|
+
/** The beginning date of the range. */
|
|
1760
|
+
startDate: Date;
|
|
1761
|
+
/** The ending date of the range. */
|
|
1762
|
+
endDate: Date;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
485
1765
|
/** A branded string representing an ISO 8601 datetime. @public */
|
|
486
1766
|
export declare type Timestamp = {
|
|
487
1767
|
readonly [__brand]: 'Timestamp';
|
|
@@ -539,4 +1819,16 @@ export declare class WireWriteError extends Error {
|
|
|
539
1819
|
/* Excluded from this release type: name */
|
|
540
1820
|
}
|
|
541
1821
|
|
|
1822
|
+
declare namespace Workflows {
|
|
1823
|
+
export {
|
|
1824
|
+
CustomAction
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
declare namespace Workflows_2 {
|
|
1829
|
+
export {
|
|
1830
|
+
CustomAction_2 as CustomAction
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
|
|
542
1834
|
export { }
|