@stripe/extensibility-sdk 0.26.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +29 -4
  2. package/dist/extensibility-sdk-alpha.d.ts +83 -58
  3. package/dist/extensibility-sdk-beta.d.ts +83 -58
  4. package/dist/extensibility-sdk-extensions-alpha.d.ts +82 -54
  5. package/dist/extensibility-sdk-extensions-beta.d.ts +82 -54
  6. package/dist/extensibility-sdk-extensions-internal.d.ts +82 -54
  7. package/dist/extensibility-sdk-extensions-public.d.ts +82 -54
  8. package/dist/extensibility-sdk-internal.d.ts +83 -58
  9. package/dist/extensibility-sdk-public.d.ts +83 -58
  10. package/dist/extensions/billing/index.d.ts +1 -1
  11. package/dist/extensions/billing/invoice_collection_options.d.ts +111 -0
  12. package/dist/extensions/billing/invoice_collection_options.d.ts.map +1 -0
  13. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +43 -0
  14. package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -1
  15. package/dist/extensions/index.cjs +111 -52
  16. package/dist/extensions/index.js +111 -52
  17. package/dist/index.cjs +103 -56
  18. package/dist/index.js +103 -55
  19. package/dist/internal.cjs +7 -7
  20. package/dist/internal.js +7 -7
  21. package/dist/stdlib/decimal.d.ts +1 -1
  22. package/dist/stdlib/index.d.ts +1 -5
  23. package/dist/stdlib/index.d.ts.map +1 -1
  24. package/dist/stdlib/refs.d.ts +0 -8
  25. package/dist/stdlib/refs.d.ts.map +1 -1
  26. package/dist/stdlib/scalars.d.ts +0 -4
  27. package/dist/stdlib/scalars.d.ts.map +1 -1
  28. package/dist/stdlib/to-const.d.ts +1 -1
  29. package/dist/tsconfig.build.tsbuildinfo +1 -1
  30. package/package.json +2 -10
  31. package/dist/extensibility-sdk-stdlib-alpha.d.ts +0 -579
  32. package/dist/extensibility-sdk-stdlib-beta.d.ts +0 -579
  33. package/dist/extensibility-sdk-stdlib-internal.d.ts +0 -971
  34. package/dist/extensibility-sdk-stdlib-public.d.ts +0 -579
  35. package/dist/extensions/billing/invoice_collection_setting.d.ts +0 -117
  36. package/dist/extensions/billing/invoice_collection_setting.d.ts.map +0 -1
  37. package/dist/stdlib/index.cjs +0 -1754
  38. package/dist/stdlib/index.js +0 -1697
package/README.md CHANGED
@@ -10,8 +10,8 @@ transformation framework used by the platform dispatcher.
10
10
 
11
11
  | Import path | Use for |
12
12
  | ----------------------------------------- | ------------------------------------------------ |
13
+ | `@stripe/extensibility-sdk` | `Decimal`, scalar types, `Ref`, wire errors |
13
14
  | `@stripe/extensibility-sdk/extensions` | Implementing extension interfaces |
14
- | `@stripe/extensibility-sdk/stdlib` | `Decimal`, scalar types, `Ref`, wire errors |
15
15
  | `@stripe/extensibility-sdk/internal` | Internal registry metadata (used by build tools) |
16
16
  | `@stripe/extensibility-sdk/jsonschema` | JSON Schema types and helpers |
17
17
  | `@stripe/extensibility-sdk/config-values` | Configuration value types and helpers |
@@ -259,7 +259,7 @@ Arbitrary-precision decimal arithmetic backed by `big.js`. All monetary values i
259
259
  extension interface requests and responses use `Decimal`.
260
260
 
261
261
  ```typescript
262
- import { Decimal } from '@stripe/extensibility-sdk/stdlib';
262
+ import { Decimal } from '@stripe/extensibility-sdk';
263
263
 
264
264
  const a = Decimal.from('10.50');
265
265
  const b = Decimal.from(3);
@@ -316,9 +316,34 @@ const qty = PositiveInteger.from(3, 'round-down'); // PositiveInteger
316
316
  A typed reference to a Stripe object (ID + optional resolved value).
317
317
 
318
318
  ```typescript
