stripe 17.3.1 → 17.4.0-beta.2

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 (195) hide show
  1. package/CHANGELOG.md +967 -109
  2. package/README.md +4 -4
  3. package/VERSION +1 -1
  4. package/cjs/resources/AccountNotices.js +21 -0
  5. package/cjs/resources/Capital/FinancingOffers.js +21 -0
  6. package/cjs/resources/Capital/FinancingSummary.js +12 -0
  7. package/cjs/resources/Capital/FinancingTransactions.js +17 -0
  8. package/cjs/resources/FinancialConnections/Accounts.js +5 -0
  9. package/cjs/resources/FinancialConnections/Institutions.js +17 -0
  10. package/cjs/resources/GiftCards/Cards.js +23 -0
  11. package/cjs/resources/GiftCards/Transactions.js +33 -0
  12. package/cjs/resources/Invoices.js +17 -0
  13. package/cjs/resources/Issuing/CreditUnderwritingRecords.js +33 -0
  14. package/cjs/resources/Issuing/DisputeSettlementDetails.js +17 -0
  15. package/cjs/resources/Issuing/FraudLiabilityDebits.js +17 -0
  16. package/cjs/resources/Margins.js +22 -0
  17. package/cjs/resources/Orders.js +24 -0
  18. package/cjs/resources/PaymentAttemptRecords.js +17 -0
  19. package/cjs/resources/PaymentIntents.js +8 -0
  20. package/cjs/resources/PaymentRecords.js +29 -0
  21. package/cjs/resources/Quotes.js +32 -0
  22. package/cjs/resources/SubscriptionSchedules.js +4 -0
  23. package/cjs/resources/Tax/Associations.js +9 -0
  24. package/cjs/resources/Tax/Forms.js +20 -0
  25. package/cjs/resources/Terminal/ReaderCollectedData.js +12 -0
  26. package/cjs/resources/Terminal/Readers.js +12 -0
  27. package/cjs/resources.js +68 -14
  28. package/cjs/stripe.core.js +1 -1
  29. package/esm/resources/AccountNotices.js +18 -0
  30. package/esm/resources/Capital/FinancingOffers.js +18 -0
  31. package/esm/resources/Capital/FinancingSummary.js +9 -0
  32. package/esm/resources/Capital/FinancingTransactions.js +14 -0
  33. package/esm/resources/FinancialConnections/Accounts.js +5 -0
  34. package/esm/resources/FinancialConnections/Institutions.js +14 -0
  35. package/esm/resources/GiftCards/Cards.js +20 -0
  36. package/esm/resources/GiftCards/Transactions.js +30 -0
  37. package/esm/resources/Invoices.js +17 -0
  38. package/esm/resources/Issuing/CreditUnderwritingRecords.js +30 -0
  39. package/esm/resources/Issuing/DisputeSettlementDetails.js +14 -0
  40. package/esm/resources/Issuing/FraudLiabilityDebits.js +14 -0
  41. package/esm/resources/Margins.js +19 -0
  42. package/esm/resources/Orders.js +21 -0
  43. package/esm/resources/PaymentAttemptRecords.js +14 -0
  44. package/esm/resources/PaymentIntents.js +8 -0
  45. package/esm/resources/PaymentRecords.js +26 -0
  46. package/esm/resources/Quotes.js +32 -0
  47. package/esm/resources/SubscriptionSchedules.js +4 -0
  48. package/esm/resources/Tax/Associations.js +6 -0
  49. package/esm/resources/Tax/Forms.js +17 -0
  50. package/esm/resources/Terminal/ReaderCollectedData.js +9 -0
  51. package/esm/resources/Terminal/Readers.js +12 -0
  52. package/esm/resources.js +51 -1
  53. package/esm/stripe.core.js +1 -1
  54. package/package.json +1 -1
  55. package/types/AccountLinksResource.d.ts +5 -1
  56. package/types/AccountNotices.d.ts +113 -0
  57. package/types/AccountNoticesResource.d.ts +98 -0
  58. package/types/AccountSessions.d.ts +50 -5
  59. package/types/AccountSessionsResource.d.ts +355 -0
  60. package/types/Accounts.d.ts +221 -5
  61. package/types/AccountsResource.d.ts +496 -0
  62. package/types/Billing/CreditBalanceSummaryResource.d.ts +1 -1
  63. package/types/Billing/CreditGrants.d.ts +5 -6
  64. package/types/Billing/CreditGrantsResource.d.ts +11 -11
  65. package/types/Billing/MeterErrorReports.d.ts +106 -0
  66. package/types/Billing/MeterEventsResource.d.ts +1 -1
  67. package/types/Capital/FinancingOffers.d.ts +188 -0
  68. package/types/Capital/FinancingOffersResource.d.ts +97 -0
  69. package/types/Capital/FinancingSummary.d.ts +106 -0
  70. package/types/Capital/FinancingSummaryResource.d.ts +27 -0
  71. package/types/Capital/FinancingTransactions.d.ts +135 -0
  72. package/types/Capital/FinancingTransactionsResource.d.ts +68 -0
  73. package/types/Charges.d.ts +121 -5
  74. package/types/ChargesResource.d.ts +1294 -0
  75. package/types/Checkout/Sessions.d.ts +360 -5
  76. package/types/Checkout/SessionsResource.d.ts +444 -9
  77. package/types/ConfirmationTokens.d.ts +103 -4
  78. package/types/Coupons.d.ts +1 -1
  79. package/types/CouponsResource.d.ts +1 -1
  80. package/types/CreditNotes.d.ts +21 -0
  81. package/types/CreditNotesResource.d.ts +51 -0
  82. package/types/CustomersResource.d.ts +11 -2
  83. package/types/Disputes.d.ts +1 -1
  84. package/types/EventTypes.d.ts +579 -0
  85. package/types/Events.d.ts +92 -0
  86. package/types/FinancialConnections/AccountInferredBalances.d.ts +38 -0
  87. package/types/FinancialConnections/Accounts.d.ts +29 -1
  88. package/types/FinancialConnections/AccountsResource.d.ts +35 -3
  89. package/types/FinancialConnections/Institutions.d.ts +93 -0
  90. package/types/FinancialConnections/InstitutionsResource.d.ts +47 -0
  91. package/types/FinancialConnections/Sessions.d.ts +49 -1
  92. package/types/FinancialConnections/SessionsResource.d.ts +38 -1
  93. package/types/FundingInstructions.d.ts +28 -0
  94. package/types/GiftCards/Cards.d.ts +118 -0
  95. package/types/GiftCards/CardsResource.d.ts +159 -0
  96. package/types/GiftCards/Transactions.d.ts +129 -0
  97. package/types/GiftCards/TransactionsResource.d.ts +201 -0
  98. package/types/Identity/VerificationReports.d.ts +1 -1
  99. package/types/Identity/VerificationSessions.d.ts +1 -1
  100. package/types/Identity/VerificationSessionsResource.d.ts +1 -1
  101. package/types/InvoiceItems.d.ts +5 -0
  102. package/types/InvoiceItemsResource.d.ts +98 -0
  103. package/types/InvoiceLineItems.d.ts +28 -1
  104. package/types/InvoicePayments.d.ts +113 -0
  105. package/types/Invoices.d.ts +139 -3
  106. package/types/InvoicesResource.d.ts +5536 -1845
  107. package/types/Issuing/Authorizations.d.ts +1 -1
  108. package/types/Issuing/CardholdersResource.d.ts +2 -1
  109. package/types/Issuing/Cards.d.ts +1 -1
  110. package/types/Issuing/CreditUnderwritingRecords.d.ts +451 -0
  111. package/types/Issuing/CreditUnderwritingRecordsResource.d.ts +1032 -0
  112. package/types/Issuing/DisputeSettlementDetails.d.ts +73 -0
  113. package/types/Issuing/DisputeSettlementDetailsResource.d.ts +52 -0
  114. package/types/Issuing/FraudLiabilityDebits.d.ts +52 -0
  115. package/types/Issuing/FraudLiabilityDebitsResource.d.ts +52 -0
  116. package/types/Issuing/Settlements.d.ts +103 -0
  117. package/types/Issuing/Transactions.d.ts +2 -0
  118. package/types/Issuing/TransactionsResource.d.ts +5 -0
  119. package/types/LineItems.d.ts +7 -0
  120. package/types/Mandates.d.ts +77 -0
  121. package/types/Margins.d.ts +56 -0
  122. package/types/MarginsResource.d.ts +114 -0
  123. package/types/Orders.d.ts +1155 -0
  124. package/types/OrdersResource.d.ts +2913 -0
  125. package/types/PaymentAttemptRecords.d.ts +242 -0
  126. package/types/PaymentAttemptRecordsResource.d.ts +47 -0
  127. package/types/PaymentIntents.d.ts +667 -2
  128. package/types/PaymentIntentsResource.d.ts +7948 -3704
  129. package/types/PaymentLinks.d.ts +6 -0
  130. package/types/PaymentLinksResource.d.ts +21 -2
  131. package/types/PaymentMethodConfigurations.d.ts +180 -0
  132. package/types/PaymentMethodConfigurationsResource.d.ts +250 -0
  133. package/types/PaymentMethods.d.ts +103 -4
  134. package/types/PaymentMethodsResource.d.ts +133 -0
  135. package/types/PaymentRecords.d.ts +259 -0
  136. package/types/PaymentRecordsResource.d.ts +455 -0
  137. package/types/Prices.d.ts +22 -0
  138. package/types/PricesResource.d.ts +22 -0
  139. package/types/Products.d.ts +39 -0
  140. package/types/ProductsResource.d.ts +36 -0
  141. package/types/QuoteLines.d.ts +634 -0
  142. package/types/QuotePreviewInvoices.d.ts +1615 -0
  143. package/types/QuotePreviewSubscriptionSchedules.d.ts +814 -0
  144. package/types/Quotes.d.ts +591 -1
  145. package/types/QuotesResource.d.ts +2526 -194
  146. package/types/Refunds.d.ts +14 -0
  147. package/types/SetupAttempts.d.ts +40 -2
  148. package/types/SetupIntents.d.ts +113 -2
  149. package/types/SetupIntentsResource.d.ts +652 -7
  150. package/types/Sources.d.ts +23 -0
  151. package/types/SubscriptionItems.d.ts +21 -0
  152. package/types/SubscriptionItemsResource.d.ts +109 -0
  153. package/types/SubscriptionSchedules.d.ts +200 -0
  154. package/types/SubscriptionSchedulesResource.d.ts +1234 -16
  155. package/types/Subscriptions.d.ts +92 -1
  156. package/types/SubscriptionsResource.d.ts +371 -2
  157. package/types/Tax/Associations.d.ts +126 -0
  158. package/types/Tax/AssociationsResource.d.ts +29 -0
  159. package/types/Tax/CalculationLineItems.d.ts +1 -0
  160. package/types/Tax/Calculations.d.ts +4 -1
  161. package/types/Tax/CalculationsResource.d.ts +2 -1
  162. package/types/Tax/Forms.d.ts +220 -0
  163. package/types/Tax/FormsResource.d.ts +107 -0
  164. package/types/Tax/Transactions.d.ts +3 -1
  165. package/types/TaxIds.d.ts +2 -1
  166. package/types/TaxIdsResource.d.ts +2 -1
  167. package/types/TaxRates.d.ts +1 -0
  168. package/types/TaxRatesResource.d.ts +2 -0
  169. package/types/Terminal/ReaderCollectedData.d.ts +51 -0
  170. package/types/Terminal/ReaderCollectedDataResource.d.ts +29 -0
  171. package/types/Terminal/Readers.d.ts +278 -0
  172. package/types/Terminal/ReadersResource.d.ts +215 -0
  173. package/types/TestHelpers/ConfirmationTokensResource.d.ts +104 -0
  174. package/types/TestHelpers/Issuing/AuthorizationsResource.d.ts +14 -4
  175. package/types/TestHelpers/Treasury/ReceivedCreditsResource.d.ts +26 -0
  176. package/types/TestHelpers/Treasury/ReceivedDebitsResource.d.ts +26 -0
  177. package/types/Treasury/FinancialAccountFeatures.d.ts +7 -0
  178. package/types/Treasury/FinancialAccounts.d.ts +5 -0
  179. package/types/Treasury/FinancialAccountsResource.d.ts +37 -0
  180. package/types/Treasury/InboundTransfers.d.ts +1 -1
  181. package/types/Treasury/OutboundTransfers.d.ts +26 -0
  182. package/types/Treasury/OutboundTransfersResource.d.ts +26 -0
  183. package/types/Treasury/ReceivedCredits.d.ts +26 -0
  184. package/types/Treasury/ReceivedDebits.d.ts +31 -0
  185. package/types/WebhookEndpointsResource.d.ts +68 -0
  186. package/types/index.d.ts +74 -4
  187. package/cjs/resources/V2/Billing.js +0 -18
  188. package/cjs/resources/V2/Core.js +0 -14
  189. package/cjs/resources/V2.js +0 -14
  190. package/esm/resources/V2/Billing.js +0 -15
  191. package/esm/resources/V2/Core.js +0 -11
  192. package/esm/resources/V2.js +0 -11
  193. package/types/V2/BillingResource.d.ts +0 -14
  194. package/types/V2/CoreResource.d.ts +0 -12
  195. package/types/V2Resource.d.ts +0 -10
