stripe 17.5.0 → 17.6.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 (181) hide show
  1. package/CHANGELOG.md +1052 -109
  2. package/README.md +24 -16
  3. package/VERSION +1 -1
  4. package/cjs/apiVersion.js +1 -1
  5. package/cjs/resources/AccountNotices.js +21 -0
  6. package/cjs/resources/Capital/FinancingOffers.js +21 -0
  7. package/cjs/resources/Capital/FinancingSummary.js +12 -0
  8. package/cjs/resources/Capital/FinancingTransactions.js +17 -0
  9. package/cjs/resources/FinancialConnections/Accounts.js +5 -0
  10. package/cjs/resources/FinancialConnections/Institutions.js +17 -0
  11. package/cjs/resources/GiftCards/Cards.js +23 -0
  12. package/cjs/resources/GiftCards/Transactions.js +33 -0
  13. package/cjs/resources/Invoices.js +17 -0
  14. package/cjs/resources/Issuing/CreditUnderwritingRecords.js +33 -0
  15. package/cjs/resources/Issuing/DisputeSettlementDetails.js +17 -0
  16. package/cjs/resources/Issuing/FraudLiabilityDebits.js +17 -0
  17. package/cjs/resources/Margins.js +22 -0
  18. package/cjs/resources/Orders.js +24 -0
  19. package/cjs/resources/PaymentAttemptRecords.js +17 -0
  20. package/cjs/resources/PaymentIntents.js +8 -0
  21. package/cjs/resources/PaymentRecords.js +29 -0
  22. package/cjs/resources/Quotes.js +32 -0
  23. package/cjs/resources/SubscriptionSchedules.js +4 -0
  24. package/cjs/resources/Tax/Associations.js +9 -0
  25. package/cjs/resources/Tax/Forms.js +20 -0
  26. package/cjs/resources/Terminal/ReaderCollectedData.js +12 -0
  27. package/cjs/resources/Terminal/Readers.js +12 -0
  28. package/cjs/resources/Treasury/FinancialAccounts.js +4 -0
  29. package/cjs/resources.js +48 -10
  30. package/cjs/stripe.core.js +1 -1
  31. package/esm/apiVersion.js +1 -1
  32. package/esm/resources/AccountNotices.js +18 -0
  33. package/esm/resources/Capital/FinancingOffers.js +18 -0
  34. package/esm/resources/Capital/FinancingSummary.js +9 -0
  35. package/esm/resources/Capital/FinancingTransactions.js +14 -0
  36. package/esm/resources/FinancialConnections/Accounts.js +5 -0
  37. package/esm/resources/FinancialConnections/Institutions.js +14 -0
  38. package/esm/resources/GiftCards/Cards.js +20 -0
  39. package/esm/resources/GiftCards/Transactions.js +30 -0
  40. package/esm/resources/Invoices.js +17 -0
  41. package/esm/resources/Issuing/CreditUnderwritingRecords.js +30 -0
  42. package/esm/resources/Issuing/DisputeSettlementDetails.js +14 -0
  43. package/esm/resources/Issuing/FraudLiabilityDebits.js +14 -0
  44. package/esm/resources/Margins.js +19 -0
  45. package/esm/resources/Orders.js +21 -0
  46. package/esm/resources/PaymentAttemptRecords.js +14 -0
  47. package/esm/resources/PaymentIntents.js +8 -0
  48. package/esm/resources/PaymentRecords.js +26 -0
  49. package/esm/resources/Quotes.js +32 -0
  50. package/esm/resources/SubscriptionSchedules.js +4 -0
  51. package/esm/resources/Tax/Associations.js +6 -0
  52. package/esm/resources/Tax/Forms.js +17 -0
  53. package/esm/resources/Terminal/ReaderCollectedData.js +9 -0
  54. package/esm/resources/Terminal/Readers.js +12 -0
  55. package/esm/resources/Treasury/FinancialAccounts.js +4 -0
  56. package/esm/resources.js +33 -0
  57. package/esm/stripe.core.js +1 -1
  58. package/package.json +3 -15
  59. package/types/AccountLinksResource.d.ts +5 -1
  60. package/types/AccountNotices.d.ts +113 -0
  61. package/types/AccountNoticesResource.d.ts +98 -0
  62. package/types/AccountSessions.d.ts +175 -0
  63. package/types/AccountSessionsResource.d.ts +376 -0
  64. package/types/Accounts.d.ts +225 -1
  65. package/types/AccountsResource.d.ts +628 -0
  66. package/types/Billing/CreditBalanceTransactions.d.ts +1 -1
  67. package/types/Billing/MeterErrorReports.d.ts +106 -0
  68. package/types/BillingPortal/ConfigurationsResource.d.ts +2 -2
  69. package/types/Capital/FinancingOffers.d.ts +188 -0
  70. package/types/Capital/FinancingOffersResource.d.ts +97 -0
  71. package/types/Capital/FinancingSummary.d.ts +106 -0
  72. package/types/Capital/FinancingSummaryResource.d.ts +27 -0
  73. package/types/Capital/FinancingTransactions.d.ts +135 -0
  74. package/types/Capital/FinancingTransactionsResource.d.ts +68 -0
  75. package/types/Cards.d.ts +6 -1
  76. package/types/Charges.d.ts +159 -2
  77. package/types/ChargesResource.d.ts +1294 -0
  78. package/types/Checkout/Sessions.d.ts +359 -5
  79. package/types/Checkout/SessionsResource.d.ts +456 -5
  80. package/types/ConfirmationTokens.d.ts +110 -1
  81. package/types/Coupons.d.ts +1 -1
  82. package/types/CouponsResource.d.ts +1 -1
  83. package/types/CreditNoteLineItems.d.ts +1 -1
  84. package/types/CreditNotes.d.ts +22 -1
  85. package/types/CreditNotesResource.d.ts +51 -0
  86. package/types/CustomersResource.d.ts +8 -0
  87. package/types/EventTypes.d.ts +596 -0
  88. package/types/Events.d.ts +93 -0
  89. package/types/FinancialConnections/AccountInferredBalances.d.ts +38 -0
  90. package/types/FinancialConnections/Accounts.d.ts +29 -1
  91. package/types/FinancialConnections/AccountsResource.d.ts +35 -3
  92. package/types/FinancialConnections/Institutions.d.ts +93 -0
  93. package/types/FinancialConnections/InstitutionsResource.d.ts +47 -0
  94. package/types/FinancialConnections/Sessions.d.ts +49 -1
  95. package/types/FinancialConnections/SessionsResource.d.ts +38 -1
  96. package/types/FinancialConnections/TransactionsResource.d.ts +1 -1
  97. package/types/GiftCards/Cards.d.ts +118 -0
  98. package/types/GiftCards/CardsResource.d.ts +159 -0
  99. package/types/GiftCards/Transactions.d.ts +129 -0
  100. package/types/GiftCards/TransactionsResource.d.ts +201 -0
  101. package/types/InvoiceItems.d.ts +5 -0
  102. package/types/InvoiceItemsResource.d.ts +98 -0
  103. package/types/InvoiceLineItems.d.ts +29 -2
  104. package/types/InvoicePayments.d.ts +113 -0
  105. package/types/Invoices.d.ts +143 -3
  106. package/types/InvoicesResource.d.ts +4618 -933
  107. package/types/Issuing/Authorizations.d.ts +2 -1
  108. package/types/Issuing/CardholdersResource.d.ts +2 -1
  109. package/types/Issuing/CreditUnderwritingRecords.d.ts +451 -0
  110. package/types/Issuing/CreditUnderwritingRecordsResource.d.ts +1032 -0
  111. package/types/Issuing/DisputeSettlementDetails.d.ts +73 -0
  112. package/types/Issuing/DisputeSettlementDetailsResource.d.ts +52 -0
  113. package/types/Issuing/FraudLiabilityDebits.d.ts +52 -0
  114. package/types/Issuing/FraudLiabilityDebitsResource.d.ts +52 -0
  115. package/types/Issuing/Settlements.d.ts +103 -0
  116. package/types/Issuing/Transactions.d.ts +3 -1
  117. package/types/Issuing/TransactionsResource.d.ts +5 -0
  118. package/types/LineItems.d.ts +32 -0
  119. package/types/Mandates.d.ts +77 -0
  120. package/types/Margins.d.ts +56 -0
  121. package/types/MarginsResource.d.ts +114 -0
  122. package/types/Orders.d.ts +1179 -0
  123. package/types/OrdersResource.d.ts +2961 -0
  124. package/types/PaymentAttemptRecords.d.ts +242 -0
  125. package/types/PaymentAttemptRecordsResource.d.ts +47 -0
  126. package/types/PaymentIntents.d.ts +653 -1
  127. package/types/PaymentIntentsResource.d.ts +8018 -3686
  128. package/types/PaymentLinks.d.ts +8 -0
  129. package/types/PaymentLinksResource.d.ts +30 -0
  130. package/types/PaymentMethodConfigurations.d.ts +216 -0
  131. package/types/PaymentMethodConfigurationsResource.d.ts +300 -0
  132. package/types/PaymentMethods.d.ts +110 -1
  133. package/types/PaymentMethodsResource.d.ts +149 -0
  134. package/types/PaymentRecords.d.ts +242 -0
  135. package/types/PaymentRecordsResource.d.ts +455 -0
  136. package/types/Prices.d.ts +22 -0
  137. package/types/PricesResource.d.ts +22 -0
  138. package/types/Products.d.ts +39 -0
  139. package/types/ProductsResource.d.ts +36 -0
  140. package/types/QuoteLines.d.ts +634 -0
  141. package/types/QuotePreviewInvoices.d.ts +1658 -0
  142. package/types/QuotePreviewSubscriptionSchedules.d.ts +824 -0
  143. package/types/Quotes.d.ts +591 -1
  144. package/types/QuotesResource.d.ts +2526 -194
  145. package/types/Refunds.d.ts +14 -0
  146. package/types/SetupAttempts.d.ts +43 -0
  147. package/types/SetupIntents.d.ts +116 -1
  148. package/types/SetupIntentsResource.d.ts +669 -3
  149. package/types/Sources.d.ts +29 -0
  150. package/types/SubscriptionItems.d.ts +21 -0
  151. package/types/SubscriptionItemsResource.d.ts +109 -0
  152. package/types/SubscriptionSchedules.d.ts +200 -0
  153. package/types/SubscriptionSchedulesResource.d.ts +1234 -16
  154. package/types/Subscriptions.d.ts +91 -1
  155. package/types/SubscriptionsResource.d.ts +369 -2
  156. package/types/Tax/Associations.d.ts +126 -0
  157. package/types/Tax/AssociationsResource.d.ts +29 -0
  158. package/types/Tax/Forms.d.ts +220 -0
  159. package/types/Tax/FormsResource.d.ts +107 -0
  160. package/types/Terminal/Configurations.d.ts +19 -0
  161. package/types/Terminal/ConfigurationsResource.d.ts +44 -0
  162. package/types/Terminal/ReaderCollectedData.d.ts +51 -0
  163. package/types/Terminal/ReaderCollectedDataResource.d.ts +29 -0
  164. package/types/Terminal/Readers.d.ts +310 -0
  165. package/types/Terminal/ReadersResource.d.ts +215 -0
  166. package/types/TestHelpers/ConfirmationTokensResource.d.ts +112 -0
  167. package/types/TestHelpers/Treasury/ReceivedCreditsResource.d.ts +26 -0
  168. package/types/TestHelpers/Treasury/ReceivedDebitsResource.d.ts +26 -0
  169. package/types/TokensResource.d.ts +30 -0
  170. package/types/Treasury/FinancialAccountFeatures.d.ts +7 -0
  171. package/types/Treasury/FinancialAccounts.d.ts +12 -0
  172. package/types/Treasury/FinancialAccountsResource.d.ts +121 -0
  173. package/types/Treasury/OutboundTransfers.d.ts +43 -1
  174. package/types/Treasury/OutboundTransfersResource.d.ts +43 -0
  175. package/types/Treasury/ReceivedCredits.d.ts +36 -0
  176. package/types/Treasury/ReceivedCreditsResource.d.ts +1 -0
  177. package/types/Treasury/ReceivedDebits.d.ts +31 -0
  178. package/types/WebhookEndpointsResource.d.ts +72 -1
  179. package/types/index.d.ts +62 -0
  180. package/types/lib.d.ts +1 -1
  181. package/types/test/typescriptTest.ts +3 -3