319
- import { Ref } from '@stripe/extensibility-sdk/stdlib';
319
+ import type { Ref } from '@stripe/extensibility-sdk';
320
+ import type { Customer } from '@stripe/extensibility-api-objects';
320
321
 
321
- type CustomerRef = Ref<{ id: string; name: string }>;
322
+ type CustomerRef = Ref<Customer>;
323
+ ```
324
+
325
+ ---
326
+
327
+ ### Wire errors
328
+
329
+ Thrown by the platform dispatch wrapper when wire-format data is invalid.
330
+
331
+ | Class | When thrown |
332
+ | ---------------- | --------------------------------------------------------- |
333
+ | `WireReadError` | Invalid or missing field in the **incoming** wire request |
334
+ | `WireWriteError` | Invalid or missing field in the **outgoing** SDK response |
335
+
336
+ ```typescript
337
+ import { WireReadError, WireWriteError } from '@stripe/extensibility-sdk';
338
+ ```
339
+
340
+ In production, the platform catches and surfaces these as structured errors. In tests,
341
+ assert against them directly by invoking the generated interface-specific
342
+ `$platformWrap...` helper for the interface under test. For example:
343
+
344
+ ```typescript
345
+ // Pseudocode: replace `$platformWrap...` with the generated wrapper for your interface.
346
+ expect(() => $platformWrap...(MyImpl, badInput, {}, ctx)).toThrow(WireReadError);
322
347
  ```
323
348
 
324
349
  ---
@@ -91,7 +91,7 @@ declare namespace Bill {
91
91
  declare namespace Billing {
92
92
  export {
93
93
  CustomerBalanceApplication,
94
- InvoiceCollectionSetting,
94
+ InvoiceCollectionOptions,
95
95
  Prorations,
96
96
  RecurringBillingItemHandling,
97
97
  Bill,
@@ -495,7 +495,7 @@ declare interface CustomerBalanceApplication<Config> {
495
495
  *
496
496
  * @example
497
497
  * ```ts
498
- * import { Decimal, RoundDirection } from '@stripe/extensibility-sdk/stdlib';
498
+ * import { Decimal, RoundDirection } from '@stripe/extensibility-sdk';
499
499
  *
500
500
  * const price = Decimal.from('19.99');
501
501
  * const tax = price.mul(Decimal.from('0.0825'));