@@ -3,6 +3,11 @@
3
3
  declare module 'stripe' {
4
4
  namespace Stripe {
5
5
  interface QuoteCreateParams {
6
+ /**
7
+ * Set to true to allow quote lines to have `starts_at` in the past if collection is paused between `starts_at` and now.
8
+ */
9
+ allow_backdated_lines?: boolean;
10
+
6
11
  /**
7
12
  * The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. There cannot be any line items with recurring prices when using this field.
8
13
  */
@@ -78,6 +83,11 @@ declare module 'stripe' {
78
83
  */
79
84
  line_items?: Array<QuoteCreateParams.LineItem>;
80
85
 
86
+ /**
87
+ * A list of [quote lines](https://docs.stripe.com/api/quote_lines) on the quote. These lines describe changes, in the order provided, that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
88
+ */
89
+ lines?: Array<QuoteCreateParams.Line>;
90
+
81
91
  /**
82
92
  * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
83
93
  */
@@ -93,6 +103,13 @@ declare module 'stripe' {
93
103
  */
94
104
  subscription_data?: QuoteCreateParams.SubscriptionData;
95
105
 
106
+ /**
107
+ * List representing overrides for `subscription_data` configurations for specific subscription schedules.
108
+ */
109
+ subscription_data_overrides?: Array<
110
+ QuoteCreateParams.SubscriptionDataOverride
111
+ >;
112
+
96
113
  /**
97
114
  * ID of the test clock to attach to the quote.
98
115
  */
@@ -148,12 +165,56 @@ declare module 'stripe' {
148
165
  */
149
166
  discount?: string;
150
167
 
168
+ /**
169
+ * Details to determine how long the discount should be applied for.
170
+ */
171
+ discount_end?: Discount.DiscountEnd;
172
+
151
173
  /**
152
174
  * ID of the promotion code to create a new discount for.
153
175
  */
154
176
  promotion_code?: string;
155
177
  }
156
178
 
179
+ namespace Discount {
180
+ interface DiscountEnd {
181
+ /**
182
+ * Time span for the redeemed discount.
183
+ */
184
+ duration?: DiscountEnd.Duration;
185
+
186
+ /**
187
+ * A precise Unix timestamp for the discount to end. Must be in the future.
188
+ */
189
+ timestamp?: number;
190
+
191
+ /**
192
+ * The type of calculation made to determine when the discount ends.
193
+ */
194
+ type: DiscountEnd.Type;
195
+ }
196
+
197
+ namespace DiscountEnd {
198
+ interface Duration {
199
+ /**
200
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
201
+ */
202
+ interval: Duration.Interval;
203
+
204
+ /**
205
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
206
+ */
207
+ interval_count: number;
208
+ }
209
+
210
+ namespace Duration {
211
+ type Interval = 'day' | 'month' | 'week' | 'year';
212
+ }
213
+
214
+ type Type = 'duration' | 'timestamp';
215
+ }
216
+ }
217
+
157
218
  interface FromQuote {
158
219
  /**
159
220
  * Whether this quote is a revision of the previous quote.
@@ -196,226 +257,1257 @@ declare module 'stripe' {
196
257
  }
197
258
  }
198
259
 
199
- interface LineItem {
260
+ interface Line {
200
261
  /**
201
- * The discounts applied to this line item.
262
+ * An array of operations the quote line performs.
202
263
  */
203
- discounts?: Stripe.Emptyable<Array<LineItem.Discount>>;
264
+ actions?: Array<Line.Action>;
204
265
 
205
266
  /**
206
- * The ID of the price object. One of `price` or `price_data` is required.
267
+ * Details to identify the subscription schedule the quote line applies to.
207
268
  */
208
- price?: string;
269
+ applies_to?: Line.AppliesTo;
209
270
 
210
271
  /**
211
- * Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
272
+ * For point-in-time quote lines (having no `ends_at` timestamp), this attribute lets you set or remove whether the subscription's billing cycle anchor is reset at the Quote Line `starts_at` timestamp.For time-span based quote lines (having both `starts_at` and `ends_at`), the only valid value is `automatic`, which removes any previously configured billing cycle anchor resets during the window of time spanning the quote line.
212
273
  */
213
- price_data?: LineItem.PriceData;
274
+ billing_cycle_anchor?: Line.BillingCycleAnchor;
214
275
 
215
276
  /**
216
- * The quantity of the line item.
277
+ * A point-in-time operation that cancels an existing subscription schedule at the line's starts_at timestamp. Currently only compatible with `quote_acceptance_date` for `starts_at`. When using cancel_subscription_schedule, the subscription schedule on the quote remains unalterable, except for modifications to the metadata, collection_method or invoice_settings.
217
278
  */
218
- quantity?: number;
279
+ cancel_subscription_schedule?: Line.CancelSubscriptionSchedule;
219
280
 
220
281
  /**
221
- * The tax rates which apply to the line item. When set, the `default_tax_rates` on the quote do not apply to this line item.
282
+ * Details to identify the end of the time range modified by the proposed change. If not supplied, the quote line is considered a point-in-time operation that only affects the exact timestamp at `starts_at`, and a restricted set of attributes is supported on the quote line.
222
283
  */
223
- tax_rates?: Stripe.Emptyable<Array<string>>;
284
+ ends_at?: Line.EndsAt;
285
+
286
+ /**
287
+ * Changes to how Stripe handles prorations during the quote line's time span. Affects if and how prorations are created when a future phase starts.
288
+ */
289
+ proration_behavior?: Line.ProrationBehavior;
290
+
291
+ /**
292
+ * Defines how to pause collection for the underlying subscription throughout the duration of the amendment.
293
+ */
294
+ set_pause_collection?: Line.SetPauseCollection;
295
+
296
+ /**
297
+ * Timestamp helper to end the underlying schedule early, based on the acompanying line's start or end date.
298
+ */
299
+ set_schedule_end?: Line.SetScheduleEnd;
300
+
301
+ /**
302
+ * Details to identify the earliest timestamp where the proposed change should take effect.
303
+ */
304
+ starts_at?: Line.StartsAt;
305
+
306
+ /**
307
+ * Settings related to subscription trials.
308
+ */
309
+ trial_settings?: Line.TrialSettings;
224
310
  }
225
311
 
226
- namespace LineItem {
227
- interface Discount {
312
+ namespace Line {
313
+ interface Action {
228
314
  /**
229
- * ID of the coupon to create a new discount for.
315
+ * Details for the `add_discount` type.
230
316
  */
231
- coupon?: string;
317
+ add_discount?: Action.AddDiscount;
232
318
 
233
319
  /**
234
- * ID of an existing discount on the object (or one of its ancestors) to reuse.
320
+ * Details for the `add_item` type.
235
321
  */
236
- discount?: string;
322
+ add_item?: Action.AddItem;
237
323
 
238
324
  /**
239
- * ID of the promotion code to create a new discount for.
325
+ * Details for the `add_metadata` type: specify a hash of key-value pairs.
240
326
  */
241
- promotion_code?: string;
242
- }
327
+ add_metadata?: {
328
+ [key: string]: string;
329
+ };
243
330
 
244
- interface PriceData {
245
331
  /**
246
- * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
332
+ * Details for the `remove_discount` type.
247
333
  */
248
- currency: string;
334
+ remove_discount?: Action.RemoveDiscount;
249
335
 
250
336
  /**
251
- * The ID of the product that this price will belong to.
337
+ * Details for the `remove_item` type.
252
338
  */
253
- product: string;
339
+ remove_item?: Action.RemoveItem;
254
340
 
255
341
  /**
256
- * The recurring components of a price such as `interval` and `interval_count`.
342
+ * Details for the `remove_metadata` type: specify an array of metadata keys.
257
343
  */
258
- recurring?: PriceData.Recurring;
344
+ remove_metadata?: Array<string>;
259
345
 
260
346
  /**
261
- * Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
347
+ * Details for the `set_discounts` type.
262
348
  */
263
- tax_behavior?: PriceData.TaxBehavior;
349
+ set_discounts?: Array<Action.SetDiscount>;
264
350
 
265
351
  /**
266
- * A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
352
+ * Details for the `set_items` type.
267
353
  */
268
- unit_amount?: number;
354
+ set_items?: Array<Action.SetItem>;
269
355
 
270
356
  /**
271
- * Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
357
+ * Details for the `set_metadata` type: specify an array of key-value pairs.
272
358
  */
273
- unit_amount_decimal?: string;
359
+ set_metadata?: Stripe.Emptyable<{
360
+ [key: string]: string;
361
+ }>;
362
+
363
+ /**
364
+ * The type of action the quote line performs.
365
+ */
366
+ type: Action.Type;
274
367
  }
275
368
 
276
- namespace PriceData {
277
- interface Recurring {
369
+ namespace Action {
370
+ interface AddDiscount {
278
371
  /**
279
- * Specifies billing frequency. Either `day`, `week`, `month` or `year`.
372
+ * The coupon code to redeem.
280
373
  */
281
- interval: Recurring.Interval;
374
+ coupon?: string;
282
375
 
283
376
  /**
284
- * The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
377
+ * An ID of an existing discount for a coupon that was already redeemed.
285
378
  */
286
- interval_count?: number;
379
+ discount?: string;
380
+
381
+ /**
382
+ * Details to determine how long the discount should be applied for.
383
+ */
384
+ discount_end?: AddDiscount.DiscountEnd;
385
+
386
+ /**
387
+ * The index, starting at 0, at which to position the new discount. When not supplied, Stripe defaults to appending the discount to the end of the `discounts` array.
388
+ */
389
+ index?: number;
390
+
391
+ /**
392
+ * The promotion code to redeem.
393
+ */
394
+ promotion_code?: string;
287
395
  }
288
396
 
289
- namespace Recurring {
290
- type Interval = 'day' | 'month' | 'week' | 'year';
397
+ namespace AddDiscount {
398
+ interface DiscountEnd {
399
+ /**
400
+ * The type of calculation made to determine when the discount ends.
401
+ */
402
+ type: 'line_ends_at';
403
+ }
291
404
  }
292
405
 
293
- type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
294
- }
295
- }
406
+ interface AddItem {
407
+ /**
408
+ * The discounts applied to the item. Subscription item discounts are applied before subscription discounts.
409
+ */
410
+ discounts?: Array<AddItem.Discount>;
296
411
 
297
- interface SubscriptionData {
298
- /**
299
- * The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
300
- */
301
- description?: string;
412
+ /**
413
+ * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
414
+ */
415
+ metadata?: Stripe.MetadataParam;
302
416
 
303
- /**
304
- * When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. When updating a subscription, the date of which the subscription will be updated using a subscription schedule. The special value `current_period_end` can be provided to update a subscription at the end of its current period. The `effective_date` is ignored if it is in the past when the quote is accepted.
305
- */
306
- effective_date?: Stripe.Emptyable<'current_period_end' | number>;
417
+ /**
418
+ * The ID of the price object.
419
+ */
420
+ price: string;
307
421
 
308
- /**
309
- * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on the subscription or subscription schedule when the quote is accepted. If a recurring price is included in `line_items`, this field will be passed to the resulting subscription's `metadata` field. If `subscription_data.effective_date` is used, this field will be passed to the resulting subscription schedule's `phases.metadata` field. Unlike object-level metadata, this field is declarative. Updates will clear prior values.
310
- */
311
- metadata?: Stripe.MetadataParam;
422
+ /**
423
+ * Quantity for this item.
424
+ */
425
+ quantity?: number;
312
426
 
313
- /**
314
- * Integer representing the number of trial period days before the customer is charged for the first time.
315
- */
316
- trial_period_days?: Stripe.Emptyable<number>;
317
- }
427
+ /**
428
+ * The tax rates that apply to this subscription item. When set, the `default_tax_rates` on the subscription do not apply to this `subscription_item`.
429
+ */
430
+ tax_rates?: Array<string>;
318
431
 
319
- interface TransferData {
320
- /**
321
- * The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred. There cannot be any line items with recurring prices when using this field.
322
- */
323
- amount?: number;
432
+ /**
433
+ * Options that configure the trial on the subscription item.
434
+ */
435
+ trial?: AddItem.Trial;
436
+ }
324
437
 
325
- /**
326
- * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination. There must be at least 1 line item with a recurring price to use this field.
327
- */
328
- amount_percent?: number;
438
+ namespace AddItem {
439
+ interface Discount {
440
+ /**
441
+ * ID of the coupon to create a new discount for.
442
+ */
443
+ coupon?: string;
444
+
445
+ /**
446
+ * ID of an existing discount on the object (or one of its ancestors) to reuse.
447
+ */
448
+ discount?: string;
449
+
450
+ /**
451
+ * Details to determine how long the discount should be applied for.
452
+ */
453
+ discount_end?: Discount.DiscountEnd;
454
+
455
+ /**
456
+ * ID of the promotion code to create a new discount for.
457
+ */
458
+ promotion_code?: string;
459
+ }
460
+
461
+ namespace Discount {
462
+ interface DiscountEnd {
463
+ /**
464
+ * Time span for the redeemed discount.
465
+ */
466
+ duration?: DiscountEnd.Duration;
467
+
468
+ /**
469
+ * A precise Unix timestamp for the discount to end. Must be in the future.
470
+ */
471
+ timestamp?: number;
472
+
473
+ /**
474
+ * The type of calculation made to determine when the discount ends.
475
+ */
476
+ type: DiscountEnd.Type;
477
+ }
478
+
479
+ namespace DiscountEnd {
480
+ interface Duration {
481
+ /**
482
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
483
+ */
484
+ interval: Duration.Interval;
485
+
486
+ /**
487
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
488
+ */
489
+ interval_count: number;
490
+ }
491
+
492
+ namespace Duration {
493
+ type Interval = 'day' | 'month' | 'week' | 'year';
494
+ }
495
+
496
+ type Type = 'duration' | 'timestamp';
497
+ }
498
+ }
499
+
500
+ interface Trial {
501
+ /**
502
+ * List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
503
+ */
504
+ converts_to?: Array<string>;
505
+
506
+ /**
507
+ * Determines the type of trial for this item.
508
+ */
509
+ type: Trial.Type;
510
+ }
511
+
512
+ namespace Trial {
513
+ type Type = 'free' | 'paid';
514
+ }
515
+ }
329
516
 
330
- /**
331
- * ID of an existing, connected Stripe account.
332
- */
333
- destination: string;
334
- }
335
- }
517
+ interface RemoveDiscount {
518
+ /**
519
+ * The coupon code to remove from the `discounts` array.
520
+ */
521
+ coupon?: string;
336
522
 
337
- interface QuoteRetrieveParams {
338
- /**
339
- * Specifies which fields in the response should be expanded.
340
- */
341
- expand?: Array<string>;
342
- }
523
+ /**
524
+ * The ID of a discount to remove from the `discounts` array.
525
+ */
526
+ discount?: string;
343
527
 
344
- interface QuoteUpdateParams {
345
- /**
346
- * The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. There cannot be any line items with recurring prices when using this field.
347
- */
348
- application_fee_amount?: Stripe.Emptyable<number>;
528
+ /**
529
+ * The ID of a promotion code to remove from the `discounts` array.
530
+ */
531
+ promotion_code?: string;
532
+ }
349
533
 
350
- /**
351
- * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. There must be at least 1 line item with a recurring price to use this field.
352
- */
353
- application_fee_percent?: Stripe.Emptyable<number>;
534
+ interface RemoveItem {
535
+ /**
536
+ * ID of a price to remove.
537
+ */
538
+ price: string;
539
+ }
354
540
 
355
- /**
356
- * Settings for automatic tax lookup for this quote and resulting invoices and subscriptions.
357
- */
358
- automatic_tax?: QuoteUpdateParams.AutomaticTax;
541
+ interface SetDiscount {
542
+ /**
543
+ * The coupon code to replace the `discounts` array with.
544
+ */
545
+ coupon?: string;
359
546
 
360
- /**
361
- * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically`.
362
- */
363
- collection_method?: QuoteUpdateParams.CollectionMethod;
547
+ /**
548
+ * An ID of an existing discount to replace the `discounts` array with.
549
+ */
550
+ discount?: string;
364
551
 
365
- /**
366
- * The customer for which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
367
- */
368
- customer?: string;
552
+ /**
553
+ * An ID of an existing promotion code to replace the `discounts` array with.
554
+ */
555
+ promotion_code?: string;
556
+ }
369
557
 
370
- /**
371
- * The tax rates that will apply to any line item that does not have `tax_rates` set.
372
- */
373
- default_tax_rates?: Stripe.Emptyable<Array<string>>;
558
+ interface SetItem {
559
+ /**
560
+ * If an item with the `price` already exists, passing this will override the `discounts` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `discounts`.
561
+ */
562
+ discounts?: Array<SetItem.Discount>;
374
563
 
375
- /**
376
- * A description that will be displayed on the quote PDF.
377
- */
378
- description?: Stripe.Emptyable<string>;
564
+ /**
565
+ * If an item with the `price` already exists, passing this will override the `metadata` on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `metadata`.
566
+ */
567
+ metadata?: Stripe.MetadataParam;
379
568
 
380
- /**
381
- * The discounts applied to the quote.
382
- */
383
- discounts?: Stripe.Emptyable<Array<QuoteUpdateParams.Discount>>;
569
+ /**
570
+ * The ID of the price object.
571
+ */
572
+ price: string;
384
573
 
385
- /**
386
- * Specifies which fields in the response should be expanded.
387
- */
388
- expand?: Array<string>;
574
+ /**
575
+ * If an item with the `price` already exists, passing this will override the quantity on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `quantity`.
576
+ */
577
+ quantity?: number;
389
578
 
390
- /**
391
- * A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch.
392
- */
393
- expires_at?: number;
579
+ /**
580
+ * If an item with the `price` already exists, passing this will override the `tax_rates` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `tax_rates`.
581
+ */
582
+ tax_rates?: Array<string>;
394
583
 
395
- /**
396
- * A footer that will be displayed on the quote PDF.
397
- */
398
- footer?: Stripe.Emptyable<string>;
584
+ /**
585
+ * If an item with the `price` already exists, passing this will override the `trial` configuration on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `trial`.
586
+ */
587
+ trial?: SetItem.Trial;
588
+ }
399
589
 
400
- /**
401
- * A header that will be displayed on the quote PDF.
402
- */
403
- header?: Stripe.Emptyable<string>;
590
+ namespace SetItem {
591
+ interface Discount {
592
+ /**
593
+ * ID of the coupon to create a new discount for.
594
+ */
595
+ coupon?: string;
596
+
597
+ /**
598
+ * ID of an existing discount on the object (or one of its ancestors) to reuse.
599
+ */
600
+ discount?: string;
601
+
602
+ /**
603
+ * Details to determine how long the discount should be applied for.
604
+ */
605
+ discount_end?: Discount.DiscountEnd;
606
+
607
+ /**
608
+ * ID of the promotion code to create a new discount for.
609
+ */
610
+ promotion_code?: string;
611
+ }
612
+
613
+ namespace Discount {
614
+ interface DiscountEnd {
615
+ /**
616
+ * Time span for the redeemed discount.
617
+ */
618
+ duration?: DiscountEnd.Duration;
619
+
620
+ /**
621
+ * A precise Unix timestamp for the discount to end. Must be in the future.
622
+ */
623
+ timestamp?: number;
624
+
625
+ /**
626
+ * The type of calculation made to determine when the discount ends.
627
+ */
628
+ type: DiscountEnd.Type;
629
+ }
630
+
631
+ namespace DiscountEnd {
632
+ interface Duration {
633
+ /**
634
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
635
+ */
636
+ interval: Duration.Interval;
637
+
638
+ /**
639
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
640
+ */
641
+ interval_count: number;
642
+ }
643
+
644
+ namespace Duration {
645
+ type Interval = 'day' | 'month' | 'week' | 'year';
646
+ }
647
+
648
+ type Type = 'duration' | 'timestamp';
649
+ }
650
+ }
651
+
652
+ interface Trial {
653
+ /**
654
+ * List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
655
+ */
656
+ converts_to?: Array<string>;
657
+
658
+ /**
659
+ * Determines the type of trial for this item.
660
+ */
661
+ type: Trial.Type;
662
+ }
663
+
664
+ namespace Trial {
665
+ type Type = 'free' | 'paid';
666
+ }
667
+ }
404
668
 
405
- /**
406
- * All invoices will be billed using the specified settings.
407
- */
408
- invoice_settings?: QuoteUpdateParams.InvoiceSettings;
669
+ type Type =
670
+ | 'add_discount'
671
+ | 'add_item'
672
+ | 'add_metadata'
673
+ | 'clear_discounts'
674
+ | 'clear_metadata'
675
+ | 'remove_discount'
676
+ | 'remove_item'
677
+ | 'remove_metadata'
678
+ | 'set_discounts'
679
+ | 'set_items'
680
+ | 'set_metadata';
681
+ }
409
682
 
410
- /**
411
- * A list of line items the customer is being quoted for. Each line item includes information about the product, the quantity, and the resulting cost.
412
- */
413
- line_items?: Array<QuoteUpdateParams.LineItem>;
683
+ interface AppliesTo {
684
+ /**
685
+ * A custom string that identifies a new subscription schedule being created upon quote acceptance. All quote lines with the same `new_reference` field will be applied to the creation of a new subscription schedule.
686
+ */
687
+ new_reference?: string;
414
688
 
415
- /**
416
- * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
417
- */
418
- metadata?: Stripe.MetadataParam;
689
+ /**
690
+ * The ID of the schedule the line applies to.
691
+ */
692
+ subscription_schedule?: string;
693
+
694
+ /**
695
+ * Describes whether the quote line is affecting a new schedule or an existing schedule.
696
+ */
697
+ type: AppliesTo.Type;
698
+ }
699
+
700
+ namespace AppliesTo {
701
+ type Type = 'new_reference' | 'subscription_schedule';
702
+ }
703
+
704
+ type BillingCycleAnchor = 'automatic' | 'line_starts_at';
705
+
706
+ interface CancelSubscriptionSchedule {
707
+ /**
708
+ * Timestamp helper to cancel the underlying schedule on the accompanying line's start date. Must be set to `line_starts_at`.
709
+ */
710
+ cancel_at: 'line_starts_at';
711
+
712
+ /**
713
+ * If the subscription schedule is `active`, indicates if a final invoice will be generated that contains any un-invoiced metered usage and new/pending proration invoice items. Boolean that defaults to `true`.
714
+ */
715
+ invoice_now?: boolean;
716
+
717
+ /**
718
+ * If the subscription schedule is `active`, indicates if the cancellation should be prorated. Boolean that defaults to `true`.
719
+ */
720
+ prorate?: boolean;
721
+ }
722
+
723
+ interface EndsAt {
724
+ /**
725
+ * Use the `end` time of a given discount.
726
+ */
727
+ discount_end?: EndsAt.DiscountEnd;
728
+
729
+ /**
730
+ * Time span for the quote line starting from the `starts_at` date.
731
+ */
732
+ duration?: EndsAt.Duration;
733
+
734
+ /**
735
+ * A precise Unix timestamp.
736
+ */
737
+ timestamp?: number;
738
+
739
+ /**
740
+ * Select a way to pass in `ends_at`.
741
+ */
742
+ type: EndsAt.Type;
743
+ }
744
+
745
+ namespace EndsAt {
746
+ interface DiscountEnd {
747
+ /**
748
+ * The ID of a specific discount.
749
+ */
750
+ discount: string;
751
+ }
752
+
753
+ interface Duration {
754
+ /**
755
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
756
+ */
757
+ interval: Duration.Interval;
758
+
759
+ /**
760
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
761
+ */
762
+ interval_count: number;
763
+ }
764
+
765
+ namespace Duration {
766
+ type Interval = 'day' | 'month' | 'week' | 'year';
767
+ }
768
+
769
+ type Type =
770
+ | 'billing_period_end'
771
+ | 'discount_end'
772
+ | 'duration'
773
+ | 'quote_acceptance_date'
774
+ | 'schedule_end'
775
+ | 'timestamp'
776
+ | 'upcoming_invoice';
777
+ }
778
+
779
+ type ProrationBehavior =
780
+ | 'always_invoice'
781
+ | 'create_prorations'
782
+ | 'none';
783
+
784
+ interface SetPauseCollection {
785
+ /**
786
+ * Details of the pause_collection behavior to apply to the amendment.
787
+ */
788
+ set?: SetPauseCollection.Set;
789
+
790
+ /**
791
+ * Determines the type of the pause_collection amendment.
792
+ */
793
+ type: SetPauseCollection.Type;
794
+ }
795
+
796
+ namespace SetPauseCollection {
797
+ interface Set {
798
+ /**
799
+ * The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
800
+ */
801
+ behavior: Set.Behavior;
802
+ }
803
+
804
+ namespace Set {
805
+ type Behavior = 'keep_as_draft' | 'mark_uncollectible' | 'void';
806
+ }
807
+
808
+ type Type = 'remove' | 'set';
809
+ }
810
+
811
+ type SetScheduleEnd = 'line_ends_at' | 'line_starts_at';
812
+
813
+ interface StartsAt {
814
+ /**
815
+ * Use the `end` time of a given discount.
816
+ */
817
+ discount_end?: StartsAt.DiscountEnd;
818
+
819
+ /**
820
+ * The timestamp the given line ends at.
821
+ */
822
+ line_ends_at?: StartsAt.LineEndsAt;
823
+
824
+ /**
825
+ * A precise Unix timestamp.
826
+ */
827
+ timestamp?: number;
828
+
829
+ /**
830
+ * Select a way to pass in `starts_at`.
831
+ */
832
+ type: StartsAt.Type;
833
+ }
834
+
835
+ namespace StartsAt {
836
+ interface DiscountEnd {
837
+ /**
838
+ * The ID of a specific discount.
839
+ */
840
+ discount: string;
841
+ }
842
+
843
+ interface LineEndsAt {
844
+ /**
845
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
846
+ */
847
+ index?: number;
848
+ }
849
+
850
+ type Type =
851
+ | 'discount_end'
852
+ | 'line_ends_at'
853
+ | 'now'
854
+ | 'quote_acceptance_date'
855
+ | 'schedule_end'
856
+ | 'timestamp'
857
+ | 'upcoming_invoice';
858
+ }
859
+
860
+ interface TrialSettings {
861
+ /**
862
+ * Defines how the subscription should behave when a trial ends.
863
+ */
864
+ end_behavior?: TrialSettings.EndBehavior;
865
+ }
866
+
867
+ namespace TrialSettings {
868
+ interface EndBehavior {
869
+ /**
870
+ * Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
871
+ */
872
+ prorate_up_front?: EndBehavior.ProrateUpFront;
873
+ }
874
+
875
+ namespace EndBehavior {
876
+ type ProrateUpFront = 'defer' | 'include';
877
+ }
878
+ }
879
+ }
880
+
881
+ interface LineItem {
882
+ /**
883
+ * The discounts applied to this line item.
884
+ */
885
+ discounts?: Stripe.Emptyable<Array<LineItem.Discount>>;
886
+
887
+ /**
888
+ * The ID of the price object. One of `price` or `price_data` is required.
889
+ */
890
+ price?: string;
891
+
892
+ /**
893
+ * Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
894
+ */
895
+ price_data?: LineItem.PriceData;
896
+
897
+ /**
898
+ * The quantity of the line item.
899
+ */
900
+ quantity?: number;
901
+
902
+ /**
903
+ * The tax rates which apply to the line item. When set, the `default_tax_rates` on the quote do not apply to this line item.
904
+ */
905
+ tax_rates?: Stripe.Emptyable<Array<string>>;
906
+ }
907
+
908
+ namespace LineItem {
909
+ interface Discount {
910
+ /**
911
+ * ID of the coupon to create a new discount for.
912
+ */
913
+ coupon?: string;
914
+
915
+ /**
916
+ * ID of an existing discount on the object (or one of its ancestors) to reuse.
917
+ */
918
+ discount?: string;
919
+
920
+ /**
921
+ * Details to determine how long the discount should be applied for.
922
+ */
923
+ discount_end?: Discount.DiscountEnd;
924
+
925
+ /**
926
+ * ID of the promotion code to create a new discount for.
927
+ */
928
+ promotion_code?: string;
929
+ }
930
+
931
+ namespace Discount {
932
+ interface DiscountEnd {
933
+ /**
934
+ * Time span for the redeemed discount.
935
+ */
936
+ duration?: DiscountEnd.Duration;
937
+
938
+ /**
939
+ * A precise Unix timestamp for the discount to end. Must be in the future.
940
+ */
941
+ timestamp?: number;
942
+
943
+ /**
944
+ * The type of calculation made to determine when the discount ends.
945
+ */
946
+ type: DiscountEnd.Type;
947
+ }
948
+
949
+ namespace DiscountEnd {
950
+ interface Duration {
951
+ /**
952
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
953
+ */
954
+ interval: Duration.Interval;
955
+
956
+ /**
957
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
958
+ */
959
+ interval_count: number;
960
+ }
961
+
962
+ namespace Duration {
963
+ type Interval = 'day' | 'month' | 'week' | 'year';
964
+ }
965
+
966
+ type Type = 'duration' | 'timestamp';
967
+ }
968
+ }
969
+
970
+ interface PriceData {
971
+ /**
972
+ * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
973
+ */
974
+ currency: string;
975
+
976
+ /**
977
+ * The ID of the product that this price will belong to.
978
+ */
979
+ product: string;
980
+
981
+ /**
982
+ * The recurring components of a price such as `interval` and `interval_count`.
983
+ */
984
+ recurring?: PriceData.Recurring;
985
+
986
+ /**
987
+ * Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
988
+ */
989
+ tax_behavior?: PriceData.TaxBehavior;
990
+
991
+ /**
992
+ * A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
993
+ */
994
+ unit_amount?: number;
995
+
996
+ /**
997
+ * Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
998
+ */
999
+ unit_amount_decimal?: string;
1000
+ }
1001
+
1002
+ namespace PriceData {
1003
+ interface Recurring {
1004
+ /**
1005
+ * Specifies billing frequency. Either `day`, `week`, `month` or `year`.
1006
+ */
1007
+ interval: Recurring.Interval;
1008
+
1009
+ /**
1010
+ * The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
1011
+ */
1012
+ interval_count?: number;
1013
+ }
1014
+
1015
+ namespace Recurring {
1016
+ type Interval = 'day' | 'month' | 'week' | 'year';
1017
+ }
1018
+
1019
+ type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
1020
+ }
1021
+ }
1022
+
1023
+ interface SubscriptionData {
1024
+ /**
1025
+ * Describes the period to bill for upon accepting the quote.
1026
+ */
1027
+ bill_on_acceptance?: SubscriptionData.BillOnAcceptance;
1028
+
1029
+ /**
1030
+ * Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front.
1031
+ */
1032
+ billing_behavior?: SubscriptionData.BillingBehavior;
1033
+
1034
+ /**
1035
+ * When specified as `reset`, the subscription will always start a new billing period when the quote is accepted.
1036
+ */
1037
+ billing_cycle_anchor?: Stripe.Emptyable<'reset'>;
1038
+
1039
+ /**
1040
+ * The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
1041
+ */
1042
+ description?: string;
1043
+
1044
+ /**
1045
+ * When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. When updating a subscription, the date of which the subscription will be updated using a subscription schedule. The special value `current_period_end` can be provided to update a subscription at the end of its current period. The `effective_date` is ignored if it is in the past when the quote is accepted.
1046
+ */
1047
+ effective_date?: Stripe.Emptyable<'current_period_end' | number>;
1048
+
1049
+ /**
1050
+ * Behavior of the subscription schedule and underlying subscription when it ends.
1051
+ */
1052
+ end_behavior?: SubscriptionData.EndBehavior;
1053
+
1054
+ /**
1055
+ * The id of a subscription that the quote will update. By default, the quote will contain the state of the subscription (such as line items, collection method and billing thresholds) unless overridden.
1056
+ */
1057
+ from_subscription?: string;
1058
+
1059
+ /**
1060
+ * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on the subscription or subscription schedule when the quote is accepted. If a recurring price is included in `line_items`, this field will be passed to the resulting subscription's `metadata` field. If `subscription_data.effective_date` is used, this field will be passed to the resulting subscription schedule's `phases.metadata` field. Unlike object-level metadata, this field is declarative. Updates will clear prior values.
1061
+ */
1062
+ metadata?: Stripe.MetadataParam;
1063
+
1064
+ /**
1065
+ * If specified, the invoicing for the given billing cycle iterations will be processed when the quote is accepted. Cannot be used with `effective_date`.
1066
+ */
1067
+ prebilling?: Stripe.Emptyable<SubscriptionData.Prebilling>;
1068
+
1069
+ /**
1070
+ * Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations). When creating a subscription, valid values are `create_prorations` or `none`.
1071
+ *
1072
+ * When updating a subscription, valid values are `create_prorations`, `none`, or `always_invoice`.
1073
+ *
1074
+ * Passing `create_prorations` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https://stripe.com/docs/subscriptions/upgrading-downgrading#immediate-payment). In order to always invoice immediately for prorations, pass `always_invoice`.
1075
+ *
1076
+ * Prorations can be disabled by passing `none`.
1077
+ */
1078
+ proration_behavior?: SubscriptionData.ProrationBehavior;
1079
+
1080
+ /**
1081
+ * Integer representing the number of trial period days before the customer is charged for the first time.
1082
+ */
1083
+ trial_period_days?: Stripe.Emptyable<number>;
1084
+ }
1085
+
1086
+ namespace SubscriptionData {
1087
+ type BillingBehavior = 'prorate_on_next_phase' | 'prorate_up_front';
1088
+
1089
+ interface BillOnAcceptance {
1090
+ /**
1091
+ * The start of the period to bill from when the Quote is accepted.
1092
+ */
1093
+ bill_from?: BillOnAcceptance.BillFrom;
1094
+
1095
+ /**
1096
+ * The end of the period to bill until when the Quote is accepted.
1097
+ */
1098
+ bill_until?: BillOnAcceptance.BillUntil;
1099
+ }
1100
+
1101
+ namespace BillOnAcceptance {
1102
+ interface BillFrom {
1103
+ /**
1104
+ * Details of a Quote line to start the bill period from.
1105
+ */
1106
+ line_starts_at?: BillFrom.LineStartsAt;
1107
+
1108
+ /**
1109
+ * A precise Unix timestamp.
1110
+ */
1111
+ timestamp?: number;
1112
+
1113
+ /**
1114
+ * The type of method to specify the `bill_from` time.
1115
+ */
1116
+ type: BillFrom.Type;
1117
+ }
1118
+
1119
+ namespace BillFrom {
1120
+ interface LineStartsAt {
1121
+ /**
1122
+ * The ID of a quote line.
1123
+ */
1124
+ id?: string;
1125
+
1126
+ /**
1127
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
1128
+ */
1129
+ index?: number;
1130
+ }
1131
+
1132
+ type Type =
1133
+ | 'line_starts_at'
1134
+ | 'now'
1135
+ | 'pause_collection_start'
1136
+ | 'quote_acceptance_date'
1137
+ | 'timestamp';
1138
+ }
1139
+
1140
+ interface BillUntil {
1141
+ /**
1142
+ * Details of the duration over which to bill.
1143
+ */
1144
+ duration?: BillUntil.Duration;
1145
+
1146
+ /**
1147
+ * Details of a Quote line item from which to bill until.
1148
+ */
1149
+ line_ends_at?: BillUntil.LineEndsAt;
1150
+
1151
+ /**
1152
+ * A precise Unix timestamp.
1153
+ */
1154
+ timestamp?: number;
1155
+
1156
+ /**
1157
+ * The type of method to specify the `bill_until` time.
1158
+ */
1159
+ type: BillUntil.Type;
1160
+ }
1161
+
1162
+ namespace BillUntil {
1163
+ interface Duration {
1164
+ /**
1165
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1166
+ */
1167
+ interval: Duration.Interval;
1168
+
1169
+ /**
1170
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1171
+ */
1172
+ interval_count: number;
1173
+ }
1174
+
1175
+ namespace Duration {
1176
+ type Interval = 'day' | 'month' | 'week' | 'year';
1177
+ }
1178
+
1179
+ interface LineEndsAt {
1180
+ /**
1181
+ * The ID of a quote line.
1182
+ */
1183
+ id?: string;
1184
+
1185
+ /**
1186
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
1187
+ */
1188
+ index?: number;
1189
+ }
1190
+
1191
+ type Type =
1192
+ | 'duration'
1193
+ | 'line_ends_at'
1194
+ | 'schedule_end'
1195
+ | 'timestamp'
1196
+ | 'upcoming_invoice';
1197
+ }
1198
+ }
1199
+
1200
+ type EndBehavior = 'cancel' | 'release';
1201
+
1202
+ interface Prebilling {
1203
+ /**
1204
+ * This is used to determine the number of billing cycles to prebill.
1205
+ */
1206
+ iterations: number;
1207
+ }
1208
+
1209
+ type ProrationBehavior =
1210
+ | 'always_invoice'
1211
+ | 'create_prorations'
1212
+ | 'none';
1213
+ }
1214
+
1215
+ interface SubscriptionDataOverride {
1216
+ /**
1217
+ * Whether the override applies to an existing Subscription Schedule or a new Subscription Schedule.
1218
+ */
1219
+ applies_to: SubscriptionDataOverride.AppliesTo;
1220
+
1221
+ /**
1222
+ * Describes the period to bill for upon accepting the quote.
1223
+ */
1224
+ bill_on_acceptance?: SubscriptionDataOverride.BillOnAcceptance;
1225
+
1226
+ /**
1227
+ * Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front.
1228
+ */
1229
+ billing_behavior?: SubscriptionDataOverride.BillingBehavior;
1230
+
1231
+ /**
1232
+ * The customer the Subscription Data override applies to. This is only relevant when `applies_to.type=new_reference`.
1233
+ */
1234
+ customer?: string;
1235
+
1236
+ /**
1237
+ * The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
1238
+ */
1239
+ description?: string;
1240
+
1241
+ /**
1242
+ * Behavior of the subscription schedule and underlying subscription when it ends.
1243
+ */
1244
+ end_behavior?: SubscriptionDataOverride.EndBehavior;
1245
+
1246
+ /**
1247
+ * Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations). When creating a subscription, valid values are `create_prorations` or `none`.
1248
+ *
1249
+ * When updating a subscription, valid values are `create_prorations`, `none`, or `always_invoice`.
1250
+ *
1251
+ * Passing `create_prorations` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https://stripe.com/docs/subscriptions/upgrading-downgrading#immediate-payment). In order to always invoice immediately for prorations, pass `always_invoice`.
1252
+ *
1253
+ * Prorations can be disabled by passing `none`.
1254
+ */
1255
+ proration_behavior?: SubscriptionDataOverride.ProrationBehavior;
1256
+ }
1257
+
1258
+ namespace SubscriptionDataOverride {
1259
+ interface AppliesTo {
1260
+ /**
1261
+ * A custom string that identifies a new subscription schedule being created upon quote acceptance. All quote lines with the same `new_reference` field will be applied to the creation of a new subscription schedule.
1262
+ */
1263
+ new_reference?: string;
1264
+
1265
+ /**
1266
+ * The ID of the schedule the line applies to.
1267
+ */
1268
+ subscription_schedule?: string;
1269
+
1270
+ /**
1271
+ * Describes whether the quote line is affecting a new schedule or an existing schedule.
1272
+ */
1273
+ type: AppliesTo.Type;
1274
+ }
1275
+
1276
+ namespace AppliesTo {
1277
+ type Type = 'new_reference' | 'subscription_schedule';
1278
+ }
1279
+
1280
+ type BillingBehavior = 'prorate_on_next_phase' | 'prorate_up_front';
1281
+
1282
+ interface BillOnAcceptance {
1283
+ /**
1284
+ * The start of the period to bill from when the Quote is accepted.
1285
+ */
1286
+ bill_from?: BillOnAcceptance.BillFrom;
1287
+
1288
+ /**
1289
+ * The end of the period to bill until when the Quote is accepted.
1290
+ */
1291
+ bill_until?: BillOnAcceptance.BillUntil;
1292
+ }
1293
+
1294
+ namespace BillOnAcceptance {
1295
+ interface BillFrom {
1296
+ /**
1297
+ * Details of a Quote line to start the bill period from.
1298
+ */
1299
+ line_starts_at?: BillFrom.LineStartsAt;
1300
+
1301
+ /**
1302
+ * A precise Unix timestamp.
1303
+ */
1304
+ timestamp?: number;
1305
+
1306
+ /**
1307
+ * The type of method to specify the `bill_from` time.
1308
+ */
1309
+ type: BillFrom.Type;
1310
+ }
1311
+
1312
+ namespace BillFrom {
1313
+ interface LineStartsAt {
1314
+ /**
1315
+ * The ID of a quote line.
1316
+ */
1317
+ id?: string;
1318
+
1319
+ /**
1320
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
1321
+ */
1322
+ index?: number;
1323
+ }
1324
+
1325
+ type Type =
1326
+ | 'line_starts_at'
1327
+ | 'now'
1328
+ | 'pause_collection_start'
1329
+ | 'quote_acceptance_date'
1330
+ | 'timestamp';
1331
+ }
1332
+
1333
+ interface BillUntil {
1334
+ /**
1335
+ * Details of the duration over which to bill.
1336
+ */
1337
+ duration?: BillUntil.Duration;
1338
+
1339
+ /**
1340
+ * Details of a Quote line item from which to bill until.
1341
+ */
1342
+ line_ends_at?: BillUntil.LineEndsAt;
1343
+
1344
+ /**
1345
+ * A precise Unix timestamp.
1346
+ */
1347
+ timestamp?: number;
1348
+
1349
+ /**
1350
+ * The type of method to specify the `bill_until` time.
1351
+ */
1352
+ type: BillUntil.Type;
1353
+ }
1354
+
1355
+ namespace BillUntil {
1356
+ interface Duration {
1357
+ /**
1358
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1359
+ */
1360
+ interval: Duration.Interval;
1361
+
1362
+ /**
1363
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1364
+ */
1365
+ interval_count: number;
1366
+ }
1367
+
1368
+ namespace Duration {
1369
+ type Interval = 'day' | 'month' | 'week' | 'year';
1370
+ }
1371
+
1372
+ interface LineEndsAt {
1373
+ /**
1374
+ * The ID of a quote line.
1375
+ */
1376
+ id?: string;
1377
+
1378
+ /**
1379
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
1380
+ */
1381
+ index?: number;
1382
+ }
1383
+
1384
+ type Type =
1385
+ | 'duration'
1386
+ | 'line_ends_at'
1387
+ | 'schedule_end'
1388
+ | 'timestamp'
1389
+ | 'upcoming_invoice';
1390
+ }
1391
+ }
1392
+
1393
+ type EndBehavior = 'cancel' | 'release';
1394
+
1395
+ type ProrationBehavior =
1396
+ | 'always_invoice'
1397
+ | 'create_prorations'
1398
+ | 'none';
1399
+ }
1400
+
1401
+ interface TransferData {
1402
+ /**
1403
+ * The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred. There cannot be any line items with recurring prices when using this field.
1404
+ */
1405
+ amount?: number;
1406
+
1407
+ /**
1408
+ * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination. There must be at least 1 line item with a recurring price to use this field.
1409
+ */
1410
+ amount_percent?: number;
1411
+
1412
+ /**
1413
+ * ID of an existing, connected Stripe account.
1414
+ */
1415
+ destination: string;
1416
+ }
1417
+ }
1418
+
1419
+ interface QuoteRetrieveParams {
1420
+ /**
1421
+ * Specifies which fields in the response should be expanded.
1422
+ */
1423
+ expand?: Array<string>;
1424
+ }
1425
+
1426
+ interface QuoteUpdateParams {
1427
+ /**
1428
+ * Set to true to allow quote lines to have `starts_at` in the past if collection is paused between `starts_at` and now.
1429
+ */
1430
+ allow_backdated_lines?: boolean;
1431
+
1432
+ /**
1433
+ * The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. There cannot be any line items with recurring prices when using this field.
1434
+ */
1435
+ application_fee_amount?: Stripe.Emptyable<number>;
1436
+
1437
+ /**
1438
+ * A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. There must be at least 1 line item with a recurring price to use this field.
1439
+ */
1440
+ application_fee_percent?: Stripe.Emptyable<number>;
1441
+
1442
+ /**
1443
+ * Settings for automatic tax lookup for this quote and resulting invoices and subscriptions.
1444
+ */
1445
+ automatic_tax?: QuoteUpdateParams.AutomaticTax;
1446
+
1447
+ /**
1448
+ * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically`.
1449
+ */
1450
+ collection_method?: QuoteUpdateParams.CollectionMethod;
1451
+
1452
+ /**
1453
+ * The customer for which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
1454
+ */
1455
+ customer?: string;
1456
+
1457
+ /**
1458
+ * The tax rates that will apply to any line item that does not have `tax_rates` set.
1459
+ */
1460
+ default_tax_rates?: Stripe.Emptyable<Array<string>>;
1461
+
1462
+ /**
1463
+ * A description that will be displayed on the quote PDF.
1464
+ */
1465
+ description?: Stripe.Emptyable<string>;
1466
+
1467
+ /**
1468
+ * The discounts applied to the quote.
1469
+ */
1470
+ discounts?: Stripe.Emptyable<Array<QuoteUpdateParams.Discount>>;
1471
+
1472
+ /**
1473
+ * Specifies which fields in the response should be expanded.
1474
+ */
1475
+ expand?: Array<string>;
1476
+
1477
+ /**
1478
+ * A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch.
1479
+ */
1480
+ expires_at?: number;
1481
+
1482
+ /**
1483
+ * A footer that will be displayed on the quote PDF.
1484
+ */
1485
+ footer?: Stripe.Emptyable<string>;
1486
+
1487
+ /**
1488
+ * A header that will be displayed on the quote PDF.
1489
+ */
1490
+ header?: Stripe.Emptyable<string>;
1491
+
1492
+ /**
1493
+ * All invoices will be billed using the specified settings.
1494
+ */
1495
+ invoice_settings?: QuoteUpdateParams.InvoiceSettings;
1496
+
1497
+ /**
1498
+ * A list of line items the customer is being quoted for. Each line item includes information about the product, the quantity, and the resulting cost.
1499
+ */
1500
+ line_items?: Array<QuoteUpdateParams.LineItem>;
1501
+
1502
+ /**
1503
+ * A list of [quote lines](https://docs.stripe.com/api/quote_lines) on the quote. These lines describe changes, in the order provided, that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
1504
+ */
1505
+ lines?: Array<QuoteUpdateParams.Line>;
1506
+
1507
+ /**
1508
+ * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
1509
+ */
1510
+ metadata?: Stripe.MetadataParam;
419
1511
 
420
1512
  /**
421
1513
  * The account on behalf of which to charge.
@@ -427,89 +1519,771 @@ declare module 'stripe' {
427
1519
  */
428
1520
  subscription_data?: QuoteUpdateParams.SubscriptionData;
429
1521
 
1522
+ /**
1523
+ * List representing overrides for `subscription_data` configurations for specific subscription schedules.
1524
+ */
1525
+ subscription_data_overrides?: Stripe.Emptyable<
1526
+ Array<QuoteUpdateParams.SubscriptionDataOverride>
1527
+ >;
1528
+
430
1529
  /**
431
1530
  * The data with which to automatically create a Transfer for each of the invoices.
432
1531
  */
433
1532
  transfer_data?: Stripe.Emptyable<QuoteUpdateParams.TransferData>;
434
1533
  }
435
1534
 
436
- namespace QuoteUpdateParams {
437
- interface AutomaticTax {
1535
+ namespace QuoteUpdateParams {
1536
+ interface AutomaticTax {
1537
+ /**
1538
+ * Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself.
1539
+ */
1540
+ enabled: boolean;
1541
+
1542
+ /**
1543
+ * The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
1544
+ */
1545
+ liability?: AutomaticTax.Liability;
1546
+ }
1547
+
1548
+ namespace AutomaticTax {
1549
+ interface Liability {
1550
+ /**
1551
+ * The connected account being referenced when `type` is `account`.
1552
+ */
1553
+ account?: string;
1554
+
1555
+ /**
1556
+ * Type of the account referenced in the request.
1557
+ */
1558
+ type: Liability.Type;
1559
+ }
1560
+
1561
+ namespace Liability {
1562
+ type Type = 'account' | 'self';
1563
+ }
1564
+ }
1565
+
1566
+ type CollectionMethod = 'charge_automatically' | 'send_invoice';
1567
+
1568
+ interface Discount {
1569
+ /**
1570
+ * ID of the coupon to create a new discount for.
1571
+ */
1572
+ coupon?: string;
1573
+
1574
+ /**
1575
+ * ID of an existing discount on the object (or one of its ancestors) to reuse.
1576
+ */
1577
+ discount?: string;
1578
+
1579
+ /**
1580
+ * Details to determine how long the discount should be applied for.
1581
+ */
1582
+ discount_end?: Discount.DiscountEnd;
1583
+
1584
+ /**
1585
+ * ID of the promotion code to create a new discount for.
1586
+ */
1587
+ promotion_code?: string;
1588
+ }
1589
+
1590
+ namespace Discount {
1591
+ interface DiscountEnd {
1592
+ /**
1593
+ * Time span for the redeemed discount.
1594
+ */
1595
+ duration?: DiscountEnd.Duration;
1596
+
1597
+ /**
1598
+ * A precise Unix timestamp for the discount to end. Must be in the future.
1599
+ */
1600
+ timestamp?: number;
1601
+
1602
+ /**
1603
+ * The type of calculation made to determine when the discount ends.
1604
+ */
1605
+ type: DiscountEnd.Type;
1606
+ }
1607
+
1608
+ namespace DiscountEnd {
1609
+ interface Duration {
1610
+ /**
1611
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1612
+ */
1613
+ interval: Duration.Interval;
1614
+
1615
+ /**
1616
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1617
+ */
1618
+ interval_count: number;
1619
+ }
1620
+
1621
+ namespace Duration {
1622
+ type Interval = 'day' | 'month' | 'week' | 'year';
1623
+ }
1624
+
1625
+ type Type = 'duration' | 'timestamp';
1626
+ }
1627
+ }
1628
+
1629
+ interface InvoiceSettings {
1630
+ /**
1631
+ * Number of days within which a customer must pay the invoice generated by this quote. This value will be `null` for quotes where `collection_method=charge_automatically`.
1632
+ */
1633
+ days_until_due?: number;
1634
+
1635
+ /**
1636
+ * The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
1637
+ */
1638
+ issuer?: InvoiceSettings.Issuer;
1639
+ }
1640
+
1641
+ namespace InvoiceSettings {
1642
+ interface Issuer {
1643
+ /**
1644
+ * The connected account being referenced when `type` is `account`.
1645
+ */
1646
+ account?: string;
1647
+
1648
+ /**
1649
+ * Type of the account referenced in the request.
1650
+ */
1651
+ type: Issuer.Type;
1652
+ }
1653
+
1654
+ namespace Issuer {
1655
+ type Type = 'account' | 'self';
1656
+ }
1657
+ }
1658
+
1659
+ interface Line {
1660
+ /**
1661
+ * An array of operations the quote line performs.
1662
+ */
1663
+ actions?: Array<Line.Action>;
1664
+
1665
+ /**
1666
+ * Details to identify the subscription schedule the quote line applies to.
1667
+ */
1668
+ applies_to?: Line.AppliesTo;
1669
+
1670
+ /**
1671
+ * For point-in-time quote lines (having no `ends_at` timestamp), this attribute lets you set or remove whether the subscription's billing cycle anchor is reset at the Quote Line `starts_at` timestamp.For time-span based quote lines (having both `starts_at` and `ends_at`), the only valid value is `automatic`, which removes any previously configured billing cycle anchor resets during the window of time spanning the quote line.
1672
+ */
1673
+ billing_cycle_anchor?: Line.BillingCycleAnchor;
1674
+
1675
+ /**
1676
+ * A point-in-time operation that cancels an existing subscription schedule at the line's starts_at timestamp. Currently only compatible with `quote_acceptance_date` for `starts_at`. When using cancel_subscription_schedule, the subscription schedule on the quote remains unalterable, except for modifications to the metadata, collection_method or invoice_settings.
1677
+ */
1678
+ cancel_subscription_schedule?: Line.CancelSubscriptionSchedule;
1679
+
1680
+ /**
1681
+ * Details to identify the end of the time range modified by the proposed change. If not supplied, the quote line is considered a point-in-time operation that only affects the exact timestamp at `starts_at`, and a restricted set of attributes is supported on the quote line.
1682
+ */
1683
+ ends_at?: Line.EndsAt;
1684
+
1685
+ /**
1686
+ * The ID of an existing line on the quote.
1687
+ */
1688
+ id?: string;
1689
+
1690
+ /**
1691
+ * Changes to how Stripe handles prorations during the quote line's time span. Affects if and how prorations are created when a future phase starts.
1692
+ */
1693
+ proration_behavior?: Line.ProrationBehavior;
1694
+
1695
+ /**
1696
+ * Defines how to pause collection for the underlying subscription throughout the duration of the amendment.
1697
+ */
1698
+ set_pause_collection?: Line.SetPauseCollection;
1699
+
438
1700
  /**
439
- * Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself.
1701
+ * Timestamp helper to end the underlying schedule early, based on the acompanying line's start or end date.
440
1702
  */
441
- enabled: boolean;
1703
+ set_schedule_end?: Line.SetScheduleEnd;
442
1704
 
443
1705
  /**
444
- * The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
1706
+ * Details to identify the earliest timestamp where the proposed change should take effect.
445
1707
  */
446
- liability?: AutomaticTax.Liability;
1708
+ starts_at?: Line.StartsAt;
1709
+
1710
+ /**
1711
+ * Settings related to subscription trials.
1712
+ */
1713
+ trial_settings?: Line.TrialSettings;
447
1714
  }
448
1715
 
449
- namespace AutomaticTax {
450
- interface Liability {
1716
+ namespace Line {
1717
+ interface Action {
451
1718
  /**
452
- * The connected account being referenced when `type` is `account`.
1719
+ * Details for the `add_discount` type.
453
1720
  */
454
- account?: string;
1721
+ add_discount?: Action.AddDiscount;
455
1722
 
456
1723
  /**
457
- * Type of the account referenced in the request.
1724
+ * Details for the `add_item` type.
458
1725
  */
459
- type: Liability.Type;
1726
+ add_item?: Action.AddItem;
1727
+
1728
+ /**
1729
+ * Details for the `add_metadata` type: specify a hash of key-value pairs.
1730
+ */
1731
+ add_metadata?: {
1732
+ [key: string]: string;
1733
+ };
1734
+
1735
+ /**
1736
+ * Details for the `remove_discount` type.
1737
+ */
1738
+ remove_discount?: Action.RemoveDiscount;
1739
+
1740
+ /**
1741
+ * Details for the `remove_item` type.
1742
+ */
1743
+ remove_item?: Action.RemoveItem;
1744
+
1745
+ /**
1746
+ * Details for the `remove_metadata` type: specify an array of metadata keys.
1747
+ */
1748
+ remove_metadata?: Array<string>;
1749
+
1750
+ /**
1751
+ * Details for the `set_discounts` type.
1752
+ */
1753
+ set_discounts?: Array<Action.SetDiscount>;
1754
+
1755
+ /**
1756
+ * Details for the `set_items` type.
1757
+ */
1758
+ set_items?: Array<Action.SetItem>;
1759
+
1760
+ /**
1761
+ * Details for the `set_metadata` type: specify an array of key-value pairs.
1762
+ */
1763
+ set_metadata?: Stripe.Emptyable<{
1764
+ [key: string]: string;
1765
+ }>;
1766
+
1767
+ /**
1768
+ * The type of action the quote line performs.
1769
+ */
1770
+ type: Action.Type;
460
1771
  }
461
1772
 
462
- namespace Liability {
463
- type Type = 'account' | 'self';
1773
+ namespace Action {
1774
+ interface AddDiscount {
1775
+ /**
1776
+ * The coupon code to redeem.
1777
+ */
1778
+ coupon?: string;
1779
+
1780
+ /**
1781
+ * An ID of an existing discount for a coupon that was already redeemed.
1782
+ */
1783
+ discount?: string;
1784
+
1785
+ /**
1786
+ * Details to determine how long the discount should be applied for.
1787
+ */
1788
+ discount_end?: AddDiscount.DiscountEnd;
1789
+
1790
+ /**
1791
+ * The index, starting at 0, at which to position the new discount. When not supplied, Stripe defaults to appending the discount to the end of the `discounts` array.
1792
+ */
1793
+ index?: number;
1794
+
1795
+ /**
1796
+ * The promotion code to redeem.
1797
+ */
1798
+ promotion_code?: string;
1799
+ }
1800
+
1801
+ namespace AddDiscount {
1802
+ interface DiscountEnd {
1803
+ /**
1804
+ * The type of calculation made to determine when the discount ends.
1805
+ */
1806
+ type: 'line_ends_at';
1807
+ }
1808
+ }
1809
+
1810
+ interface AddItem {
1811
+ /**
1812
+ * The discounts applied to the item. Subscription item discounts are applied before subscription discounts.
1813
+ */
1814
+ discounts?: Array<AddItem.Discount>;
1815
+
1816
+ /**
1817
+ * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
1818
+ */
1819
+ metadata?: Stripe.MetadataParam;
1820
+
1821
+ /**
1822
+ * The ID of the price object.
1823
+ */
1824
+ price: string;
1825
+
1826
+ /**
1827
+ * Quantity for this item.
1828
+ */
1829
+ quantity?: number;
1830
+
1831
+ /**
1832
+ * The tax rates that apply to this subscription item. When set, the `default_tax_rates` on the subscription do not apply to this `subscription_item`.
1833
+ */
1834
+ tax_rates?: Array<string>;
1835
+
1836
+ /**
1837
+ * Options that configure the trial on the subscription item.
1838
+ */
1839
+ trial?: AddItem.Trial;
1840
+ }
1841
+
1842
+ namespace AddItem {
1843
+ interface Discount {
1844
+ /**
1845
+ * ID of the coupon to create a new discount for.
1846
+ */
1847
+ coupon?: string;
1848
+
1849
+ /**
1850
+ * ID of an existing discount on the object (or one of its ancestors) to reuse.
1851
+ */
1852
+ discount?: string;
1853
+
1854
+ /**
1855
+ * Details to determine how long the discount should be applied for.
1856
+ */
1857
+ discount_end?: Discount.DiscountEnd;
1858
+
1859
+ /**
1860
+ * ID of the promotion code to create a new discount for.
1861
+ */
1862
+ promotion_code?: string;
1863
+ }
1864
+
1865
+ namespace Discount {
1866
+ interface DiscountEnd {
1867
+ /**
1868
+ * Time span for the redeemed discount.
1869
+ */
1870
+ duration?: DiscountEnd.Duration;
1871
+
1872
+ /**
1873
+ * A precise Unix timestamp for the discount to end. Must be in the future.
1874
+ */
1875
+ timestamp?: number;
1876
+
1877
+ /**
1878
+ * The type of calculation made to determine when the discount ends.
1879
+ */
1880
+ type: DiscountEnd.Type;
1881
+ }
1882
+
1883
+ namespace DiscountEnd {
1884
+ interface Duration {
1885
+ /**
1886
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1887
+ */
1888
+ interval: Duration.Interval;
1889
+
1890
+ /**
1891
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1892
+ */
1893
+ interval_count: number;
1894
+ }
1895
+
1896
+ namespace Duration {
1897
+ type Interval = 'day' | 'month' | 'week' | 'year';
1898
+ }
1899
+
1900
+ type Type = 'duration' | 'timestamp';
1901
+ }
1902
+ }
1903
+
1904
+ interface Trial {
1905
+ /**
1906
+ * List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
1907
+ */
1908
+ converts_to?: Array<string>;
1909
+
1910
+ /**
1911
+ * Determines the type of trial for this item.
1912
+ */
1913
+ type: Trial.Type;
1914
+ }
1915
+
1916
+ namespace Trial {
1917
+ type Type = 'free' | 'paid';
1918
+ }
1919
+ }
1920
+
1921
+ interface RemoveDiscount {
1922
+ /**
1923
+ * The coupon code to remove from the `discounts` array.
1924
+ */
1925
+ coupon?: string;
1926
+
1927
+ /**
1928
+ * The ID of a discount to remove from the `discounts` array.
1929
+ */
1930
+ discount?: string;
1931
+
1932
+ /**
1933
+ * The ID of a promotion code to remove from the `discounts` array.
1934
+ */
1935
+ promotion_code?: string;
1936
+ }
1937
+
1938
+ interface RemoveItem {
1939
+ /**
1940
+ * ID of a price to remove.
1941
+ */
1942
+ price: string;
1943
+ }
1944
+
1945
+ interface SetDiscount {
1946
+ /**
1947
+ * The coupon code to replace the `discounts` array with.
1948
+ */
1949
+ coupon?: string;
1950
+
1951
+ /**
1952
+ * An ID of an existing discount to replace the `discounts` array with.
1953
+ */
1954
+ discount?: string;
1955
+
1956
+ /**
1957
+ * An ID of an existing promotion code to replace the `discounts` array with.
1958
+ */
1959
+ promotion_code?: string;
1960
+ }
1961
+
1962
+ interface SetItem {
1963
+ /**
1964
+ * If an item with the `price` already exists, passing this will override the `discounts` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `discounts`.
1965
+ */
1966
+ discounts?: Array<SetItem.Discount>;
1967
+
1968
+ /**
1969
+ * If an item with the `price` already exists, passing this will override the `metadata` on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `metadata`.
1970
+ */
1971
+ metadata?: Stripe.MetadataParam;
1972
+
1973
+ /**
1974
+ * The ID of the price object.
1975
+ */
1976
+ price: string;
1977
+
1978
+ /**
1979
+ * If an item with the `price` already exists, passing this will override the quantity on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `quantity`.
1980
+ */
1981
+ quantity?: number;
1982
+
1983
+ /**
1984
+ * If an item with the `price` already exists, passing this will override the `tax_rates` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `tax_rates`.
1985
+ */
1986
+ tax_rates?: Array<string>;
1987
+
1988
+ /**
1989
+ * If an item with the `price` already exists, passing this will override the `trial` configuration on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `trial`.
1990
+ */
1991
+ trial?: SetItem.Trial;
1992
+ }
1993
+
1994
+ namespace SetItem {
1995
+ interface Discount {
1996
+ /**
1997
+ * ID of the coupon to create a new discount for.
1998
+ */
1999
+ coupon?: string;
2000
+
2001
+ /**
2002
+ * ID of an existing discount on the object (or one of its ancestors) to reuse.
2003
+ */
2004
+ discount?: string;
2005
+
2006
+ /**
2007
+ * Details to determine how long the discount should be applied for.
2008
+ */
2009
+ discount_end?: Discount.DiscountEnd;
2010
+
2011
+ /**
2012
+ * ID of the promotion code to create a new discount for.
2013
+ */
2014
+ promotion_code?: string;
2015
+ }
2016
+
2017
+ namespace Discount {
2018
+ interface DiscountEnd {
2019
+ /**
2020
+ * Time span for the redeemed discount.
2021
+ */
2022
+ duration?: DiscountEnd.Duration;
2023
+
2024
+ /**
2025
+ * A precise Unix timestamp for the discount to end. Must be in the future.
2026
+ */
2027
+ timestamp?: number;
2028
+
2029
+ /**
2030
+ * The type of calculation made to determine when the discount ends.
2031
+ */
2032
+ type: DiscountEnd.Type;
2033
+ }
2034
+
2035
+ namespace DiscountEnd {
2036
+ interface Duration {
2037
+ /**
2038
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2039
+ */
2040
+ interval: Duration.Interval;
2041
+
2042
+ /**
2043
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2044
+ */
2045
+ interval_count: number;
2046
+ }
2047
+
2048
+ namespace Duration {
2049
+ type Interval = 'day' | 'month' | 'week' | 'year';
2050
+ }
2051
+
2052
+ type Type = 'duration' | 'timestamp';
2053
+ }
2054
+ }
2055
+
2056
+ interface Trial {
2057
+ /**
2058
+ * List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
2059
+ */
2060
+ converts_to?: Array<string>;
2061
+
2062
+ /**
2063
+ * Determines the type of trial for this item.
2064
+ */
2065
+ type: Trial.Type;
2066
+ }
2067
+
2068
+ namespace Trial {
2069
+ type Type = 'free' | 'paid';
2070
+ }
2071
+ }
2072
+
2073
+ type Type =
2074
+ | 'add_discount'
2075
+ | 'add_item'
2076
+ | 'add_metadata'
2077
+ | 'clear_discounts'
2078
+ | 'clear_metadata'
2079
+ | 'remove_discount'
2080
+ | 'remove_item'
2081
+ | 'remove_metadata'
2082
+ | 'set_discounts'
2083
+ | 'set_items'
2084
+ | 'set_metadata';
464
2085
  }
465
- }
466
2086
 
467
- type CollectionMethod = 'charge_automatically' | 'send_invoice';
2087
+ interface AppliesTo {
2088
+ /**
2089
+ * A custom string that identifies a new subscription schedule being created upon quote acceptance. All quote lines with the same `new_reference` field will be applied to the creation of a new subscription schedule.
2090
+ */
2091
+ new_reference?: string;
468
2092
 
469
- interface Discount {
470
- /**
471
- * ID of the coupon to create a new discount for.
472
- */
473
- coupon?: string;
2093
+ /**
2094
+ * The ID of the schedule the line applies to.
2095
+ */
2096
+ subscription_schedule?: string;
474
2097
 
475
- /**
476
- * ID of an existing discount on the object (or one of its ancestors) to reuse.
477
- */
478
- discount?: string;
2098
+ /**
2099
+ * Describes whether the quote line is affecting a new schedule or an existing schedule.
2100
+ */
2101
+ type: AppliesTo.Type;
2102
+ }
479
2103
 
480
- /**
481
- * ID of the promotion code to create a new discount for.
482
- */
483
- promotion_code?: string;
484
- }
2104
+ namespace AppliesTo {
2105
+ type Type = 'new_reference' | 'subscription_schedule';
2106
+ }
485
2107
 
486
- interface InvoiceSettings {
487
- /**
488
- * Number of days within which a customer must pay the invoice generated by this quote. This value will be `null` for quotes where `collection_method=charge_automatically`.
489
- */
490
- days_until_due?: number;
2108
+ type BillingCycleAnchor = 'automatic' | 'line_starts_at';
491
2109
 
492
- /**
493
- * The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
494
- */
495
- issuer?: InvoiceSettings.Issuer;
496
- }
2110
+ interface CancelSubscriptionSchedule {
2111
+ /**
2112
+ * Timestamp helper to cancel the underlying schedule on the accompanying line's start date. Must be set to `line_starts_at`.
2113
+ */
2114
+ cancel_at: 'line_starts_at';
497
2115
 
498
- namespace InvoiceSettings {
499
- interface Issuer {
500
2116
  /**
501
- * The connected account being referenced when `type` is `account`.
2117
+ * If the subscription schedule is `active`, indicates if a final invoice will be generated that contains any un-invoiced metered usage and new/pending proration invoice items. Boolean that defaults to `true`.
502
2118
  */
503
- account?: string;
2119
+ invoice_now?: boolean;
504
2120
 
505
2121
  /**
506
- * Type of the account referenced in the request.
2122
+ * If the subscription schedule is `active`, indicates if the cancellation should be prorated. Boolean that defaults to `true`.
507
2123
  */
508
- type: Issuer.Type;
2124
+ prorate?: boolean;
509
2125
  }
510
2126
 
511
- namespace Issuer {
512
- type Type = 'account' | 'self';
2127
+ interface EndsAt {
2128
+ /**
2129
+ * Use the `end` time of a given discount.
2130
+ */
2131
+ discount_end?: EndsAt.DiscountEnd;
2132
+
2133
+ /**
2134
+ * Time span for the quote line starting from the `starts_at` date.
2135
+ */
2136
+ duration?: EndsAt.Duration;
2137
+
2138
+ /**
2139
+ * A precise Unix timestamp.
2140
+ */
2141
+ timestamp?: number;
2142
+
2143
+ /**
2144
+ * Select a way to pass in `ends_at`.
2145
+ */
2146
+ type: EndsAt.Type;
2147
+ }
2148
+
2149
+ namespace EndsAt {
2150
+ interface DiscountEnd {
2151
+ /**
2152
+ * The ID of a specific discount.
2153
+ */
2154
+ discount: string;
2155
+ }
2156
+
2157
+ interface Duration {
2158
+ /**
2159
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2160
+ */
2161
+ interval: Duration.Interval;
2162
+
2163
+ /**
2164
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2165
+ */
2166
+ interval_count: number;
2167
+ }
2168
+
2169
+ namespace Duration {
2170
+ type Interval = 'day' | 'month' | 'week' | 'year';
2171
+ }
2172
+
2173
+ type Type =
2174
+ | 'billing_period_end'
2175
+ | 'discount_end'
2176
+ | 'duration'
2177
+ | 'quote_acceptance_date'
2178
+ | 'schedule_end'
2179
+ | 'timestamp'
2180
+ | 'upcoming_invoice';
2181
+ }
2182
+
2183
+ type ProrationBehavior =
2184
+ | 'always_invoice'
2185
+ | 'create_prorations'
2186
+ | 'none';
2187
+
2188
+ interface SetPauseCollection {
2189
+ /**
2190
+ * Details of the pause_collection behavior to apply to the amendment.
2191
+ */
2192
+ set?: SetPauseCollection.Set;
2193
+
2194
+ /**
2195
+ * Determines the type of the pause_collection amendment.
2196
+ */
2197
+ type: SetPauseCollection.Type;
2198
+ }
2199
+
2200
+ namespace SetPauseCollection {
2201
+ interface Set {
2202
+ /**
2203
+ * The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
2204
+ */
2205
+ behavior: Set.Behavior;
2206
+ }
2207
+
2208
+ namespace Set {
2209
+ type Behavior = 'keep_as_draft' | 'mark_uncollectible' | 'void';
2210
+ }
2211
+
2212
+ type Type = 'remove' | 'set';
2213
+ }
2214
+
2215
+ type SetScheduleEnd = 'line_ends_at' | 'line_starts_at';
2216
+
2217
+ interface StartsAt {
2218
+ /**
2219
+ * Use the `end` time of a given discount.
2220
+ */
2221
+ discount_end?: StartsAt.DiscountEnd;
2222
+
2223
+ /**
2224
+ * The timestamp the given line ends at.
2225
+ */
2226
+ line_ends_at?: StartsAt.LineEndsAt;
2227
+
2228
+ /**
2229
+ * A precise Unix timestamp.
2230
+ */
2231
+ timestamp?: number;
2232
+
2233
+ /**
2234
+ * Select a way to pass in `starts_at`.
2235
+ */
2236
+ type: StartsAt.Type;
2237
+ }
2238
+
2239
+ namespace StartsAt {
2240
+ interface DiscountEnd {
2241
+ /**
2242
+ * The ID of a specific discount.
2243
+ */
2244
+ discount: string;
2245
+ }
2246
+
2247
+ interface LineEndsAt {
2248
+ /**
2249
+ * The ID of a quote line.
2250
+ */
2251
+ id?: string;
2252
+
2253
+ /**
2254
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
2255
+ */
2256
+ index?: number;
2257
+ }
2258
+
2259
+ type Type =
2260
+ | 'discount_end'
2261
+ | 'line_ends_at'
2262
+ | 'now'
2263
+ | 'quote_acceptance_date'
2264
+ | 'schedule_end'
2265
+ | 'timestamp'
2266
+ | 'upcoming_invoice';
2267
+ }
2268
+
2269
+ interface TrialSettings {
2270
+ /**
2271
+ * Defines how the subscription should behave when a trial ends.
2272
+ */
2273
+ end_behavior?: TrialSettings.EndBehavior;
2274
+ }
2275
+
2276
+ namespace TrialSettings {
2277
+ interface EndBehavior {
2278
+ /**
2279
+ * Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
2280
+ */
2281
+ prorate_up_front?: EndBehavior.ProrateUpFront;
2282
+ }
2283
+
2284
+ namespace EndBehavior {
2285
+ type ProrateUpFront = 'defer' | 'include';
2286
+ }
513
2287
  }
514
2288
  }
515
2289
 
@@ -555,7 +2329,12 @@ declare module 'stripe' {
555
2329
  /**
556
2330
  * ID of an existing discount on the object (or one of its ancestors) to reuse.
557
2331
  */
558
- discount?: string;
2332
+ discount?: string;
2333
+
2334
+ /**
2335
+ * Details to determine how long the discount should be applied for.
2336
+ */
2337
+ discount_end?: Discount.DiscountEnd;
559
2338
 
560
2339
  /**
561
2340
  * ID of the promotion code to create a new discount for.
@@ -563,6 +2342,45 @@ declare module 'stripe' {
563
2342
  promotion_code?: string;
564
2343
  }
565
2344
 
2345
+ namespace Discount {
2346
+ interface DiscountEnd {
2347
+ /**
2348
+ * Time span for the redeemed discount.
2349
+ */
2350
+ duration?: DiscountEnd.Duration;
2351
+
2352
+ /**
2353
+ * A precise Unix timestamp for the discount to end. Must be in the future.
2354
+ */
2355
+ timestamp?: number;
2356
+
2357
+ /**
2358
+ * The type of calculation made to determine when the discount ends.
2359
+ */
2360
+ type: DiscountEnd.Type;
2361
+ }
2362
+
2363
+ namespace DiscountEnd {
2364
+ interface Duration {
2365
+ /**
2366
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2367
+ */
2368
+ interval: Duration.Interval;
2369
+
2370
+ /**
2371
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2372
+ */
2373
+ interval_count: number;
2374
+ }
2375
+
2376
+ namespace Duration {
2377
+ type Interval = 'day' | 'month' | 'week' | 'year';
2378
+ }
2379
+
2380
+ type Type = 'duration' | 'timestamp';
2381
+ }
2382
+ }
2383
+
566
2384
  interface PriceData {
567
2385
  /**
568
2386
  * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
@@ -617,6 +2435,23 @@ declare module 'stripe' {
617
2435
  }
618
2436
 
619
2437
  interface SubscriptionData {
2438
+ /**
2439
+ * Describes the period to bill for upon accepting the quote.
2440
+ */
2441
+ bill_on_acceptance?: Stripe.Emptyable<
2442
+ SubscriptionData.BillOnAcceptance
2443
+ >;
2444
+
2445
+ /**
2446
+ * Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front.
2447
+ */
2448
+ billing_behavior?: SubscriptionData.BillingBehavior;
2449
+
2450
+ /**
2451
+ * When specified as `reset`, the subscription will always start a new billing period when the quote is accepted.
2452
+ */
2453
+ billing_cycle_anchor?: Stripe.Emptyable<'reset'>;
2454
+
620
2455
  /**
621
2456
  * The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
622
2457
  */
@@ -627,17 +2462,355 @@ declare module 'stripe' {
627
2462
  */
628
2463
  effective_date?: Stripe.Emptyable<'current_period_end' | number>;
629
2464
 
2465
+ /**
2466
+ * Behavior of the subscription schedule and underlying subscription when it ends.
2467
+ */
2468
+ end_behavior?: SubscriptionData.EndBehavior;
2469
+
630
2470
  /**
631
2471
  * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on the subscription or subscription schedule when the quote is accepted. If a recurring price is included in `line_items`, this field will be passed to the resulting subscription's `metadata` field. If `subscription_data.effective_date` is used, this field will be passed to the resulting subscription schedule's `phases.metadata` field. Unlike object-level metadata, this field is declarative. Updates will clear prior values.
632
2472
  */
633
2473
  metadata?: Stripe.MetadataParam;
634
2474
 
2475
+ /**
2476
+ * If specified, the invoicing for the given billing cycle iterations will be processed when the quote is accepted. Cannot be used with `effective_date`.
2477
+ */
2478
+ prebilling?: Stripe.Emptyable<SubscriptionData.Prebilling>;
2479
+
2480
+ /**
2481
+ * Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations). When creating a subscription, valid values are `create_prorations` or `none`.
2482
+ *
2483
+ * When updating a subscription, valid values are `create_prorations`, `none`, or `always_invoice`.
2484
+ *
2485
+ * Passing `create_prorations` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https://stripe.com/docs/subscriptions/upgrading-downgrading#immediate-payment). In order to always invoice immediately for prorations, pass `always_invoice`.
2486
+ *
2487
+ * Prorations can be disabled by passing `none`.
2488
+ */
2489
+ proration_behavior?: SubscriptionData.ProrationBehavior;
2490
+
635
2491
  /**
636
2492
  * Integer representing the number of trial period days before the customer is charged for the first time.
637
2493
  */
638
2494
  trial_period_days?: Stripe.Emptyable<number>;
639
2495
  }
640
2496
 
2497
+ namespace SubscriptionData {
2498
+ type BillingBehavior = 'prorate_on_next_phase' | 'prorate_up_front';
2499
+
2500
+ interface BillOnAcceptance {
2501
+ /**
2502
+ * The start of the period to bill from when the Quote is accepted.
2503
+ */
2504
+ bill_from?: BillOnAcceptance.BillFrom;
2505
+
2506
+ /**
2507
+ * The end of the period to bill until when the Quote is accepted.
2508
+ */
2509
+ bill_until?: BillOnAcceptance.BillUntil;
2510
+ }
2511
+
2512
+ namespace BillOnAcceptance {
2513
+ interface BillFrom {
2514
+ /**
2515
+ * Details of a Quote line to start the bill period from.
2516
+ */
2517
+ line_starts_at?: BillFrom.LineStartsAt;
2518
+
2519
+ /**
2520
+ * A precise Unix timestamp.
2521
+ */
2522
+ timestamp?: number;
2523
+
2524
+ /**
2525
+ * The type of method to specify the `bill_from` time.
2526
+ */
2527
+ type: BillFrom.Type;
2528
+ }
2529
+
2530
+ namespace BillFrom {
2531
+ interface LineStartsAt {
2532
+ /**
2533
+ * The ID of a quote line.
2534
+ */
2535
+ id?: string;
2536
+
2537
+ /**
2538
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
2539
+ */
2540
+ index?: number;
2541
+ }
2542
+
2543
+ type Type =
2544
+ | 'line_starts_at'
2545
+ | 'now'
2546
+ | 'pause_collection_start'
2547
+ | 'quote_acceptance_date'
2548
+ | 'timestamp';
2549
+ }
2550
+
2551
+ interface BillUntil {
2552
+ /**
2553
+ * Details of the duration over which to bill.
2554
+ */
2555
+ duration?: BillUntil.Duration;
2556
+
2557
+ /**
2558
+ * Details of a Quote line item from which to bill until.
2559
+ */
2560
+ line_ends_at?: BillUntil.LineEndsAt;
2561
+
2562
+ /**
2563
+ * A precise Unix timestamp.
2564
+ */
2565
+ timestamp?: number;
2566
+
2567
+ /**
2568
+ * The type of method to specify the `bill_until` time.
2569
+ */
2570
+ type: BillUntil.Type;
2571
+ }
2572
+
2573
+ namespace BillUntil {
2574
+ interface Duration {
2575
+ /**
2576
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2577
+ */
2578
+ interval: Duration.Interval;
2579
+
2580
+ /**
2581
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2582
+ */
2583
+ interval_count: number;
2584
+ }
2585
+
2586
+ namespace Duration {
2587
+ type Interval = 'day' | 'month' | 'week' | 'year';
2588
+ }
2589
+
2590
+ interface LineEndsAt {
2591
+ /**
2592
+ * The ID of a quote line.
2593
+ */
2594
+ id?: string;
2595
+
2596
+ /**
2597
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
2598
+ */
2599
+ index?: number;
2600
+ }
2601
+
2602
+ type Type =
2603
+ | 'duration'
2604
+ | 'line_ends_at'
2605
+ | 'schedule_end'
2606
+ | 'timestamp'
2607
+ | 'upcoming_invoice';
2608
+ }
2609
+ }
2610
+
2611
+ type EndBehavior = 'cancel' | 'release';
2612
+
2613
+ interface Prebilling {
2614
+ /**
2615
+ * This is used to determine the number of billing cycles to prebill.
2616
+ */
2617
+ iterations: number;
2618
+ }
2619
+
2620
+ type ProrationBehavior =
2621
+ | 'always_invoice'
2622
+ | 'create_prorations'
2623
+ | 'none';
2624
+ }
2625
+
2626
+ interface SubscriptionDataOverride {
2627
+ /**
2628
+ * Whether the override applies to an existing Subscription Schedule or a new Subscription Schedule.
2629
+ */
2630
+ applies_to: SubscriptionDataOverride.AppliesTo;
2631
+
2632
+ /**
2633
+ * Describes the period to bill for upon accepting the quote.
2634
+ */
2635
+ bill_on_acceptance?: Stripe.Emptyable<
2636
+ SubscriptionDataOverride.BillOnAcceptance
2637
+ >;
2638
+
2639
+ /**
2640
+ * Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front.
2641
+ */
2642
+ billing_behavior?: SubscriptionDataOverride.BillingBehavior;
2643
+
2644
+ /**
2645
+ * The customer the Subscription Data override applies to.
2646
+ */
2647
+ customer?: string;
2648
+
2649
+ /**
2650
+ * The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
2651
+ */
2652
+ description?: Stripe.Emptyable<string>;
2653
+
2654
+ /**
2655
+ * Behavior of the subscription schedule and underlying subscription when it ends.
2656
+ */
2657
+ end_behavior?: SubscriptionDataOverride.EndBehavior;
2658
+
2659
+ /**
2660
+ * Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#prorations). When creating a subscription, valid values are `create_prorations` or `none`.
2661
+ *
2662
+ * When updating a subscription, valid values are `create_prorations`, `none`, or `always_invoice`.
2663
+ *
2664
+ * Passing `create_prorations` will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under [certain conditions](https://stripe.com/docs/subscriptions/upgrading-downgrading#immediate-payment). In order to always invoice immediately for prorations, pass `always_invoice`.
2665
+ *
2666
+ * Prorations can be disabled by passing `none`.
2667
+ */
2668
+ proration_behavior?: SubscriptionDataOverride.ProrationBehavior;
2669
+ }
2670
+
2671
+ namespace SubscriptionDataOverride {
2672
+ interface AppliesTo {
2673
+ /**
2674
+ * A custom string that identifies a new subscription schedule being created upon quote acceptance. All quote lines with the same `new_reference` field will be applied to the creation of a new subscription schedule.
2675
+ */
2676
+ new_reference?: string;
2677
+
2678
+ /**
2679
+ * The ID of the schedule the line applies to.
2680
+ */
2681
+ subscription_schedule?: string;
2682
+
2683
+ /**
2684
+ * Describes whether the quote line is affecting a new schedule or an existing schedule.
2685
+ */
2686
+ type: AppliesTo.Type;
2687
+ }
2688
+
2689
+ namespace AppliesTo {
2690
+ type Type = 'new_reference' | 'subscription_schedule';
2691
+ }
2692
+
2693
+ type BillingBehavior = 'prorate_on_next_phase' | 'prorate_up_front';
2694
+
2695
+ interface BillOnAcceptance {
2696
+ /**
2697
+ * The start of the period to bill from when the Quote is accepted.
2698
+ */
2699
+ bill_from?: BillOnAcceptance.BillFrom;
2700
+
2701
+ /**
2702
+ * The end of the period to bill until when the Quote is accepted.
2703
+ */
2704
+ bill_until?: BillOnAcceptance.BillUntil;
2705
+ }
2706
+
2707
+ namespace BillOnAcceptance {
2708
+ interface BillFrom {
2709
+ /**
2710
+ * Details of a Quote line to start the bill period from.
2711
+ */
2712
+ line_starts_at?: BillFrom.LineStartsAt;
2713
+
2714
+ /**
2715
+ * A precise Unix timestamp.
2716
+ */
2717
+ timestamp?: number;
2718
+
2719
+ /**
2720
+ * The type of method to specify the `bill_from` time.
2721
+ */
2722
+ type: BillFrom.Type;
2723
+ }
2724
+
2725
+ namespace BillFrom {
2726
+ interface LineStartsAt {
2727
+ /**
2728
+ * The ID of a quote line.
2729
+ */
2730
+ id?: string;
2731
+
2732
+ /**
2733
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
2734
+ */
2735
+ index?: number;
2736
+ }
2737
+
2738
+ type Type =
2739
+ | 'line_starts_at'
2740
+ | 'now'
2741
+ | 'pause_collection_start'
2742
+ | 'quote_acceptance_date'
2743
+ | 'timestamp';
2744
+ }
2745
+
2746
+ interface BillUntil {
2747
+ /**
2748
+ * Details of the duration over which to bill.
2749
+ */
2750
+ duration?: BillUntil.Duration;
2751
+
2752
+ /**
2753
+ * Details of a Quote line item from which to bill until.
2754
+ */
2755
+ line_ends_at?: BillUntil.LineEndsAt;
2756
+
2757
+ /**
2758
+ * A precise Unix timestamp.
2759
+ */
2760
+ timestamp?: number;
2761
+
2762
+ /**
2763
+ * The type of method to specify the `bill_until` time.
2764
+ */
2765
+ type: BillUntil.Type;
2766
+ }
2767
+
2768
+ namespace BillUntil {
2769
+ interface Duration {
2770
+ /**
2771
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2772
+ */
2773
+ interval: Duration.Interval;
2774
+
2775
+ /**
2776
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2777
+ */
2778
+ interval_count: number;
2779
+ }
2780
+
2781
+ namespace Duration {
2782
+ type Interval = 'day' | 'month' | 'week' | 'year';
2783
+ }
2784
+
2785
+ interface LineEndsAt {
2786
+ /**
2787
+ * The ID of a quote line.
2788
+ */
2789
+ id?: string;
2790
+
2791
+ /**
2792
+ * The position of the previous quote line in the `lines` array after which this line should begin. Indexes start from 0 and must be less than the index of the current line in the array.
2793
+ */
2794
+ index?: number;
2795
+ }
2796
+
2797
+ type Type =
2798
+ | 'duration'
2799
+ | 'line_ends_at'
2800
+ | 'schedule_end'
2801
+ | 'timestamp'
2802
+ | 'upcoming_invoice';
2803
+ }
2804
+ }
2805
+
2806
+ type EndBehavior = 'cancel' | 'release';
2807
+
2808
+ type ProrationBehavior =
2809
+ | 'always_invoice'
2810
+ | 'create_prorations'
2811
+ | 'none';
2812
+ }
2813
+
641
2814
  interface TransferData {
642
2815
  /**
643
2816
  * The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred. There cannot be any line items with recurring prices when using this field.
@@ -667,6 +2840,11 @@ declare module 'stripe' {
667
2840
  */
668
2841
  expand?: Array<string>;
669
2842
 
2843
+ /**
2844
+ * The subscription which the quote updates.
2845
+ */
2846
+ from_subscription?: string;
2847
+
670
2848
  /**
671
2849
  * The status of the quote.
672
2850
  */
@@ -679,7 +2857,13 @@ declare module 'stripe' {
679
2857
  }
680
2858
 
681
2859
  namespace QuoteListParams {
682
- type Status = 'accepted' | 'canceled' | 'draft' | 'open';
2860
+ type Status =
2861
+ | 'accepted'
2862
+ | 'accepting'
2863
+ | 'canceled'
2864
+ | 'draft'
2865
+ | 'open'
2866
+ | 'stale';
683
2867
  }
684
2868
 
685
2869
  interface QuoteAcceptParams {
@@ -708,6 +2892,13 @@ declare module 'stripe' {
708
2892
  expires_at?: number;
709
2893
  }
710
2894
 
2895
+ interface QuoteListPreviewInvoiceLinesParams extends PaginationParams {
2896
+ /**
2897
+ * Specifies which fields in the response should be expanded.
2898
+ */
2899
+ expand?: Array<string>;
2900
+ }
2901
+
711
2902
  interface QuoteListComputedUpfrontLineItemsParams extends PaginationParams {
712
2903
  /**
713
2904
  * Specifies which fields in the response should be expanded.
@@ -722,6 +2913,47 @@ declare module 'stripe' {
722
2913
  expand?: Array<string>;
723
2914
  }
724
2915
 
2916
+ interface QuoteListLinesParams extends PaginationParams {
2917
+ /**
2918
+ * Specifies which fields in the response should be expanded.
2919
+ */
2920
+ expand?: Array<string>;
2921
+ }
2922
+
2923
+ interface QuoteListPreviewInvoicesParams extends PaginationParams {
2924
+ /**
2925
+ * Specifies which fields in the response should be expanded.
2926
+ */
2927
+ expand?: Array<string>;
2928
+ }
2929
+
2930
+ interface QuoteListPreviewSubscriptionSchedulesParams
2931
+ extends PaginationParams {
2932
+ /**
2933
+ * Specifies which fields in the response should be expanded.
2934
+ */
2935
+ expand?: Array<string>;
2936
+ }
2937
+
2938
+ interface QuoteMarkDraftParams {
2939
+ /**
2940
+ * Specifies which fields in the response should be expanded.
2941
+ */
2942
+ expand?: Array<string>;
2943
+ }
2944
+
2945
+ interface QuoteMarkStaleParams {
2946
+ /**
2947
+ * Specifies which fields in the response should be expanded.
2948
+ */
2949
+ expand?: Array<string>;
2950
+
2951
+ /**
2952
+ * Reason the Quote is being marked stale.
2953
+ */
2954
+ reason?: string;
2955
+ }
2956
+
725
2957
  interface QuotePdfParams {
726
2958
  /**
727
2959
  * Specifies which fields in the response should be expanded.
@@ -729,6 +2961,13 @@ declare module 'stripe' {
729
2961
  expand?: Array<string>;
730
2962
  }
731
2963
 
2964
+ interface QuoteReestimateParams {
2965
+ /**
2966
+ * Specifies which fields in the response should be expanded.
2967
+ */
2968
+ expand?: Array<string>;
2969
+ }
2970
+
732
2971
  class QuotesResource {
733
2972
  /**
734
2973
  * A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote).
@@ -809,6 +3048,21 @@ declare module 'stripe' {
809
3048
  options?: RequestOptions
810
3049
  ): Promise<Stripe.Response<Stripe.Quote>>;
811
3050
 
3051
+ /**
3052
+ * Preview the invoice line items that would be generated by accepting the quote.
3053
+ */
3054
+ listPreviewInvoiceLines(
3055
+ quoteId: string,
3056
+ id: string,
3057
+ params?: QuoteListPreviewInvoiceLinesParams,
3058
+ options?: RequestOptions
3059
+ ): ApiListPromise<Stripe.InvoiceLineItem>;
3060
+ listPreviewInvoiceLines(
3061
+ quoteId: string,
3062
+ id: string,
3063
+ options?: RequestOptions
3064
+ ): ApiListPromise<Stripe.InvoiceLineItem>;
3065
+
812
3066
  /**
813
3067
  * When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
814
3068
  */
@@ -835,6 +3089,71 @@ declare module 'stripe' {
835
3089
  options?: RequestOptions
836
3090
  ): ApiListPromise<Stripe.LineItem>;
837
3091
 
3092
+ /**
3093
+ * Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
3094
+ */
3095
+ listLines(
3096
+ id: string,
3097
+ params?: QuoteListLinesParams,
3098
+ options?: RequestOptions
3099
+ ): ApiListPromise<Stripe.QuoteLine>;
3100
+ listLines(
3101
+ id: string,
3102
+ options?: RequestOptions
3103
+ ): ApiListPromise<Stripe.QuoteLine>;
3104
+
3105
+ /**
3106
+ * Preview the invoices that would be generated by accepting the quote.
3107
+ */
3108
+ listPreviewInvoices(
3109
+ id: string,
3110
+ params?: QuoteListPreviewInvoicesParams,
3111
+ options?: RequestOptions
3112
+ ): ApiListPromise<Stripe.QuotePreviewInvoice>;
3113
+ listPreviewInvoices(
3114
+ id: string,
3115
+ options?: RequestOptions
3116
+ ): ApiListPromise<Stripe.QuotePreviewInvoice>;
3117
+
3118
+ /**
3119
+ * Preview the schedules that would be generated by accepting the quote
3120
+ */
3121
+ listPreviewSubscriptionSchedules(
3122
+ id: string,
3123
+ params?: QuoteListPreviewSubscriptionSchedulesParams,
3124
+ options?: RequestOptions
3125
+ ): ApiListPromise<Stripe.QuotePreviewSubscriptionSchedule>;
3126
+ listPreviewSubscriptionSchedules(
3127
+ id: string,
3128
+ options?: RequestOptions
3129
+ ): ApiListPromise<Stripe.QuotePreviewSubscriptionSchedule>;
3130
+
3131
+ /**
3132
+ * Converts a stale quote to draft.
3133
+ */
3134
+ markDraft(
3135
+ id: string,
3136
+ params?: QuoteMarkDraftParams,
3137
+ options?: RequestOptions
3138
+ ): Promise<Stripe.Response<Stripe.Quote>>;
3139
+ markDraft(
3140
+ id: string,
3141
+ options?: RequestOptions
3142
+ ): Promise<Stripe.Response<Stripe.Quote>>;
3143
+
3144
+ /**
3145
+ * Converts a draft or open quote to stale.
3146
+ */
3147
+ markStale(
3148
+ id: string,
3149
+ params?: QuoteMarkStaleParams,
3150
+ options?: RequestOptions
3151
+ ): Promise<Stripe.Response<Stripe.Quote>>;
3152
+ markStale(
3153
+ id: string,
3154
+ options?: RequestOptions
3155
+ ): Promise<Stripe.Response<Stripe.Quote>>;
3156
+
838
3157
  /**
839
3158
  * Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
840
3159
  */
@@ -844,6 +3163,19 @@ declare module 'stripe' {
844
3163
  options?: RequestOptions
845
3164
  ): Promise<StripeStreamResponse>;
846
3165
  pdf(id: string, options?: RequestOptions): Promise<StripeStreamResponse>;
3166
+
3167
+ /**
3168
+ * Recompute the upcoming invoice estimate for the quote.
3169
+ */
3170
+ reestimate(
3171
+ id: string,
3172
+ params?: QuoteReestimateParams,
3173
+ options?: RequestOptions
3174
+ ): Promise<Stripe.Response<Stripe.Quote>>;
3175
+ reestimate(
3176
+ id: string,
3177
+ options?: RequestOptions
3178
+ ): Promise<Stripe.Response<Stripe.Quote>>;
847
3179
  }
848
3180
  }
849
3181
  }