@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
@@ -163,7 +163,7 @@ declare namespace Bill {
163
163
  declare namespace Billing {
164
164
  export {
165
165
  CustomerBalanceApplication,
166
- InvoiceCollectionSetting,
166
+ InvoiceCollectionOptions,
167
167
  Prorations,
168
168
  RecurringBillingItemHandling,
169
169
  Bill,
@@ -612,7 +612,7 @@ declare interface CustomerBalanceApplication<Config> {
612
612
  *
613
613
  * @example
614
614
  * ```ts
615
- * import { Decimal, RoundDirection } from '@stripe/extensibility-sdk/stdlib';
615
+ * import { Decimal, RoundDirection } from '@stripe/extensibility-sdk';
616
616
  *
617
617
  * const price = Decimal.from('19.99');
618
618
  * const tax = price.mul(Decimal.from('0.0825'));
@@ -1203,58 +1203,65 @@ export declare interface IntegerCompanion {
1203
1203
  export declare type IntegerRoundDirection = 'ceil' | 'floor' | 'half-up' | 'round-down' | 'round-up';
1204
1204
 
1205
1205
  /** @public */
1206
- declare namespace InvoiceCollectionSetting {
1206
+ declare namespace InvoiceCollectionOptions {
1207
1207
  /** @public */
1208
- type ParentType = 'billing_cadence' | 'contract' | 'quote' | 'standalone' | 'subscription_schedule' | 'subscription';
1209
- /** @public */
1210
- 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';
1208
+ 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';
1211
1209
  /** @public */
1212
1210
  type CollectionMethod = 'charge_automatically' | 'send_invoice';
1213
1211
  /**
1214
- * The result of the invoice collection settings override extension.
1212
+ * The result of the invoice collection options override extension.
1215
1213
  * @public
1216
1214
  */
1217
- interface InvoiceCollectionResponse {
1215
+ interface InvoiceCollectionOptionsResult {
1218
1216
  /** Override the auto-advancement setting. Set to false to keep the invoice in draft. Return null to use the default. */
1219
1217
  autoAdvance?: boolean;
1220
1218
  }
1221
1219
  /** @public */
1222
- type InvoiceCollectionRequest = ({
1220
+ type InvoiceCollectionOptionsInput = ({
1223
1221
  customer: Customer;
1224
1222
  payer: 'customer';
1225
1223
  } | {
1226
1224
  otherPayer: string;
1227
1225
  payer: 'other';
1228
- }) & {
1229
- collectionSettings: CollectionSettings;
1230
- parent: Parent;
1231
- };
1226
+ }) & ({
1227
+ invoiceParentType: 'other';
1228
+ otherInvoiceParentType: string;
1229
+ } | {
1230
+ invoiceParentType: 'subscription';
1231
+ subscription: SubscriptionParent;
1232
+ } | { invoiceParentType: 'cadence' } | { invoiceParentType: 'contract' } | { invoiceParentType: 'quote' } | { invoiceParentType: 'schedule' }) & { collectionOptions: CollectionOptions };
1232
1233
  /** @public */
1233
1234
  interface Customer {
1234
1235
  id: string;
1235
1236
  metadata: Record<string, string>;
1236
1237
  }
1238
+ /** @public */
1239
+ type ContractParent = Record<string, never>;
1237
1240
  /**
1238
- * The parent resource that triggered the invoice creation.
1241
+ * The Subscription that triggered the invoice creation.
1239
1242
  * @public
1240
1243
  */
1241
- interface Parent {
1242
- /** The type of parent resource (for example, subscription or contract). */
1243
- type: ParentType;
1244
- /** Custom key-value pairs attached to the parent resource. */
1244
+ interface SubscriptionParent {
1245
+ /** The unique identifier for the subscription. */
1246
+ id: string;
1247
+ /** The metadata of the subscription. */
1245
1248
  metadata: Record<string, string>;
1246
1249
  }
1250
+ /** @public */
1251
+ type ScheduleParent = Record<string, never>;
1252
+ /** @public */
1253
+ type QuoteParent = Record<string, never>;
1254
+ /** @public */
1255
+ type CadenceParent = Record<string, never>;
1247
1256
  /**
1248
- * The collection settings for an invoice.
1257
+ * The collection options for an invoice.
1249
1258
  * @public
1250
1259
  */
1251
- interface CollectionSettings {
1260
+ interface CollectionOptions {
1252
1261
  /** Whether the invoice automatically advances through its lifecycle. */
1253
1262
  autoAdvance: boolean;
1254
1263
  /** The payment collection method: charge_automatically or send_invoice. */
1255
1264
  collectionMethod: CollectionMethod;
1256
- /** The delay before the invoice is finalized, in hours. */
1257
- finalizationGracePeriod: number;
1258
1265
  /** The payment methods configured for this invoice. */
1259
1266
  paymentMethods: PaymentMethodType[];
1260
1267
  }
@@ -1262,56 +1269,34 @@ declare namespace InvoiceCollectionSetting {
1262
1269
  * @public
1263
1270
  * @deprecated Platform dispatch handles wire/SDK conversion.
1264
1271
  */
1265
- function prepareArgsCollectionOverride(proto: unknown): InvoiceCollectionRequest;
1272
+ function prepareArgsOverrideOptions(proto: unknown): InvoiceCollectionOptionsInput;
1266
1273
  /**
1267
1274
  * @public
1268
1275
  * @deprecated Platform dispatch handles wire/SDK conversion.
1269
1276
  */
1270
- function prepareResultCollectionOverride(result: InvoiceCollectionResponse): InvoiceCollectionResponse;
1277
+ function prepareResultOverrideOptions(result: InvoiceCollectionOptionsResult): InvoiceCollectionOptionsResult;
1271
1278
  /** @internal */
1272
- function $platformWrapCollectionOverride(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { collectionOverride(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
1279
+ function $platformWrapOverrideOptions(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { overrideOptions(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
1273
1280
  /**
1274
1281
  * @public
1275
1282
  * @deprecated Platform dispatch handles wire/SDK conversion.
1276
1283
  */
1277
- const prepareArgs: typeof prepareArgsCollectionOverride;
1284
+ const prepareArgs: typeof prepareArgsOverrideOptions;
1278
1285
  /**
1279
1286
  * @public
1280
1287
  * @deprecated Platform dispatch handles wire/SDK conversion.
1281
1288
  */
1282
- const prepareResult: typeof prepareResultCollectionOverride;
1289
+ const prepareResult: typeof prepareResultOverrideOptions;
1283
1290
  /**
1284
- * Overrides invoice collection settings before a draft invoice is created.
1291
+ * Overrides invoice collection options before a draft invoice is created.
1285
1292
  * @public
1286
1293
  */
1287
- type CollectionOverrideFunction<Config> = (request: InvoiceCollectionRequest, config: Config, context: Context) => InvoiceCollectionResponse;
1294
+ type OverrideOptionsFunction<Config> = (request: InvoiceCollectionOptionsInput, config: Config, context: Context) => InvoiceCollectionOptionsResult;
1288
1295
  }
1289
1296
 
1290
- /**
1291
- * @example
1292
- * ```ts
1293
- * import type { Billing, Context } from '@stripe/extensibility-sdk';
1294
- *
1295
- * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1296
- * interface MyInvoiceCollectionSettingConfig {}
1297
- *
1298
- * export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
1299
- * collectionOverride(
1300
- * _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
1301
- * _config: MyInvoiceCollectionSettingConfig,
1302
- * _context: Context
1303
- * ) {
1304
- * // TODO: implement your collection setting logic here
1305
- *
1306
- * return {};
1307
- * }
1308
- * }
1309
- *
1310
- * ```
1311
- * @public
1312
- */
1313
- declare interface InvoiceCollectionSetting<Config> {
1314
- collectionOverride: InvoiceCollectionSetting.CollectionOverrideFunction<Config>;
1297
+ /** @public */
1298
+ declare interface InvoiceCollectionOptions<Config> {
1299
+ overrideOptions: InvoiceCollectionOptions.OverrideOptionsFunction<Config>;
1315
1300
  }
1316
1301
 
1317
1302
  /**
@@ -1742,6 +1727,15 @@ declare namespace RecurringBillingItemHandling {
1742
1727
  }
1743
1728
  /** @public */
1744
1729
  type Item = ({
1730
+ creditedItems: 'invoiceItem';
1731
+ invoiceItem: CreditedInvoiceItem;
1732
+ } | {
1733
+ creditedItems: 'invoiceLineItems';
1734
+ invoiceLineItems: InvoiceLineItems;
1735
+ } | {
1736
+ creditedItems: 'other';
1737
+ otherCreditedItems: string;
1738
+ }) & ({
1745
1739
  customPricingUnitOverageRate: CustomPricingUnitOverageRate;
1746
1740
  priceKind: 'customPricingUnitOverageRate';
1747
1741
  } | {
@@ -1763,6 +1757,40 @@ declare namespace RecurringBillingItemHandling {
1763
1757
  servicePeriod: AnyTimeRange;
1764
1758
  type: ItemType;
1765
1759
  };
1760
+ /**
1761
+ * The invoice item corresponding to a credit item.
1762
+ * @public
1763
+ */
1764
+ interface CreditedInvoiceItem {
1765
+ /** The id of the invoice item. */
1766
+ id: string;
1767
+ }
1768
+ /**
1769
+ * Information about debit line items corresponding to a credit item.
1770
+ * @public
1771
+ */
1772
+ interface InvoiceLineItems {
1773
+ /** The invoice containing the line items. */
1774
+ invoice: CreditedInvoice;
1775
+ /** The line items corresponding to the credit. */
1776
+ invoiceLineItems: CreditedInvoiceLineItem[];
1777
+ }
1778
+ /**
1779
+ * The invoice line item corresponding to a credit item.
1780
+ * @public
1781
+ */
1782
+ interface CreditedInvoiceLineItem {
1783
+ /** The id of the invoice line item. */
1784
+ id: string;
1785
+ }
1786
+ /**
1787
+ * The invoice corresponding to a credit item.
1788
+ * @public
1789
+ */
1790
+ interface CreditedInvoice {
1791
+ /** The id of the invoice. */
1792
+ id: string;
1793
+ }
1766
1794
  /** @public */
1767
1795
  interface CustomPricingUnitOverageRate {
1768
1796
  id: string;
@@ -2026,9 +2054,6 @@ export declare type Ref<T extends {
2026
2054
  readonly [__stripeType]: 'string';
2027
2055
  };
2028
2056
 
2029
- /** Factory for creating {@link (Ref:type)} values from an object with `object` and `id` fields. @public */
2030
- export declare const Ref: { create: <T extends { readonly object: string }>(step: { readonly id: string } & T) => Ref<T> };
2031
-
2032
2057
  /**
2033
2058
  * Wraps a transformer so that a `null` / `undefined` result throws
2034
2059
  * `WireParseError('Required field is missing')`, which `strategy.applyField`
@@ -2102,7 +2127,7 @@ declare interface TimeRange {
2102
2127
  *
2103
2128
  * @example
2104
2129
  * ```typescript
2105
- * import { toConst } from '@stripe/extensibility-sdk/stdlib';
2130
+ * import { toConst } from '@stripe/extensibility-sdk';
2106
2131
  *
2107
2132
  * const DEFAULTS = toConst({ timeout: 30, retries: 3 });
2108
2133
  * // 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 }
@@ -1,7 +1,7 @@
1
1
  export * from './types.js';
2
2
  import * as Bill from './bill/index.js';
3
3
  export { CustomerBalanceApplication } from './customer_balance_application.js';
4
- export { InvoiceCollectionSetting } from './invoice_collection_setting.js';
4
+ export { InvoiceCollectionOptions } from './invoice_collection_options.js';
5
5
  export { Prorations } from './prorations.js';
6
6
  export { RecurringBillingItemHandling } from './recurring_billing_item_handling.js';
7
7
  export { Bill };
@@ -0,0 +1,111 @@
1
+ import type { Context } from '../context.js';
2
+ import type { _ConfigApplicationContext } from '../../stdlib/index.js';
3
+ /** @public */
4
+ export declare namespace InvoiceCollectionOptions {
5
+ /** @public */
6
+ 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' | 'blik';
7
+ /** @public */
8
+ type CollectionMethod = 'send_invoice' | 'charge_automatically';
9
+ /**
10
+ * The result of the invoice collection options override extension.
11
+ * @public
12
+ */
13
+ interface InvoiceCollectionOptionsResult {
14
+ /** Override the auto-advancement setting. Set to false to keep the invoice in draft. Return null to use the default. */
15
+ autoAdvance?: boolean;
16
+ }
17
+ /** @public */
18
+ type InvoiceCollectionOptionsInput = {
19
+ /** The current collection options that would be applied to the invoice. */
20
+ collectionOptions: CollectionOptions;
21
+ } & ({
22
+ invoiceParentType: 'cadence';
23
+ } | {
24
+ invoiceParentType: 'quote';
25
+ } | {
26
+ invoiceParentType: 'schedule';
27
+ } | {
28
+ invoiceParentType: 'subscription';
29
+ subscription: SubscriptionParent;
30
+ } | {
31
+ invoiceParentType: 'contract';
32
+ } | {
33
+ invoiceParentType: 'other';
34
+ otherInvoiceParentType: string;
35
+ }) & ({
36
+ payer: 'customer';
37
+ customer: Customer;
38
+ } | {
39
+ payer: 'other';
40
+ otherPayer: string;
41
+ });
42
+ /** @public */
43
+ interface Customer {
44
+ id: string;
45
+ metadata: Record<string, string>;
46
+ }
47
+ /** @public */
48
+ type ContractParent = Record<string, never>;
49
+ /**
50
+ * The Subscription that triggered the invoice creation.
51
+ * @public
52
+ */
53
+ interface SubscriptionParent {
54
+ /** The unique identifier for the subscription. */
55
+ id: string;
56
+ /** The metadata of the subscription. */
57
+ metadata: Record<string, string>;
58
+ }
59
+ /** @public */
60
+ type ScheduleParent = Record<string, never>;
61
+ /** @public */
62
+ type QuoteParent = Record<string, never>;
63
+ /** @public */
64
+ type CadenceParent = Record<string, never>;
65
+ /**
66
+ * The collection options for an invoice.
67
+ * @public
68
+ */
69
+ interface CollectionOptions {
70
+ /** Whether the invoice automatically advances through its lifecycle. */
71
+ autoAdvance: boolean;
72
+ /** The payment collection method: charge_automatically or send_invoice. */
73
+ collectionMethod: CollectionMethod;
74
+ /** The payment methods configured for this invoice. */
75
+ paymentMethods: PaymentMethodType[];
76
+ }
77
+ /**
78
+ * @public
79
+ * @deprecated Platform dispatch handles wire/SDK conversion.
80
+ */
81
+ function prepareArgsOverrideOptions(proto: unknown): InvoiceCollectionOptionsInput;
82
+ /**
83
+ * @public
84
+ * @deprecated Platform dispatch handles wire/SDK conversion.
85
+ */
86
+ function prepareResultOverrideOptions(result: InvoiceCollectionOptionsResult): InvoiceCollectionOptionsResult;
87
+ /** @internal */
88
+ function $platformWrapOverrideOptions(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
89
+ overrideOptions(...a: unknown[]): unknown;
90
+ }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
91
+ /**
92
+ * @public
93
+ * @deprecated Platform dispatch handles wire/SDK conversion.
94
+ */
95
+ const prepareArgs: typeof prepareArgsOverrideOptions;
96
+ /**
97
+ * @public
98
+ * @deprecated Platform dispatch handles wire/SDK conversion.
99
+ */
100
+ const prepareResult: typeof prepareResultOverrideOptions;
101
+ /**
102
+ * Overrides invoice collection options before a draft invoice is created.
103
+ * @public
104
+ */
105
+ type OverrideOptionsFunction<Config> = (request: InvoiceCollectionOptionsInput, config: Config, context: Context) => InvoiceCollectionOptionsResult;
106
+ }
107
+ /** @public */
108
+ export interface InvoiceCollectionOptions<Config> {
109
+ overrideOptions: InvoiceCollectionOptions.OverrideOptionsFunction<Config>;
110
+ }
111
+ //# sourceMappingURL=invoice_collection_options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice_collection_options.d.ts","sourceRoot":"","sources":["../../../src/extensions/billing/invoice_collection_options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAEV,yBAAyB,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,GAAG,EAAE,OAAO,KACT,OAAO,CAkCX;IAID;;;OAGG;IACI,MAAM,WAAW,mCAAoB,CAAC;IAG7C;;;OAGG;IACI,MAAM,aAAa,qCAAsB,CAAC;IAEjD;;;OAGG;IACH,KAAY,uBAAuB,CAAC,MAAM,IAAI,CAC5C,OAAO,EAAE,6BAA6B,EACtC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,KACb,8BAA8B,CAAC;CACrC;AAED,cAAc;AACd,MAAM,WAAW,wBAAwB,CAAC,MAAM;IAC9C,eAAe,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;CAC3E"}
@@ -76,7 +76,50 @@ export declare namespace RecurringBillingItemHandling {
76
76
  } | {
77
77
  priceKind: 'other';
78
78
  otherPriceKind: string;
79
+ }) & ({
80
+ creditedItems: 'invoiceLineItems';
81
+ invoiceLineItems: InvoiceLineItems;
82
+ } | {
83
+ creditedItems: 'invoiceItem';
84
+ invoiceItem: CreditedInvoiceItem;
85
+ } | {
86
+ creditedItems: 'other';
87
+ otherCreditedItems: string;
79
88
  });
89
+ /**
90
+ * The invoice item corresponding to a credit item.
91
+ * @public
92
+ */
93
+ interface CreditedInvoiceItem {
94
+ /** The id of the invoice item. */
95
+ id: string;
96
+ }
97
+ /**
98
+ * Information about debit line items corresponding to a credit item.
99
+ * @public
100
+ */
101
+ interface InvoiceLineItems {
102
+ /** The invoice containing the line items. */
103
+ invoice: CreditedInvoice;
104
+ /** The line items corresponding to the credit. */
105
+ invoiceLineItems: CreditedInvoiceLineItem[];
106
+ }
107
+ /**
108
+ * The invoice line item corresponding to a credit item.
109
+ * @public
110
+ */
111
+ interface CreditedInvoiceLineItem {
112
+ /** The id of the invoice line item. */
113
+ id: string;
114
+ }
115
+ /**
116
+ * The invoice corresponding to a credit item.
117
+ * @public
118
+ */
119
+ interface CreditedInvoice {
120
+ /** The id of the invoice. */
121
+ id: string;
122
+ }
80
123
  /** @public */
81
124
  interface CustomPricingUnitOverageRate {
82
125
  id: string;