@@ -1034,58 +1034,65 @@ export declare interface IntegerCompanion {
1034
1034
  export declare type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
1035
1035
 
1036
1036
  /** @public */
1037
- declare namespace InvoiceCollectionSetting {
1037
+ declare namespace InvoiceCollectionOptions {
1038
1038
  /** @public */
1039
- type ParentType = 'billing_cadence' | 'contract' | 'quote' | 'standalone' | 'subscription_schedule' | 'subscription';
1040
- /** @public */
1041
- 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';
1039
+ type PaymentMethodType = 'ach_credit_transfer' | 'ach_debit' | 'affirm' | 'afterpay_clearpay' | 'alipay' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' | 'blik' | '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';
1042
1040
  /** @public */
1043
1041
  type CollectionMethod = 'charge_automatically' | 'send_invoice';
1044
1042
  /**
1045
- * The result of the invoice collection settings override extension.
1043
+ * The result of the invoice collection options override extension.
1046
1044
  * @public
1047
1045
  */
1048
- interface InvoiceCollectionResponse {
1046
+ interface InvoiceCollectionOptionsResult {
1049
1047
  /** Override the auto-advancement setting. Set to false to keep the invoice in draft. Return null to use the default. */
1050
1048
  autoAdvance?: boolean;
1051
1049
  }
1052
1050
  /** @public */
1053
- type InvoiceCollectionRequest = ({
1051
+ type InvoiceCollectionOptionsInput = ({
1054
1052
  customer: Customer;
1055
1053
  payer: 'customer';
1056
1054
  } | {
1057
1055
  otherPayer: string;
1058
1056
  payer: 'other';
1059
- }) & {
1060
- collectionSettings: CollectionSettings;
1061
- parent: Parent;
1062
- };
1057
+ }) & ({
1058
+ invoiceParentType: 'other';
1059
+ otherInvoiceParentType: string;
1060
+ } | {
1061
+ invoiceParentType: 'subscription';
1062
+ subscription: SubscriptionParent;
1063
+ } | { invoiceParentType: 'cadence' } | { invoiceParentType: 'contract' } | { invoiceParentType: 'quote' } | { invoiceParentType: 'schedule' }) & { collectionOptions: CollectionOptions };
1063
1064
  /** @public */
1064
1065
  interface Customer {
1065
1066
  id: string;
1066
1067
  metadata: Record<string, string>;
1067
1068
  }
1069
+ /** @public */
1070
+ type ContractParent = Record<string, never>;
1068
1071
  /**
1069
- * The parent resource that triggered the invoice creation.
1072
+ * The Subscription that triggered the invoice creation.
1070
1073
  * @public
1071
1074
  */
1072
- interface Parent {
1073
- /** The type of parent resource (for example, subscription or contract). */
1074
- type: ParentType;
1075
- /** Custom key-value pairs attached to the parent resource. */
1075
+ interface SubscriptionParent {
1076
+ /** The unique identifier for the subscription. */
1077
+ id: string;
1078
+ /** The metadata of the subscription. */
1076
1079
  metadata: Record<string, string>;
1077
1080
  }
1081
+ /** @public */
1082
+ type ScheduleParent = Record<string, never>;
1083
+ /** @public */
1084
+ type QuoteParent = Record<string, never>;
1085
+ /** @public */
1086
+ type CadenceParent = Record<string, never>;
1078
1087
  /**
1079
- * The collection settings for an invoice.
1088
+ * The collection options for an invoice.
1080
1089
  * @public
1081
1090
  */
1082
- interface CollectionSettings {
1091
+ interface CollectionOptions {
1083
1092
  /** Whether the invoice automatically advances through its lifecycle. */
1084
1093
  autoAdvance: boolean;
1085
1094
  /** The payment collection method: charge_automatically or send_invoice. */
1086
1095
  collectionMethod: CollectionMethod;
1087
- /** The delay before the invoice is finalized, in hours. */
1088
- finalizationGracePeriod: number;
1089
1096
  /** The payment methods configured for this invoice. */
1090
1097
  paymentMethods: PaymentMethodType[];
1091
1098
  }
@@ -1093,55 +1100,33 @@ declare namespace InvoiceCollectionSetting {
1093
1100
  * @public
1094
1101
  * @deprecated Platform dispatch handles wire/SDK conversion.
1095
1102
  */
1096
- function prepareArgsCollectionOverride(proto: unknown): InvoiceCollectionRequest;
1103
+ function prepareArgsOverrideOptions(proto: unknown): InvoiceCollectionOptionsInput;
1097
1104
  /**
1098
1105
  * @public
1099
1106
  * @deprecated Platform dispatch handles wire/SDK conversion.
1100
1107
  */
1101
- function prepareResultCollectionOverride(result: InvoiceCollectionResponse): InvoiceCollectionResponse;
1102
- /* Excluded from this release type: $platformWrapCollectionOverride */
1108
+ function prepareResultOverrideOptions(result: InvoiceCollectionOptionsResult): InvoiceCollectionOptionsResult;
1109
+ /* Excluded from this release type: $platformWrapOverrideOptions */
1103
1110
  /**
1104
1111
  * @public
1105
1112
  * @deprecated Platform dispatch handles wire/SDK conversion.
1106
1113
  */
1107
- const prepareArgs: typeof prepareArgsCollectionOverride;
1114
+ const prepareArgs: typeof prepareArgsOverrideOptions;
1108
1115
  /**
1109
1116
  * @public
1110
1117
  * @deprecated Platform dispatch handles wire/SDK conversion.
1111
1118
  */
1112
- const prepareResult: typeof prepareResultCollectionOverride;
1119
+ const prepareResult: typeof prepareResultOverrideOptions;
1113
1120
  /**
1114
- * Overrides invoice collection settings before a draft invoice is created.
1121
+ * Overrides invoice collection options before a draft invoice is created.
1115
1122
  * @public
1116
1123
  */
1117
- type CollectionOverrideFunction<Config> = (request: InvoiceCollectionRequest, config: Config, context: Context) => InvoiceCollectionResponse;
1124
+ type OverrideOptionsFunction<Config> = (request: InvoiceCollectionOptionsInput, config: Config, context: Context) => InvoiceCollectionOptionsResult;
1118
1125
  }
1119
1126
 
1120
- /**
1121
- * @example
1122
- * ```ts
1123
- * import type { Billing, Context } from '@stripe/extensibility-sdk';
1124
- *
1125
- * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1126
- * interface MyInvoiceCollectionSettingConfig {}
1127
- *
1128
- * export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
1129
- * collectionOverride(
1130
- * _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
1131
- * _config: MyInvoiceCollectionSettingConfig,
1132
- * _context: Context
1133
- * ) {
1134
- * // TODO: implement your collection setting logic here
1135
- *
1136
- * return {};
1137
- * }
1138
- * }
1139
- *
1140
- * ```
1141
- * @public
1142
- */
1143
- declare interface InvoiceCollectionSetting<Config> {
1144
- collectionOverride: InvoiceCollectionSetting.CollectionOverrideFunction<Config>;
1127
+ /** @public */
1128
+ declare interface InvoiceCollectionOptions<Config> {
1129
+ overrideOptions: InvoiceCollectionOptions.OverrideOptionsFunction<Config>;
1145
1130
  }
1146
1131
 
1147
1132
  /* Excluded from this release type: _isPromiseLike */
@@ -1487,6 +1472,15 @@ declare namespace RecurringBillingItemHandling {
1487
1472
  }
1488
1473
  /** @public */
1489
1474
  type Item = ({
1475
+ creditedItems: 'invoiceItem';
1476
+ invoiceItem: CreditedInvoiceItem;
1477
+ } | {
1478
+ creditedItems: 'invoiceLineItems';
1479
+ invoiceLineItems: InvoiceLineItems;
1480
+ } | {
1481
+ creditedItems: 'other';
1482
+ otherCreditedItems: string;
1483
+ }) & ({
1490
1484
  customPricingUnitOverageRate: CustomPricingUnitOverageRate;
1491
1485
  priceKind: 'customPricingUnitOverageRate';
1492
1486
  } | {
@@ -1508,6 +1502,40 @@ declare namespace RecurringBillingItemHandling {
1508
1502
  servicePeriod: AnyTimeRange;
1509
1503
  type: ItemType;
1510
1504
  };
1505
+ /**
1506
+ * The invoice item corresponding to a credit item.
1507
+ * @public
1508
+ */
1509
+ interface CreditedInvoiceItem {
1510
+ /** The id of the invoice item. */
1511
+ id: string;
1512
+ }
1513
+ /**
1514
+ * Information about debit line items corresponding to a credit item.
1515
+ * @public
1516
+ */
1517
+ interface InvoiceLineItems {
1518
+ /** The invoice containing the line items. */
1519
+ invoice: CreditedInvoice;
1520
+ /** The line items corresponding to the credit. */
1521
+ invoiceLineItems: CreditedInvoiceLineItem[];
1522
+ }
1523
+ /**
1524
+ * The invoice line item corresponding to a credit item.
1525
+ * @public
1526
+ */
1527
+ interface CreditedInvoiceLineItem {
1528
+ /** The id of the invoice line item. */
1529
+ id: string;
1530
+ }
1531
+ /**
1532
+ * The invoice corresponding to a credit item.
1533
+ * @public
1534
+ */
1535
+ interface CreditedInvoice {
1536
+ /** The id of the invoice. */
1537
+ id: string;
1538
+ }
1511
1539
  /** @public */
1512
1540
  interface CustomPricingUnitOverageRate {
1513
1541
  id: string;
@@ -1768,9 +1796,6 @@ export declare type Ref<T extends {
1768
1796
  readonly [__stripeType]: 'string';
1769
1797
  };
1770
1798
 
1771
- /** Factory for creating {@link (Ref:type)} values from an object with `object` and `id` fields. @public */
1772
- export declare const Ref: { create: <T extends { readonly object: string }>(step: { readonly id: string } & T) => Ref<T> };
1773
-
1774
1799
  /* Excluded from this release type: _required */
1775
1800
 
1776
1801
  /**
@@ -1820,7 +1845,7 @@ declare interface TimeRange {
1820
1845
  *
1821
1846
  * @example
1822
1847
  * ```typescript
1823
- * import { toConst } from '@stripe/extensibility-sdk/stdlib';
1848
+ * import { toConst } from '@stripe/extensibility-sdk';
1824
1849
  *
1825
1850
  * const DEFAULTS = toConst({ timeout: 30, retries: 3 });
1826
1851
  * // Type: { readonly timeout: 30; readonly retries: 3 }
@@ -91,7 +91,7 @@ declare namespace Bill {
91
91
  declare namespace Billing {
92
92
  export {
93
93
  CustomerBalanceApplication,
94
- InvoiceCollectionSetting,
94
+ InvoiceCollectionOptions,
95
95
  Prorations,
96
96
  RecurringBillingItemHandling,
97
97
  Bill,
@@ -495,7 +495,7 @@ declare interface CustomerBalanceApplication<Config> {
495
495
  *
496
496
  * @example
497
497
  * ```ts
498
- * import { Decimal, RoundDirection } from '@stripe/extensibility-sdk/stdlib';
498
+ * import { Decimal, RoundDirection } from '@stripe/extensibility-sdk';
499
499
  *
500
500
  * const price = Decimal.from('19.99');
501
501
  * const tax = price.mul(Decimal.from('0.0825'));
@@ -1034,58 +1034,65 @@ export declare interface IntegerCompanion {
1034
1034
  export declare type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
1035
1035
 
1036
1036
  /** @public */
1037
- declare namespace InvoiceCollectionSetting {
1037
+ declare namespace InvoiceCollectionOptions {
1038
1038
  /** @public */
1039
- type ParentType = 'billing_cadence' | 'contract' | 'quote' | 'standalone' | 'subscription_schedule' | 'subscription';
1040
- /** @public */
1041
- 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';
1039
+ type PaymentMethodType = 'ach_credit_transfer' | 'ach_debit' | 'affirm' | 'afterpay_clearpay' | 'alipay' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' | 'blik' | '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';
1042
1040
  /** @public */
1043
1041
  type CollectionMethod = 'charge_automatically' | 'send_invoice';
1044
1042
  /**
1045
- * The result of the invoice collection settings override extension.
1043
+ * The result of the invoice collection options override extension.
1046
1044
  * @public
1047
1045
  */
1048
- interface InvoiceCollectionResponse {
1046
+ interface InvoiceCollectionOptionsResult {
1049
1047
  /** Override the auto-advancement setting. Set to false to keep the invoice in draft. Return null to use the default. */
1050
1048
  autoAdvance?: boolean;
1051
1049
  }
1052
1050
  /** @public */
1053
- type InvoiceCollectionRequest = ({
1051
+ type InvoiceCollectionOptionsInput = ({
1054
1052
  customer: Customer;
1055
1053
  payer: 'customer';
1056
1054
  } | {
1057
1055
  otherPayer: string;
1058
1056
  payer: 'other';
1059
- }) & {
1060
- collectionSettings: CollectionSettings;
1061
- parent: Parent;
1062
- };
1057
+ }) & ({
1058
+ invoiceParentType: 'other';
1059
+ otherInvoiceParentType: string;
1060
+ } | {
1061
+ invoiceParentType: 'subscription';
1062
+ subscription: SubscriptionParent;
1063
+ } | { invoiceParentType: 'cadence' } | { invoiceParentType: 'contract' } | { invoiceParentType: 'quote' } | { invoiceParentType: 'schedule' }) & { collectionOptions: CollectionOptions };
1063
1064
  /** @public */
1064
1065
  interface Customer {
1065
1066
  id: string;
1066
1067
  metadata: Record<string, string>;
1067
1068
  }
1069
+ /** @public */
1070
+ type ContractParent = Record<string, never>;
1068
1071
  /**
1069
- * The parent resource that triggered the invoice creation.
1072
+ * The Subscription that triggered the invoice creation.
1070
1073
  * @public
1071
1074
  */
1072
- interface Parent {
1073
- /** The type of parent resource (for example, subscription or contract). */
1074
- type: ParentType;
1075
- /** Custom key-value pairs attached to the parent resource. */
1075
+ interface SubscriptionParent {
1076
+ /** The unique identifier for the subscription. */
1077
+ id: string;
1078
+ /** The metadata of the subscription. */
1076
1079
  metadata: Record<string, string>;
1077
1080
  }
1081
+ /** @public */
1082
+ type ScheduleParent = Record<string, never>;
1083
+ /** @public */
1084
+ type QuoteParent = Record<string, never>;
1085
+ /** @public */
1086
+ type CadenceParent = Record<string, never>;
1078
1087
  /**
1079
- * The collection settings for an invoice.
1088
+ * The collection options for an invoice.
1080
1089
  * @public
1081
1090
  */
1082
- interface CollectionSettings {
1091
+ interface CollectionOptions {
1083
1092
  /** Whether the invoice automatically advances through its lifecycle. */
1084
1093
  autoAdvance: boolean;
1085
1094
  /** The payment collection method: charge_automatically or send_invoice. */
1086
1095
  collectionMethod: CollectionMethod;
1087
- /** The delay before the invoice is finalized, in hours. */
1088
- finalizationGracePeriod: number;
1089
1096
  /** The payment methods configured for this invoice. */
1090
1097
  paymentMethods: PaymentMethodType[];
1091
1098
  }
@@ -1093,55 +1100,33 @@ declare namespace InvoiceCollectionSetting {
1093
1100
  * @public
1094
1101
  * @deprecated Platform dispatch handles wire/SDK conversion.
1095
1102
  */
1096
- function prepareArgsCollectionOverride(proto: unknown): InvoiceCollectionRequest;
1103
+ function prepareArgsOverrideOptions(proto: unknown): InvoiceCollectionOptionsInput;
1097
1104
  /**
1098
1105
  * @public
1099
1106
  * @deprecated Platform dispatch handles wire/SDK conversion.
1100
1107
  */
1101
- function prepareResultCollectionOverride(result: InvoiceCollectionResponse): InvoiceCollectionResponse;
1102
- /* Excluded from this release type: $platformWrapCollectionOverride */
1108
+ function prepareResultOverrideOptions(result: InvoiceCollectionOptionsResult): InvoiceCollectionOptionsResult;
1109
+ /* Excluded from this release type: $platformWrapOverrideOptions */
1103
1110
  /**
1104
1111
  * @public
1105
1112
  * @deprecated Platform dispatch handles wire/SDK conversion.
1106
1113
  */
1107
- const prepareArgs: typeof prepareArgsCollectionOverride;
1114
+ const prepareArgs: typeof prepareArgsOverrideOptions;
1108
1115
  /**
1109
1116
  * @public
1110
1117
  * @deprecated Platform dispatch handles wire/SDK conversion.
1111
1118
  */
1112
- const prepareResult: typeof prepareResultCollectionOverride;
1119
+ const prepareResult: typeof prepareResultOverrideOptions;
1113
1120
  /**
1114
- * Overrides invoice collection settings before a draft invoice is created.
1121
+ * Overrides invoice collection options before a draft invoice is created.
1115
1122
  * @public
1116
1123
  */
1117
- type CollectionOverrideFunction<Config> = (request: InvoiceCollectionRequest, config: Config, context: Context) => InvoiceCollectionResponse;
1124
+ type OverrideOptionsFunction<Config> = (request: InvoiceCollectionOptionsInput, config: Config, context: Context) => InvoiceCollectionOptionsResult;
1118
1125
  }
1119
1126
 
1120
- /**
1121
- * @example
1122
- * ```ts
1123
- * import type { Billing, Context } from '@stripe/extensibility-sdk';
1124
- *
1125
- * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1126
- * interface MyInvoiceCollectionSettingConfig {}
1127
- *
1128
- * export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
1129
- * collectionOverride(
1130
- * _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
1131
- * _config: MyInvoiceCollectionSettingConfig,
1132
- * _context: Context
1133
- * ) {
1134
- * // TODO: implement your collection setting logic here
1135
- *
1136
- * return {};
1137
- * }
1138
- * }
1139
- *
1140
- * ```
1141
- * @public
1142
- */
1143
- declare interface InvoiceCollectionSetting<Config> {
1144
- collectionOverride: InvoiceCollectionSetting.CollectionOverrideFunction<Config>;
1127
+ /** @public */
1128
+ declare interface InvoiceCollectionOptions<Config> {
1129
+ overrideOptions: InvoiceCollectionOptions.OverrideOptionsFunction<Config>;
1145
1130
  }
1146
1131
 
1147
1132
  /* Excluded from this release type: _isPromiseLike */
@@ -1487,6 +1472,15 @@ declare namespace RecurringBillingItemHandling {
1487
1472
  }
1488
1473
  /** @public */
1489
1474
  type Item = ({
1475
+ creditedItems: 'invoiceItem';
1476
+ invoiceItem: CreditedInvoiceItem;
1477
+ } | {
1478
+ creditedItems: 'invoiceLineItems';
1479
+ invoiceLineItems: InvoiceLineItems;
1480
+ } | {
1481
+ creditedItems: 'other';
1482
+ otherCreditedItems: string;
1483
+ }) & ({
1490
1484
  customPricingUnitOverageRate: CustomPricingUnitOverageRate;
1491
1485
  priceKind: 'customPricingUnitOverageRate';
1492
1486
  } | {
@@ -1508,6 +1502,40 @@ declare namespace RecurringBillingItemHandling {
1508
1502
  servicePeriod: AnyTimeRange;
1509
1503
  type: ItemType;
1510
1504
  };
1505
+ /**
1506
+ * The invoice item corresponding to a credit item.
1507
+ * @public
1508
+ */
1509
+ interface CreditedInvoiceItem {
1510
+ /** The id of the invoice item. */
1511
+ id: string;
1512
+ }
1513
+ /**
1514
+ * Information about debit line items corresponding to a credit item.
1515
+ * @public
1516
+ */
1517
+ interface InvoiceLineItems {
1518
+ /** The invoice containing the line items. */
1519
+ invoice: CreditedInvoice;
1520
+ /** The line items corresponding to the credit. */
1521
+ invoiceLineItems: CreditedInvoiceLineItem[];
1522
+ }
1523
+ /**
1524
+ * The invoice line item corresponding to a credit item.
1525
+ * @public
1526
+ */
1527
+ interface CreditedInvoiceLineItem {
1528
+ /** The id of the invoice line item. */
1529
+ id: string;
1530
+ }
1531
+ /**
1532
+ * The invoice corresponding to a credit item.
1533
+ * @public
1534
+ */
1535
+ interface CreditedInvoice {
1536
+ /** The id of the invoice. */
1537
+ id: string;
1538
+ }
1511
1539
  /** @public */
1512
1540
  interface CustomPricingUnitOverageRate {
1513
1541
  id: string;
@@ -1768,9 +1796,6 @@ export declare type Ref<T extends {
1768
1796
  readonly [__stripeType]: 'string';
1769
1797
  };
1770
1798
 
1771
- /** Factory for creating {@link (Ref:type)} values from an object with `object` and `id` fields. @public */
1772
- export declare const Ref: { create: <T extends { readonly object: string }>(step: { readonly id: string } & T) => Ref<T> };
1773
-
1774
1799
  /* Excluded from this release type: _required */
1775
1800
 
1776
1801
  /**
@@ -1820,7 +1845,7 @@ declare interface TimeRange {
1820
1845
  *
1821
1846
  * @example
1822
1847
  * ```typescript
1823
- * import { toConst } from '@stripe/extensibility-sdk/stdlib';
1848
+ * import { toConst } from '@stripe/extensibility-sdk';
1824
1849
  *
1825
1850
  * const DEFAULTS = toConst({ timeout: 30, retries: 3 });
1826
1851
  * // Type: { readonly timeout: 30; readonly retries: 3 }