@@ -3,6 +3,11 @@
3
3
  declare module 'stripe' {
4
4
  namespace Stripe {
5
5
  interface SubscriptionScheduleCreateParams {
6
+ /**
7
+ * 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.
8
+ */
9
+ billing_behavior?: SubscriptionScheduleCreateParams.BillingBehavior;
10
+
6
11
  /**
7
12
  * The identifier of the customer to create the subscription schedule for.
8
13
  */
@@ -38,6 +43,11 @@ declare module 'stripe' {
38
43
  */
39
44
  phases?: Array<SubscriptionScheduleCreateParams.Phase>;
40
45
 
46
+ /**
47
+ * If specified, the invoicing for the given billing cycle iterations will be processed now.
48
+ */
49
+ prebilling?: SubscriptionScheduleCreateParams.Prebilling;
50
+
41
51
  /**
42
52
  * When the subscription schedule starts. We recommend using `now` so that it starts the subscription immediately. You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on.
43
53
  */
@@ -45,6 +55,8 @@ declare module 'stripe' {
45
55
  }
46
56
 
47
57
  namespace SubscriptionScheduleCreateParams {
58
+ type BillingBehavior = 'prorate_on_next_phase' | 'prorate_up_front';
59
+
48
60
  interface DefaultSettings {
49
61
  /**
50
62
  * 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. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
@@ -287,6 +299,11 @@ declare module 'stripe' {
287
299
  */
288
300
  on_behalf_of?: string;
289
301
 
302
+ /**
303
+ * If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/docs/billing/subscriptions/pause-payment).
304
+ */
305
+ pause_collection?: Phase.PauseCollection;
306
+
290
307
  /**
291
308
  * Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase. The default value is `create_prorations`. This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase.
292
309
  */
@@ -302,10 +319,20 @@ declare module 'stripe' {
302
319
  */
303
320
  trial?: boolean;
304
321
 
322
+ /**
323
+ * Specify trial behavior when crossing phase boundaries
324
+ */
325
+ trial_continuation?: Phase.TrialContinuation;
326
+
305
327
  /**
306
328
  * Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial`
307
329
  */
308
330
  trial_end?: number;
331
+
332
+ /**
333
+ * Settings related to subscription trials.
334
+ */
335
+ trial_settings?: Phase.TrialSettings;
309
336
  }
310
337
 
311
338
  namespace Phase {
@@ -348,12 +375,56 @@ declare module 'stripe' {
348
375
  */
349
376
  discount?: string;
350
377
 
378
+ /**
379
+ * Details to determine how long the discount should be applied for.
380
+ */
381
+ discount_end?: Discount.DiscountEnd;
382
+
351
383
  /**
352
384
  * ID of the promotion code to create a new discount for.
353
385
  */
354
386
  promotion_code?: string;
355
387
  }
356
388
 
389
+ namespace Discount {
390
+ interface DiscountEnd {
391
+ /**
392
+ * Time span for the redeemed discount.
393
+ */
394
+ duration?: DiscountEnd.Duration;
395
+
396
+ /**
397
+ * A precise Unix timestamp for the discount to end. Must be in the future.
398
+ */
399
+ timestamp?: number;
400
+
401
+ /**
402
+ * The type of calculation made to determine when the discount ends.
403
+ */
404
+ type: DiscountEnd.Type;
405
+ }
406
+
407
+ namespace DiscountEnd {
408
+ interface Duration {
409
+ /**
410
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
411
+ */
412
+ interval: Duration.Interval;
413
+
414
+ /**
415
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
416
+ */
417
+ interval_count: number;
418
+ }
419
+
420
+ namespace Duration {
421
+ type Interval = 'day' | 'month' | 'week' | 'year';
422
+ }
423
+
424
+ type Type = 'duration' | 'timestamp';
425
+ }
426
+ }
427
+
357
428
  interface PriceData {
358
429
  /**
359
430
  * 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).
@@ -443,12 +514,56 @@ declare module 'stripe' {
443
514
  */
444
515
  discount?: string;
445
516
 
517
+ /**
518
+ * Details to determine how long the discount should be applied for.
519
+ */
520
+ discount_end?: Discount.DiscountEnd;
521
+
446
522
  /**
447
523
  * ID of the promotion code to create a new discount for.
448
524
  */
449
525
  promotion_code?: string;
450
526
  }
451
527
 
528
+ namespace Discount {
529
+ interface DiscountEnd {
530
+ /**
531
+ * Time span for the redeemed discount.
532
+ */
533
+ duration?: DiscountEnd.Duration;
534
+
535
+ /**
536
+ * A precise Unix timestamp for the discount to end. Must be in the future.
537
+ */
538
+ timestamp?: number;
539
+
540
+ /**
541
+ * The type of calculation made to determine when the discount ends.
542
+ */
543
+ type: DiscountEnd.Type;
544
+ }
545
+
546
+ namespace DiscountEnd {
547
+ interface Duration {
548
+ /**
549
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
550
+ */
551
+ interval: Duration.Interval;
552
+
553
+ /**
554
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
555
+ */
556
+ interval_count: number;
557
+ }
558
+
559
+ namespace Duration {
560
+ type Interval = 'day' | 'month' | 'week' | 'year';
561
+ }
562
+
563
+ type Type = 'duration' | 'timestamp';
564
+ }
565
+ }
566
+
452
567
  interface InvoiceSettings {
453
568
  /**
454
569
  * The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
@@ -524,6 +639,11 @@ declare module 'stripe' {
524
639
  * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
525
640
  */
526
641
  tax_rates?: Stripe.Emptyable<Array<string>>;
642
+
643
+ /**
644
+ * Options that configure the trial on the subscription item.
645
+ */
646
+ trial?: Item.Trial;
527
647
  }
528
648
 
529
649
  namespace Item {
@@ -545,12 +665,56 @@ declare module 'stripe' {
545
665
  */
546
666
  discount?: string;
547
667
 
668
+ /**
669
+ * Details to determine how long the discount should be applied for.
670
+ */
671
+ discount_end?: Discount.DiscountEnd;
672
+
548
673
  /**
549
674
  * ID of the promotion code to create a new discount for.
550
675
  */
551
676
  promotion_code?: string;
552
677
  }
553
678
 
679
+ namespace Discount {
680
+ interface DiscountEnd {
681
+ /**
682
+ * Time span for the redeemed discount.
683
+ */
684
+ duration?: DiscountEnd.Duration;
685
+
686
+ /**
687
+ * A precise Unix timestamp for the discount to end. Must be in the future.
688
+ */
689
+ timestamp?: number;
690
+
691
+ /**
692
+ * The type of calculation made to determine when the discount ends.
693
+ */
694
+ type: DiscountEnd.Type;
695
+ }
696
+
697
+ namespace DiscountEnd {
698
+ interface Duration {
699
+ /**
700
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
701
+ */
702
+ interval: Duration.Interval;
703
+
704
+ /**
705
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
706
+ */
707
+ interval_count: number;
708
+ }
709
+
710
+ namespace Duration {
711
+ type Interval = 'day' | 'month' | 'week' | 'year';
712
+ }
713
+
714
+ type Type = 'duration' | 'timestamp';
715
+ }
716
+ }
717
+
554
718
  interface PriceData {
555
719
  /**
556
720
  * 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).
@@ -602,6 +766,33 @@ declare module 'stripe' {
602
766
 
603
767
  type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
604
768
  }
769
+
770
+ interface Trial {
771
+ /**
772
+ * 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.
773
+ */
774
+ converts_to?: Array<string>;
775
+
776
+ /**
777
+ * Determines the type of trial for this item.
778
+ */
779
+ type: Trial.Type;
780
+ }
781
+
782
+ namespace Trial {
783
+ type Type = 'free' | 'paid';
784
+ }
785
+ }
786
+
787
+ interface PauseCollection {
788
+ /**
789
+ * The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
790
+ */
791
+ behavior: PauseCollection.Behavior;
792
+ }
793
+
794
+ namespace PauseCollection {
795
+ type Behavior = 'keep_as_draft' | 'mark_uncollectible' | 'void';
605
796
  }
606
797
 
607
798
  type ProrationBehavior =
@@ -620,6 +811,44 @@ declare module 'stripe' {
620
811
  */
621
812
  destination: string;
622
813
  }
814
+
815
+ type TrialContinuation = 'continue' | 'none';
816
+
817
+ interface TrialSettings {
818
+ /**
819
+ * Defines how the subscription should behave when a trial ends.
820
+ */
821
+ end_behavior?: TrialSettings.EndBehavior;
822
+ }
823
+
824
+ namespace TrialSettings {
825
+ interface EndBehavior {
826
+ /**
827
+ * Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
828
+ */
829
+ prorate_up_front?: EndBehavior.ProrateUpFront;
830
+ }
831
+
832
+ namespace EndBehavior {
833
+ type ProrateUpFront = 'defer' | 'include';
834
+ }
835
+ }
836
+ }
837
+
838
+ interface Prebilling {
839
+ /**
840
+ * This is used to determine the number of billing cycles to prebill.
841
+ */
842
+ iterations: number;
843
+
844
+ /**
845
+ * Whether to cancel or preserve `prebilling` if the subscription is updated during the prebilled period. The default value is `reset`.
846
+ */
847
+ update_behavior?: Prebilling.UpdateBehavior;
848
+ }
849
+
850
+ namespace Prebilling {
851
+ type UpdateBehavior = 'prebill' | 'reset';
623
852
  }
624
853
  }
625
854
 
@@ -631,6 +860,11 @@ declare module 'stripe' {
631
860
  }
632
861
 
633
862
  interface SubscriptionScheduleUpdateParams {
863
+ /**
864
+ * 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.
865
+ */
866
+ billing_behavior?: SubscriptionScheduleUpdateParams.BillingBehavior;
867
+
634
868
  /**
635
869
  * Object representing the subscription schedule's default settings.
636
870
  */
@@ -656,6 +890,11 @@ declare module 'stripe' {
656
890
  */
657
891
  phases?: Array<SubscriptionScheduleUpdateParams.Phase>;
658
892
 
893
+ /**
894
+ * If specified, the invoicing for the given billing cycle iterations will be processed now.
895
+ */
896
+ prebilling?: SubscriptionScheduleUpdateParams.Prebilling;
897
+
659
898
  /**
660
899
  * If the update changes the current phase, indicates whether the changes should be prorated. The default value is `create_prorations`.
661
900
  */
@@ -663,6 +902,8 @@ declare module 'stripe' {
663
902
  }
664
903
 
665
904
  namespace SubscriptionScheduleUpdateParams {
905
+ type BillingBehavior = 'prorate_on_next_phase' | 'prorate_up_front';
906
+
666
907
  interface DefaultSettings {
667
908
  /**
668
909
  * 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. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
@@ -905,6 +1146,11 @@ declare module 'stripe' {
905
1146
  */
906
1147
  on_behalf_of?: string;
907
1148
 
1149
+ /**
1150
+ * If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/docs/billing/subscriptions/pause-payment).
1151
+ */
1152
+ pause_collection?: Phase.PauseCollection;
1153
+
908
1154
  /**
909
1155
  * Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase. The default value is `create_prorations`. This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase.
910
1156
  */
@@ -925,10 +1171,20 @@ declare module 'stripe' {
925
1171
  */
926
1172
  trial?: boolean;
927
1173
 
1174
+ /**
1175
+ * Specify trial behavior when crossing phase boundaries
1176
+ */
1177
+ trial_continuation?: Phase.TrialContinuation;
1178
+
928
1179
  /**
929
1180
  * Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial`
930
1181
  */
931
1182
  trial_end?: number | 'now';
1183
+
1184
+ /**
1185
+ * Settings related to subscription trials.
1186
+ */
1187
+ trial_settings?: Phase.TrialSettings;
932
1188
  }
933
1189
 
934
1190
  namespace Phase {
@@ -971,12 +1227,56 @@ declare module 'stripe' {
971
1227
  */
972
1228
  discount?: string;
973
1229
 
1230
+ /**
1231
+ * Details to determine how long the discount should be applied for.
1232
+ */
1233
+ discount_end?: Discount.DiscountEnd;
1234
+
974
1235
  /**
975
1236
  * ID of the promotion code to create a new discount for.
976
1237
  */
977
1238
  promotion_code?: string;
978
1239
  }
979
1240
 
1241
+ namespace Discount {
1242
+ interface DiscountEnd {
1243
+ /**
1244
+ * Time span for the redeemed discount.
1245
+ */
1246
+ duration?: DiscountEnd.Duration;
1247
+
1248
+ /**
1249
+ * A precise Unix timestamp for the discount to end. Must be in the future.
1250
+ */
1251
+ timestamp?: number;
1252
+
1253
+ /**
1254
+ * The type of calculation made to determine when the discount ends.
1255
+ */
1256
+ type: DiscountEnd.Type;
1257
+ }
1258
+
1259
+ namespace DiscountEnd {
1260
+ interface Duration {
1261
+ /**
1262
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1263
+ */
1264
+ interval: Duration.Interval;
1265
+
1266
+ /**
1267
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1268
+ */
1269
+ interval_count: number;
1270
+ }
1271
+
1272
+ namespace Duration {
1273
+ type Interval = 'day' | 'month' | 'week' | 'year';
1274
+ }
1275
+
1276
+ type Type = 'duration' | 'timestamp';
1277
+ }
1278
+ }
1279
+
980
1280
  interface PriceData {
981
1281
  /**
982
1282
  * 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).
@@ -1066,12 +1366,56 @@ declare module 'stripe' {
1066
1366
  */
1067
1367
  discount?: string;
1068
1368
 
1369
+ /**
1370
+ * Details to determine how long the discount should be applied for.
1371
+ */
1372
+ discount_end?: Discount.DiscountEnd;
1373
+
1069
1374
  /**
1070
1375
  * ID of the promotion code to create a new discount for.
1071
1376
  */
1072
1377
  promotion_code?: string;
1073
1378
  }
1074
1379
 
1380
+ namespace Discount {
1381
+ interface DiscountEnd {
1382
+ /**
1383
+ * Time span for the redeemed discount.
1384
+ */
1385
+ duration?: DiscountEnd.Duration;
1386
+
1387
+ /**
1388
+ * A precise Unix timestamp for the discount to end. Must be in the future.
1389
+ */
1390
+ timestamp?: number;
1391
+
1392
+ /**
1393
+ * The type of calculation made to determine when the discount ends.
1394
+ */
1395
+ type: DiscountEnd.Type;
1396
+ }
1397
+
1398
+ namespace DiscountEnd {
1399
+ interface Duration {
1400
+ /**
1401
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1402
+ */
1403
+ interval: Duration.Interval;
1404
+
1405
+ /**
1406
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1407
+ */
1408
+ interval_count: number;
1409
+ }
1410
+
1411
+ namespace Duration {
1412
+ type Interval = 'day' | 'month' | 'week' | 'year';
1413
+ }
1414
+
1415
+ type Type = 'duration' | 'timestamp';
1416
+ }
1417
+ }
1418
+
1075
1419
  interface InvoiceSettings {
1076
1420
  /**
1077
1421
  * The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
@@ -1147,6 +1491,11 @@ declare module 'stripe' {
1147
1491
  * A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
1148
1492
  */
1149
1493
  tax_rates?: Stripe.Emptyable<Array<string>>;
1494
+
1495
+ /**
1496
+ * Options that configure the trial on the subscription item.
1497
+ */
1498
+ trial?: Item.Trial;
1150
1499
  }
1151
1500
 
1152
1501
  namespace Item {
@@ -1168,12 +1517,56 @@ declare module 'stripe' {
1168
1517
  */
1169
1518
  discount?: string;
1170
1519
 
1520
+ /**
1521
+ * Details to determine how long the discount should be applied for.
1522
+ */
1523
+ discount_end?: Discount.DiscountEnd;
1524
+
1171
1525
  /**
1172
1526
  * ID of the promotion code to create a new discount for.
1173
1527
  */
1174
1528
  promotion_code?: string;
1175
1529
  }
1176
1530
 
1531
+ namespace Discount {
1532
+ interface DiscountEnd {
1533
+ /**
1534
+ * Time span for the redeemed discount.
1535
+ */
1536
+ duration?: DiscountEnd.Duration;
1537
+
1538
+ /**
1539
+ * A precise Unix timestamp for the discount to end. Must be in the future.
1540
+ */
1541
+ timestamp?: number;
1542
+
1543
+ /**
1544
+ * The type of calculation made to determine when the discount ends.
1545
+ */
1546
+ type: DiscountEnd.Type;
1547
+ }
1548
+
1549
+ namespace DiscountEnd {
1550
+ interface Duration {
1551
+ /**
1552
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1553
+ */
1554
+ interval: Duration.Interval;
1555
+
1556
+ /**
1557
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1558
+ */
1559
+ interval_count: number;
1560
+ }
1561
+
1562
+ namespace Duration {
1563
+ type Interval = 'day' | 'month' | 'week' | 'year';
1564
+ }
1565
+
1566
+ type Type = 'duration' | 'timestamp';
1567
+ }
1568
+ }
1569
+
1177
1570
  interface PriceData {
1178
1571
  /**
1179
1572
  * 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).
@@ -1225,6 +1618,33 @@ declare module 'stripe' {
1225
1618
 
1226
1619
  type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
1227
1620
  }
1621
+
1622
+ interface Trial {
1623
+ /**
1624
+ * 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.
1625
+ */
1626
+ converts_to?: Array<string>;
1627
+
1628
+ /**
1629
+ * Determines the type of trial for this item.
1630
+ */
1631
+ type: Trial.Type;
1632
+ }
1633
+
1634
+ namespace Trial {
1635
+ type Type = 'free' | 'paid';
1636
+ }
1637
+ }
1638
+
1639
+ interface PauseCollection {
1640
+ /**
1641
+ * The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
1642
+ */
1643
+ behavior: PauseCollection.Behavior;
1644
+ }
1645
+
1646
+ namespace PauseCollection {
1647
+ type Behavior = 'keep_as_draft' | 'mark_uncollectible' | 'void';
1228
1648
  }
1229
1649
 
1230
1650
  type ProrationBehavior =
@@ -1243,6 +1663,44 @@ declare module 'stripe' {
1243
1663
  */
1244
1664
  destination: string;
1245
1665
  }
1666
+
1667
+ type TrialContinuation = 'continue' | 'none';
1668
+
1669
+ interface TrialSettings {
1670
+ /**
1671
+ * Defines how the subscription should behave when a trial ends.
1672
+ */
1673
+ end_behavior?: TrialSettings.EndBehavior;
1674
+ }
1675
+
1676
+ namespace TrialSettings {
1677
+ interface EndBehavior {
1678
+ /**
1679
+ * Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
1680
+ */
1681
+ prorate_up_front?: EndBehavior.ProrateUpFront;
1682
+ }
1683
+
1684
+ namespace EndBehavior {
1685
+ type ProrateUpFront = 'defer' | 'include';
1686
+ }
1687
+ }
1688
+ }
1689
+
1690
+ interface Prebilling {
1691
+ /**
1692
+ * This is used to determine the number of billing cycles to prebill.
1693
+ */
1694
+ iterations: number;
1695
+
1696
+ /**
1697
+ * Whether to cancel or preserve `prebilling` if the subscription is updated during the prebilled period. The default value is `reset`.
1698
+ */
1699
+ update_behavior?: Prebilling.UpdateBehavior;
1700
+ }
1701
+
1702
+ namespace Prebilling {
1703
+ type UpdateBehavior = 'prebill' | 'reset';
1246
1704
  }
1247
1705
 
1248
1706
  type ProrationBehavior = 'always_invoice' | 'create_prorations' | 'none';
@@ -1285,38 +1743,785 @@ declare module 'stripe' {
1285
1743
  scheduled?: boolean;
1286
1744
  }
1287
1745
 
1288
- interface SubscriptionScheduleCancelParams {
1746
+ interface SubscriptionScheduleAmendParams {
1289
1747
  /**
1290
- * Specifies which fields in the response should be expanded.
1748
+ * Changes to apply to the phases of the subscription schedule, in the order provided.
1291
1749
  */
1292
- expand?: Array<string>;
1750
+ amendments?: Array<SubscriptionScheduleAmendParams.Amendment>;
1293
1751
 
1294
1752
  /**
1295
- * 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. Defaults to `true`.
1753
+ * Specifies which fields in the response should be expanded.
1296
1754
  */
1297
- invoice_now?: boolean;
1755
+ expand?: Array<string>;
1298
1756
 
1299
1757
  /**
1300
- * If the subscription schedule is `active`, indicates if the cancellation should be prorated. Defaults to `true`.
1758
+ * Provide any time periods to bill in advance.
1301
1759
  */
1302
- prorate?: boolean;
1303
- }
1760
+ prebilling?: Stripe.Emptyable<
1761
+ Array<SubscriptionScheduleAmendParams.Prebilling>
1762
+ >;
1304
1763
 
1305
- interface SubscriptionScheduleReleaseParams {
1306
1764
  /**
1307
- * Specifies which fields in the response should be expanded.
1765
+ * In cases where the amendment changes the currently active phase,
1766
+ * specifies if and how to prorate at the time of the request.
1308
1767
  */
1309
- expand?: Array<string>;
1768
+ proration_behavior?: SubscriptionScheduleAmendParams.ProrationBehavior;
1310
1769
 
1311
1770
  /**
1312
- * Keep any cancellation on the subscription that the schedule has set
1771
+ * Changes to apply to the subscription schedule.
1313
1772
  */
1314
- preserve_cancel_date?: boolean;
1773
+ schedule_settings?: SubscriptionScheduleAmendParams.ScheduleSettings;
1315
1774
  }
1316
1775
 
1317
- class SubscriptionSchedulesResource {
1318
- /**
1319
- * Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.
1776
+ namespace SubscriptionScheduleAmendParams {
1777
+ interface Amendment {
1778
+ /**
1779
+ * Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment.
1780
+ */
1781
+ amendment_end?: Amendment.AmendmentEnd;
1782
+
1783
+ /**
1784
+ * Details to identify the earliest timestamp where the proposed change should take effect.
1785
+ */
1786
+ amendment_start: Amendment.AmendmentStart;
1787
+
1788
+ /**
1789
+ * For point-in-time amendments (having no `amendment_end`), this attribute lets you set or remove whether the subscription's billing cycle anchor is reset at the `amendment_start` timestamp.For time-span based amendments (having both `amendment_start` and `amendment_end`), the only value valid is `automatic`, which removes any previously configured billing cycle anchor resets scheduled to occur during the window of time spanned by the amendment.
1790
+ */
1791
+ billing_cycle_anchor?: Amendment.BillingCycleAnchor;
1792
+
1793
+ /**
1794
+ * Changes to the coupons being redeemed or discounts being applied during the amendment time span.
1795
+ */
1796
+ discount_actions?: Array<Amendment.DiscountAction>;
1797
+
1798
+ /**
1799
+ * Changes to the subscription items during the amendment time span.
1800
+ */
1801
+ item_actions?: Array<Amendment.ItemAction>;
1802
+
1803
+ /**
1804
+ * Instructions for how to modify phase metadata
1805
+ */
1806
+ metadata_actions?: Array<Amendment.MetadataAction>;
1807
+
1808
+ /**
1809
+ * Changes to how Stripe handles prorations during the amendment time span. Affects if and how prorations are created when a future phase starts. In cases where the amendment changes the currently active phase, it is used to determine whether or how to prorate now, at the time of the request. Also supported as a point-in-time operation when `amendment_end` is `null`.
1810
+ */
1811
+ proration_behavior?: Amendment.ProrationBehavior;
1812
+
1813
+ /**
1814
+ * Defines how to pause collection for the underlying subscription throughout the duration of the amendment.
1815
+ */
1816
+ set_pause_collection?: Amendment.SetPauseCollection;
1817
+
1818
+ /**
1819
+ * Ends the subscription schedule early as dictated by either the accompanying amendment's start or end.
1820
+ */
1821
+ set_schedule_end?: Amendment.SetScheduleEnd;
1822
+
1823
+ /**
1824
+ * Settings related to subscription trials.
1825
+ */
1826
+ trial_settings?: Amendment.TrialSettings;
1827
+ }
1828
+
1829
+ namespace Amendment {
1830
+ interface AmendmentEnd {
1831
+ /**
1832
+ * Use the `end` time of a given discount.
1833
+ */
1834
+ discount_end?: AmendmentEnd.DiscountEnd;
1835
+
1836
+ /**
1837
+ * Time span for the amendment starting from the `amendment_start`.
1838
+ */
1839
+ duration?: AmendmentEnd.Duration;
1840
+
1841
+ /**
1842
+ * A precise Unix timestamp for the amendment to end. Must be after the `amendment_start`.
1843
+ */
1844
+ timestamp?: number;
1845
+
1846
+ /**
1847
+ * Select one of three ways to pass the `amendment_end`.
1848
+ */
1849
+ type: AmendmentEnd.Type;
1850
+ }
1851
+
1852
+ namespace AmendmentEnd {
1853
+ interface DiscountEnd {
1854
+ /**
1855
+ * The ID of a specific discount.
1856
+ */
1857
+ discount: string;
1858
+ }
1859
+
1860
+ interface Duration {
1861
+ /**
1862
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1863
+ */
1864
+ interval: Duration.Interval;
1865
+
1866
+ /**
1867
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1868
+ */
1869
+ interval_count: number;
1870
+ }
1871
+
1872
+ namespace Duration {
1873
+ type Interval = 'day' | 'month' | 'week' | 'year';
1874
+ }
1875
+
1876
+ type Type =
1877
+ | 'discount_end'
1878
+ | 'duration'
1879
+ | 'schedule_end'
1880
+ | 'timestamp'
1881
+ | 'trial_end'
1882
+ | 'trial_start'
1883
+ | 'upcoming_invoice';
1884
+ }
1885
+
1886
+ interface AmendmentStart {
1887
+ /**
1888
+ * Details of another amendment in the same array, immediately after which this amendment should begin.
1889
+ */
1890
+ amendment_end?: AmendmentStart.AmendmentEnd;
1891
+
1892
+ /**
1893
+ * Use the `end` time of a given discount.
1894
+ */
1895
+ discount_end?: AmendmentStart.DiscountEnd;
1896
+
1897
+ /**
1898
+ * A precise Unix timestamp for the amendment to start.
1899
+ */
1900
+ timestamp?: number;
1901
+
1902
+ /**
1903
+ * Select one of three ways to pass the `amendment_start`.
1904
+ */
1905
+ type: AmendmentStart.Type;
1906
+ }
1907
+
1908
+ namespace AmendmentStart {
1909
+ interface AmendmentEnd {
1910
+ /**
1911
+ * The position of the previous amendment in the `amendments` array after which this amendment should begin. Indexes start from 0 and must be less than the index of the current amendment in the array.
1912
+ */
1913
+ index: number;
1914
+ }
1915
+
1916
+ interface DiscountEnd {
1917
+ /**
1918
+ * The ID of a specific discount.
1919
+ */
1920
+ discount: string;
1921
+ }
1922
+
1923
+ type Type =
1924
+ | 'amendment_end'
1925
+ | 'discount_end'
1926
+ | 'now'
1927
+ | 'schedule_end'
1928
+ | 'timestamp'
1929
+ | 'trial_end'
1930
+ | 'trial_start'
1931
+ | 'upcoming_invoice';
1932
+ }
1933
+
1934
+ type BillingCycleAnchor = 'amendment_start' | 'automatic';
1935
+
1936
+ interface DiscountAction {
1937
+ /**
1938
+ * Details of the discount to add.
1939
+ */
1940
+ add?: DiscountAction.Add;
1941
+
1942
+ /**
1943
+ * Details of the discount to remove.
1944
+ */
1945
+ remove?: DiscountAction.Remove;
1946
+
1947
+ /**
1948
+ * Details of the discount to replace the existing discounts with.
1949
+ */
1950
+ set?: DiscountAction.Set;
1951
+
1952
+ /**
1953
+ * Determines the type of discount action.
1954
+ */
1955
+ type: DiscountAction.Type;
1956
+ }
1957
+
1958
+ namespace DiscountAction {
1959
+ interface Add {
1960
+ /**
1961
+ * The coupon code to redeem.
1962
+ */
1963
+ coupon?: string;
1964
+
1965
+ /**
1966
+ * An ID of an existing discount for a coupon that was already redeemed.
1967
+ */
1968
+ discount?: string;
1969
+
1970
+ /**
1971
+ * Details to determine how long the discount should be applied for.
1972
+ */
1973
+ discount_end?: Add.DiscountEnd;
1974
+
1975
+ /**
1976
+ * 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.
1977
+ */
1978
+ index?: number;
1979
+
1980
+ /**
1981
+ * The promotion code to redeem.
1982
+ */
1983
+ promotion_code?: string;
1984
+ }
1985
+
1986
+ namespace Add {
1987
+ interface DiscountEnd {
1988
+ /**
1989
+ * The type of calculation made to determine when the discount ends.
1990
+ */
1991
+ type: 'amendment_end';
1992
+ }
1993
+ }
1994
+
1995
+ interface Remove {
1996
+ /**
1997
+ * The coupon code to remove from the `discounts` array.
1998
+ */
1999
+ coupon?: string;
2000
+
2001
+ /**
2002
+ * The ID of a discount to remove from the `discounts` array.
2003
+ */
2004
+ discount?: string;
2005
+
2006
+ /**
2007
+ * The ID of a promotion code to remove from the `discounts` array.
2008
+ */
2009
+ promotion_code?: string;
2010
+ }
2011
+
2012
+ interface Set {
2013
+ /**
2014
+ * The coupon code to replace the `discounts` array with.
2015
+ */
2016
+ coupon?: string;
2017
+
2018
+ /**
2019
+ * An ID of an existing discount to replace the `discounts` array with.
2020
+ */
2021
+ discount?: string;
2022
+
2023
+ /**
2024
+ * An ID of an existing promotion code to replace the `discounts` array with.
2025
+ */
2026
+ promotion_code?: string;
2027
+ }
2028
+
2029
+ type Type = 'add' | 'remove' | 'set';
2030
+ }
2031
+
2032
+ interface ItemAction {
2033
+ /**
2034
+ * Details of the subscription item to add. If an item with the same `price` exists, it will be replaced by this new item. Otherwise, it adds the new item.
2035
+ */
2036
+ add?: ItemAction.Add;
2037
+
2038
+ /**
2039
+ * Details of the subscription item to remove.
2040
+ */
2041
+ remove?: ItemAction.Remove;
2042
+
2043
+ /**
2044
+ * Details of the subscription item to replace the existing items with. If an item with the `set[price]` already exists, the `items` array is not cleared. Instead, all of the other `set` properties that are passed in this request will replace the existing values for the configuration item.
2045
+ */
2046
+ set?: ItemAction.Set;
2047
+
2048
+ /**
2049
+ * Determines the type of item action.
2050
+ */
2051
+ type: ItemAction.Type;
2052
+ }
2053
+
2054
+ namespace ItemAction {
2055
+ interface Add {
2056
+ /**
2057
+ * The discounts applied to the item. Subscription item discounts are applied before subscription discounts.
2058
+ */
2059
+ discounts?: Array<Add.Discount>;
2060
+
2061
+ /**
2062
+ * 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`.
2063
+ */
2064
+ metadata?: Stripe.MetadataParam;
2065
+
2066
+ /**
2067
+ * The ID of the price object.
2068
+ */
2069
+ price: string;
2070
+
2071
+ /**
2072
+ * Quantity for this item.
2073
+ */
2074
+ quantity?: number;
2075
+
2076
+ /**
2077
+ * 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`.
2078
+ */
2079
+ tax_rates?: Array<string>;
2080
+
2081
+ /**
2082
+ * Options that configure the trial on the subscription item.
2083
+ */
2084
+ trial?: Add.Trial;
2085
+ }
2086
+
2087
+ namespace Add {
2088
+ interface Discount {
2089
+ /**
2090
+ * ID of the coupon to create a new discount for.
2091
+ */
2092
+ coupon?: string;
2093
+
2094
+ /**
2095
+ * ID of an existing discount on the object (or one of its ancestors) to reuse.
2096
+ */
2097
+ discount?: string;
2098
+
2099
+ /**
2100
+ * Details to determine how long the discount should be applied for.
2101
+ */
2102
+ discount_end?: Discount.DiscountEnd;
2103
+
2104
+ /**
2105
+ * ID of the promotion code to create a new discount for.
2106
+ */
2107
+ promotion_code?: string;
2108
+ }
2109
+
2110
+ namespace Discount {
2111
+ interface DiscountEnd {
2112
+ /**
2113
+ * Time span for the redeemed discount.
2114
+ */
2115
+ duration?: DiscountEnd.Duration;
2116
+
2117
+ /**
2118
+ * A precise Unix timestamp for the discount to end. Must be in the future.
2119
+ */
2120
+ timestamp?: number;
2121
+
2122
+ /**
2123
+ * The type of calculation made to determine when the discount ends.
2124
+ */
2125
+ type: DiscountEnd.Type;
2126
+ }
2127
+
2128
+ namespace DiscountEnd {
2129
+ interface Duration {
2130
+ /**
2131
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2132
+ */
2133
+ interval: Duration.Interval;
2134
+
2135
+ /**
2136
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2137
+ */
2138
+ interval_count: number;
2139
+ }
2140
+
2141
+ namespace Duration {
2142
+ type Interval = 'day' | 'month' | 'week' | 'year';
2143
+ }
2144
+
2145
+ type Type = 'duration' | 'timestamp';
2146
+ }
2147
+ }
2148
+
2149
+ interface Trial {
2150
+ /**
2151
+ * 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.
2152
+ */
2153
+ converts_to?: Array<string>;
2154
+
2155
+ /**
2156
+ * Determines the type of trial for this item.
2157
+ */
2158
+ type: Trial.Type;
2159
+ }
2160
+
2161
+ namespace Trial {
2162
+ type Type = 'free' | 'paid';
2163
+ }
2164
+ }
2165
+
2166
+ interface Remove {
2167
+ /**
2168
+ * ID of a price to remove.
2169
+ */
2170
+ price: string;
2171
+ }
2172
+
2173
+ interface Set {
2174
+ /**
2175
+ * 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`.
2176
+ */
2177
+ discounts?: Array<Set.Discount>;
2178
+
2179
+ /**
2180
+ * 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`.
2181
+ */
2182
+ metadata?: Stripe.MetadataParam;
2183
+
2184
+ /**
2185
+ * The ID of the price object.
2186
+ */
2187
+ price: string;
2188
+
2189
+ /**
2190
+ * 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`.
2191
+ */
2192
+ quantity?: number;
2193
+
2194
+ /**
2195
+ * 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`.
2196
+ */
2197
+ tax_rates?: Array<string>;
2198
+
2199
+ /**
2200
+ * 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`.
2201
+ */
2202
+ trial?: Set.Trial;
2203
+ }
2204
+
2205
+ namespace Set {
2206
+ interface Discount {
2207
+ /**
2208
+ * ID of the coupon to create a new discount for.
2209
+ */
2210
+ coupon?: string;
2211
+
2212
+ /**
2213
+ * ID of an existing discount on the object (or one of its ancestors) to reuse.
2214
+ */
2215
+ discount?: string;
2216
+
2217
+ /**
2218
+ * Details to determine how long the discount should be applied for.
2219
+ */
2220
+ discount_end?: Discount.DiscountEnd;
2221
+
2222
+ /**
2223
+ * ID of the promotion code to create a new discount for.
2224
+ */
2225
+ promotion_code?: string;
2226
+ }
2227
+
2228
+ namespace Discount {
2229
+ interface DiscountEnd {
2230
+ /**
2231
+ * Time span for the redeemed discount.
2232
+ */
2233
+ duration?: DiscountEnd.Duration;
2234
+
2235
+ /**
2236
+ * A precise Unix timestamp for the discount to end. Must be in the future.
2237
+ */
2238
+ timestamp?: number;
2239
+
2240
+ /**
2241
+ * The type of calculation made to determine when the discount ends.
2242
+ */
2243
+ type: DiscountEnd.Type;
2244
+ }
2245
+
2246
+ namespace DiscountEnd {
2247
+ interface Duration {
2248
+ /**
2249
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2250
+ */
2251
+ interval: Duration.Interval;
2252
+
2253
+ /**
2254
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2255
+ */
2256
+ interval_count: number;
2257
+ }
2258
+
2259
+ namespace Duration {
2260
+ type Interval = 'day' | 'month' | 'week' | 'year';
2261
+ }
2262
+
2263
+ type Type = 'duration' | 'timestamp';
2264
+ }
2265
+ }
2266
+
2267
+ interface Trial {
2268
+ /**
2269
+ * 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.
2270
+ */
2271
+ converts_to?: Array<string>;
2272
+
2273
+ /**
2274
+ * Determines the type of trial for this item.
2275
+ */
2276
+ type: Trial.Type;
2277
+ }
2278
+
2279
+ namespace Trial {
2280
+ type Type = 'free' | 'paid';
2281
+ }
2282
+ }
2283
+
2284
+ type Type = 'add' | 'remove' | 'set';
2285
+ }
2286
+
2287
+ interface MetadataAction {
2288
+ /**
2289
+ * Key-value pairs to add to schedule phase metadata. These values will merge with existing schedule phase metadata.
2290
+ */
2291
+ add?: {
2292
+ [key: string]: string;
2293
+ };
2294
+
2295
+ /**
2296
+ * Keys to remove from schedule phase metadata.
2297
+ */
2298
+ remove?: Array<string>;
2299
+
2300
+ /**
2301
+ * Key-value pairs to set as schedule phase metadata. Existing schedule phase metadata will be overwritten.
2302
+ */
2303
+ set?: Stripe.Emptyable<{
2304
+ [key: string]: string;
2305
+ }>;
2306
+
2307
+ /**
2308
+ * Select one of three ways to update phase-level `metadata` on subscription schedules.
2309
+ */
2310
+ type: MetadataAction.Type;
2311
+ }
2312
+
2313
+ namespace MetadataAction {
2314
+ type Type = 'add' | 'remove' | 'set';
2315
+ }
2316
+
2317
+ type ProrationBehavior =
2318
+ | 'always_invoice'
2319
+ | 'create_prorations'
2320
+ | 'none';
2321
+
2322
+ interface SetPauseCollection {
2323
+ /**
2324
+ * Details of the pause_collection behavior to apply to the amendment.
2325
+ */
2326
+ set?: SetPauseCollection.Set;
2327
+
2328
+ /**
2329
+ * Determines the type of the pause_collection amendment.
2330
+ */
2331
+ type: SetPauseCollection.Type;
2332
+ }
2333
+
2334
+ namespace SetPauseCollection {
2335
+ interface Set {
2336
+ /**
2337
+ * The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
2338
+ */
2339
+ behavior: Set.Behavior;
2340
+ }
2341
+
2342
+ namespace Set {
2343
+ type Behavior = 'keep_as_draft' | 'mark_uncollectible' | 'void';
2344
+ }
2345
+
2346
+ type Type = 'remove' | 'set';
2347
+ }
2348
+
2349
+ type SetScheduleEnd = 'amendment_end' | 'amendment_start';
2350
+
2351
+ interface TrialSettings {
2352
+ /**
2353
+ * Defines how the subscription should behave when a trial ends.
2354
+ */
2355
+ end_behavior?: TrialSettings.EndBehavior;
2356
+ }
2357
+
2358
+ namespace TrialSettings {
2359
+ interface EndBehavior {
2360
+ /**
2361
+ * Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
2362
+ */
2363
+ prorate_up_front?: EndBehavior.ProrateUpFront;
2364
+ }
2365
+
2366
+ namespace EndBehavior {
2367
+ type ProrateUpFront = 'defer' | 'include';
2368
+ }
2369
+ }
2370
+ }
2371
+
2372
+ interface Prebilling {
2373
+ /**
2374
+ * The beginning of the prebilled time period. The default value is `now`.
2375
+ */
2376
+ bill_from?: Prebilling.BillFrom;
2377
+
2378
+ /**
2379
+ * The end of the prebilled time period.
2380
+ */
2381
+ bill_until?: Prebilling.BillUntil;
2382
+
2383
+ /**
2384
+ * When the prebilling invoice should be created. The default value is `now`.
2385
+ */
2386
+ invoice_at?: 'now';
2387
+
2388
+ /**
2389
+ * Whether to cancel or preserve `prebilling` if the subscription is updated during the prebilled period. The default value is `reset`.
2390
+ */
2391
+ update_behavior?: Prebilling.UpdateBehavior;
2392
+ }
2393
+
2394
+ namespace Prebilling {
2395
+ interface BillFrom {
2396
+ /**
2397
+ * Start the prebilled period when a specified amendment begins.
2398
+ */
2399
+ amendment_start?: BillFrom.AmendmentStart;
2400
+
2401
+ /**
2402
+ * Start the prebilled period at a precise integer timestamp, starting from the Unix epoch.
2403
+ */
2404
+ timestamp?: number;
2405
+
2406
+ /**
2407
+ * Select one of several ways to pass the `bill_from` value.
2408
+ */
2409
+ type: BillFrom.Type;
2410
+ }
2411
+
2412
+ namespace BillFrom {
2413
+ interface AmendmentStart {
2414
+ /**
2415
+ * The position of the amendment in the `amendments` array with which prebilling should begin. Indexes start from 0 and must be less than the total number of supplied amendments.
2416
+ */
2417
+ index: number;
2418
+ }
2419
+
2420
+ type Type = 'amendment_start' | 'now' | 'timestamp';
2421
+ }
2422
+
2423
+ interface BillUntil {
2424
+ /**
2425
+ * End the prebilled period when a specified amendment ends.
2426
+ */
2427
+ amendment_end?: BillUntil.AmendmentEnd;
2428
+
2429
+ /**
2430
+ * Time span for prebilling, starting from `bill_from`.
2431
+ */
2432
+ duration?: BillUntil.Duration;
2433
+
2434
+ /**
2435
+ * End the prebilled period at a precise integer timestamp, starting from the Unix epoch.
2436
+ */
2437
+ timestamp?: number;
2438
+
2439
+ /**
2440
+ * Select one of several ways to pass the `bill_until` value.
2441
+ */
2442
+ type: BillUntil.Type;
2443
+ }
2444
+
2445
+ namespace BillUntil {
2446
+ interface AmendmentEnd {
2447
+ /**
2448
+ * The position of the amendment in the `amendments` array at which prebilling should end. Indexes start from 0 and must be less than the total number of supplied amendments.
2449
+ */
2450
+ index: number;
2451
+ }
2452
+
2453
+ interface Duration {
2454
+ /**
2455
+ * Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2456
+ */
2457
+ interval: Duration.Interval;
2458
+
2459
+ /**
2460
+ * The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2461
+ */
2462
+ interval_count: number;
2463
+ }
2464
+
2465
+ namespace Duration {
2466
+ type Interval = 'day' | 'month' | 'week' | 'year';
2467
+ }
2468
+
2469
+ type Type =
2470
+ | 'amendment_end'
2471
+ | 'duration'
2472
+ | 'schedule_end'
2473
+ | 'timestamp';
2474
+ }
2475
+
2476
+ type UpdateBehavior = 'prebill' | 'reset';
2477
+ }
2478
+
2479
+ type ProrationBehavior = 'always_invoice' | 'create_prorations' | 'none';
2480
+
2481
+ interface ScheduleSettings {
2482
+ /**
2483
+ * Behavior of the subscription schedule and underlying subscription when it ends.
2484
+ */
2485
+ end_behavior?: ScheduleSettings.EndBehavior;
2486
+ }
2487
+
2488
+ namespace ScheduleSettings {
2489
+ type EndBehavior = 'cancel' | 'release';
2490
+ }
2491
+ }
2492
+
2493
+ interface SubscriptionScheduleCancelParams {
2494
+ /**
2495
+ * Specifies which fields in the response should be expanded.
2496
+ */
2497
+ expand?: Array<string>;
2498
+
2499
+ /**
2500
+ * 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. Defaults to `true`.
2501
+ */
2502
+ invoice_now?: boolean;
2503
+
2504
+ /**
2505
+ * If the subscription schedule is `active`, indicates if the cancellation should be prorated. Defaults to `true`.
2506
+ */
2507
+ prorate?: boolean;
2508
+ }
2509
+
2510
+ interface SubscriptionScheduleReleaseParams {
2511
+ /**
2512
+ * Specifies which fields in the response should be expanded.
2513
+ */
2514
+ expand?: Array<string>;
2515
+
2516
+ /**
2517
+ * Keep any cancellation on the subscription that the schedule has set
2518
+ */
2519
+ preserve_cancel_date?: boolean;
2520
+ }
2521
+
2522
+ class SubscriptionSchedulesResource {
2523
+ /**
2524
+ * Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.
1320
2525
  */
1321
2526
  create(
1322
2527
  params?: SubscriptionScheduleCreateParams,
@@ -1359,6 +2564,19 @@ declare module 'stripe' {
1359
2564
  options?: RequestOptions
1360
2565
  ): ApiListPromise<Stripe.SubscriptionSchedule>;
1361
2566
 
2567
+ /**
2568
+ * Amends an existing subscription schedule.
2569
+ */
2570
+ amend(
2571
+ id: string,
2572
+ params?: SubscriptionScheduleAmendParams,
2573
+ options?: RequestOptions
2574
+ ): Promise<Stripe.Response<Stripe.SubscriptionSchedule>>;
2575
+ amend(
2576
+ id: string,
2577
+ options?: RequestOptions
2578
+ ): Promise<Stripe.Response<Stripe.SubscriptionSchedule>>;
2579
+
1362
2580
  /**
1363
2581
  * Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
1364
2582
  */