stripe 15.2.0.pre.beta.1 → 15.3.0.pre.beta.1

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 (196) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +92 -0
  3. data/CONTRIBUTING.md +25 -0
  4. data/OPENAPI_VERSION +1 -1
  5. data/README.md +10 -7
  6. data/VERSION +1 -1
  7. data/lib/stripe/api_version.rb +1 -1
  8. data/lib/stripe/event_types.rb +9 -0
  9. data/lib/stripe/events/v2_core_account_link_completed_event.rb +1 -1
  10. data/lib/stripe/events/v2_money_management_inbound_transfer_bank_debit_failed_event.rb +1 -1
  11. data/lib/stripe/events/v2_money_management_inbound_transfer_bank_debit_processing_event.rb +1 -1
  12. data/lib/stripe/events/v2_money_management_inbound_transfer_bank_debit_queued_event.rb +1 -1
  13. data/lib/stripe/events/v2_money_management_inbound_transfer_bank_debit_returned_event.rb +1 -1
  14. data/lib/stripe/events/v2_money_management_inbound_transfer_bank_debit_succeeded_event.rb +1 -1
  15. data/lib/stripe/events/v2_money_management_outbound_payment_canceled_event.rb +1 -1
  16. data/lib/stripe/events/v2_money_management_outbound_payment_failed_event.rb +1 -1
  17. data/lib/stripe/events/v2_money_management_outbound_payment_posted_event.rb +1 -1
  18. data/lib/stripe/events/v2_money_management_outbound_payment_returned_event.rb +1 -1
  19. data/lib/stripe/events/v2_money_management_outbound_payment_updated_event.rb +1 -1
  20. data/lib/stripe/events/v2_off_session_payment_requires_capture_event.rb +21 -0
  21. data/lib/stripe/events/v2_payments_off_session_payment_authorization_attempt_failed_event.rb +21 -0
  22. data/lib/stripe/events/v2_payments_off_session_payment_authorization_attempt_started_event.rb +21 -0
  23. data/lib/stripe/events/v2_payments_off_session_payment_canceled_event.rb +21 -0
  24. data/lib/stripe/events/v2_payments_off_session_payment_created_event.rb +21 -0
  25. data/lib/stripe/events/v2_payments_off_session_payment_failed_event.rb +21 -0
  26. data/lib/stripe/events/v2_payments_off_session_payment_succeeded_event.rb +21 -0
  27. data/lib/stripe/object_types.rb +1 -3
  28. data/lib/stripe/resources/account.rb +47 -20
  29. data/lib/stripe/resources/account_session.rb +85 -24
  30. data/lib/stripe/resources/apple_pay_domain.rb +1 -2
  31. data/lib/stripe/resources/balance.rb +42 -0
  32. data/lib/stripe/resources/balance_transaction.rb +2 -0
  33. data/lib/stripe/resources/bank_account.rb +2 -2
  34. data/lib/stripe/resources/billing_portal/session.rb +1 -1
  35. data/lib/stripe/resources/capability.rb +1 -1
  36. data/lib/stripe/resources/charge.rb +85 -9
  37. data/lib/stripe/resources/checkout/session.rb +22 -6
  38. data/lib/stripe/resources/confirmation_token.rb +37 -97
  39. data/lib/stripe/resources/country_spec.rb +1 -1
  40. data/lib/stripe/resources/coupon.rb +1 -2
  41. data/lib/stripe/resources/credit_note.rb +10 -11
  42. data/lib/stripe/resources/customer.rb +2 -4
  43. data/lib/stripe/resources/customer_session.rb +3 -3
  44. data/lib/stripe/resources/dispute.rb +2 -2
  45. data/lib/stripe/resources/event.rb +1 -1
  46. data/lib/stripe/resources/file.rb +1 -1
  47. data/lib/stripe/resources/financial_connections/account.rb +2 -0
  48. data/lib/stripe/resources/financial_connections/institution.rb +2 -0
  49. data/lib/stripe/resources/identity/verification_report.rb +6 -0
  50. data/lib/stripe/resources/identity/verification_session.rb +17 -11
  51. data/lib/stripe/resources/invoice.rb +70 -43
  52. data/lib/stripe/resources/invoice_item.rb +2 -3
  53. data/lib/stripe/resources/invoice_line_item.rb +1 -1
  54. data/lib/stripe/resources/invoice_payment.rb +9 -2
  55. data/lib/stripe/resources/issuing/authorization.rb +8 -8
  56. data/lib/stripe/resources/issuing/card.rb +1 -1
  57. data/lib/stripe/resources/issuing/dispute.rb +3 -3
  58. data/lib/stripe/resources/order.rb +2 -55
  59. data/lib/stripe/resources/payment_attempt_record.rb +8 -0
  60. data/lib/stripe/resources/payment_intent.rb +439 -411
  61. data/lib/stripe/resources/payment_intent_amount_details_line_item.rb +7 -0
  62. data/lib/stripe/resources/payment_method.rb +50 -113
  63. data/lib/stripe/resources/payment_method_configuration.rb +297 -2
  64. data/lib/stripe/resources/payment_method_domain.rb +2 -2
  65. data/lib/stripe/resources/payment_record.rb +8 -0
  66. data/lib/stripe/resources/payout.rb +4 -4
  67. data/lib/stripe/resources/person.rb +2 -2
  68. data/lib/stripe/resources/plan.rb +2 -3
  69. data/lib/stripe/resources/price.rb +1 -1
  70. data/lib/stripe/resources/privacy/redaction_job.rb +52 -29
  71. data/lib/stripe/resources/privacy/redaction_job_validation_error.rb +12 -4
  72. data/lib/stripe/resources/product.rb +1 -61
  73. data/lib/stripe/resources/quote.rb +1 -1
  74. data/lib/stripe/resources/quote_preview_invoice.rb +2 -2
  75. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +26 -1
  76. data/lib/stripe/resources/radar/value_list.rb +1 -2
  77. data/lib/stripe/resources/radar/value_list_item.rb +1 -2
  78. data/lib/stripe/resources/refund.rb +6 -1
  79. data/lib/stripe/resources/reversal.rb +1 -1
  80. data/lib/stripe/resources/review.rb +1 -1
  81. data/lib/stripe/resources/setup_intent.rb +123 -311
  82. data/lib/stripe/resources/source.rb +1 -1
  83. data/lib/stripe/resources/subscription.rb +132 -37
  84. data/lib/stripe/resources/subscription_item.rb +33 -0
  85. data/lib/stripe/resources/subscription_schedule.rb +120 -5
  86. data/lib/stripe/resources/tax/association.rb +8 -31
  87. data/lib/stripe/resources/tax/calculation.rb +4 -0
  88. data/lib/stripe/resources/tax/calculation_line_item.rb +2 -0
  89. data/lib/stripe/resources/tax/registration.rb +1 -1
  90. data/lib/stripe/resources/tax_id.rb +1 -2
  91. data/lib/stripe/resources/tax_rate.rb +2 -2
  92. data/lib/stripe/resources/terminal/configuration.rb +1 -2
  93. data/lib/stripe/resources/terminal/location.rb +2 -3
  94. data/lib/stripe/resources/terminal/reader.rb +26 -4
  95. data/lib/stripe/resources/test_helpers/test_clock.rb +1 -2
  96. data/lib/stripe/resources/token.rb +2 -2
  97. data/lib/stripe/resources/transfer.rb +1 -1
  98. data/lib/stripe/resources/v2/core/account.rb +5 -5
  99. data/lib/stripe/resources/v2/money_management/received_credit.rb +0 -20
  100. data/lib/stripe/resources/v2/money_management/received_debit.rb +0 -24
  101. data/lib/stripe/resources/v2/payments/off_session_payment.rb +74 -0
  102. data/lib/stripe/resources/webhook_endpoint.rb +1 -2
  103. data/lib/stripe/resources.rb +8 -3
  104. data/lib/stripe/services/account_external_account_service.rb +2 -3
  105. data/lib/stripe/services/account_login_link_service.rb +1 -1
  106. data/lib/stripe/services/account_person_service.rb +1 -2
  107. data/lib/stripe/services/account_service.rb +38 -13
  108. data/lib/stripe/services/account_session_service.rb +49 -24
  109. data/lib/stripe/services/apple_pay_domain_service.rb +1 -2
  110. data/lib/stripe/services/balance_service.rb +1 -1
  111. data/lib/stripe/services/balance_settings_service.rb +2 -2
  112. data/lib/stripe/services/charge_service.rb +76 -8
  113. data/lib/stripe/services/checkout/session_service.rb +14 -6
  114. data/lib/stripe/services/coupon_service.rb +1 -2
  115. data/lib/stripe/services/credit_note_service.rb +7 -8
  116. data/lib/stripe/services/customer_balance_transaction_service.rb +3 -3
  117. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +2 -2
  118. data/lib/stripe/services/customer_payment_source_service.rb +1 -1
  119. data/lib/stripe/services/customer_service.rb +3 -5
  120. data/lib/stripe/services/customer_tax_id_service.rb +1 -2
  121. data/lib/stripe/services/dispute_service.rb +1 -1
  122. data/lib/stripe/services/external_account_service.rb +2 -3
  123. data/lib/stripe/services/file_service.rb +1 -1
  124. data/lib/stripe/services/identity/verification_session_service.rb +5 -5
  125. data/lib/stripe/services/invoice_item_service.rb +1 -2
  126. data/lib/stripe/services/invoice_service.rb +65 -35
  127. data/lib/stripe/services/issuing/authorization_service.rb +4 -4
  128. data/lib/stripe/services/issuing/card_service.rb +1 -1
  129. data/lib/stripe/services/issuing/dispute_service.rb +2 -2
  130. data/lib/stripe/services/order_service.rb +1 -33
  131. data/lib/stripe/services/payment_intent_service.rb +385 -386
  132. data/lib/stripe/services/payment_method_configuration_service.rb +212 -2
  133. data/lib/stripe/services/payment_method_domain_service.rb +1 -1
  134. data/lib/stripe/services/payment_method_service.rb +47 -110
  135. data/lib/stripe/services/payout_service.rb +2 -2
  136. data/lib/stripe/services/plan_service.rb +2 -3
  137. data/lib/stripe/services/price_service.rb +2 -2
  138. data/lib/stripe/services/privacy/redaction_job_service.rb +22 -13
  139. data/lib/stripe/services/privacy/redaction_job_validation_error_service.rb +1 -1
  140. data/lib/stripe/services/product_feature_service.rb +1 -2
  141. data/lib/stripe/services/product_service.rb +2 -41
  142. data/lib/stripe/services/promotion_code_service.rb +1 -1
  143. data/lib/stripe/services/quote_service.rb +1 -1
  144. data/lib/stripe/services/radar/early_fraud_warning_service.rb +1 -1
  145. data/lib/stripe/services/radar/value_list_item_service.rb +1 -2
  146. data/lib/stripe/services/radar/value_list_service.rb +1 -2
  147. data/lib/stripe/services/setup_intent_service.rb +122 -310
  148. data/lib/stripe/services/source_service.rb +1 -1
  149. data/lib/stripe/services/subscription_item_service.rb +26 -0
  150. data/lib/stripe/services/subscription_schedule_service.rb +94 -4
  151. data/lib/stripe/services/subscription_service.rb +103 -33
  152. data/lib/stripe/services/tax/calculation_service.rb +4 -0
  153. data/lib/stripe/services/tax/registration_service.rb +1 -1
  154. data/lib/stripe/services/tax_id_service.rb +1 -2
  155. data/lib/stripe/services/terminal/configuration_service.rb +1 -2
  156. data/lib/stripe/services/terminal/location_service.rb +2 -3
  157. data/lib/stripe/services/terminal/reader_service.rb +17 -3
  158. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +37 -97
  159. data/lib/stripe/services/test_helpers/test_clock_service.rb +1 -2
  160. data/lib/stripe/services/token_service.rb +1 -1
  161. data/lib/stripe/services/transfer_service.rb +1 -1
  162. data/lib/stripe/services/v1_services.rb +1 -2
  163. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +1 -2
  164. data/lib/stripe/services/v2/core/accounts/person_service.rb +2 -4
  165. data/lib/stripe/services/v2/core/event_destination_service.rb +4 -10
  166. data/lib/stripe/services/v2/core/event_service.rb +1 -2
  167. data/lib/stripe/services/v2/core/vault/gb_bank_account_service.rb +3 -7
  168. data/lib/stripe/services/v2/core/vault/us_bank_account_service.rb +2 -4
  169. data/lib/stripe/services/v2/money_management/adjustment_service.rb +1 -2
  170. data/lib/stripe/services/v2/money_management/financial_account_service.rb +1 -2
  171. data/lib/stripe/services/v2/money_management/financial_address_service.rb +1 -1
  172. data/lib/stripe/services/v2/money_management/inbound_transfer_service.rb +1 -2
  173. data/lib/stripe/services/v2/money_management/outbound_payment_quote_service.rb +1 -2
  174. data/lib/stripe/services/v2/money_management/outbound_payment_service.rb +2 -4
  175. data/lib/stripe/services/v2/money_management/outbound_setup_intent_service.rb +2 -4
  176. data/lib/stripe/services/v2/money_management/outbound_transfer_service.rb +2 -4
  177. data/lib/stripe/services/v2/money_management/payout_method_service.rb +3 -7
  178. data/lib/stripe/services/v2/money_management/received_credit_service.rb +1 -2
  179. data/lib/stripe/services/v2/money_management/received_debit_service.rb +1 -2
  180. data/lib/stripe/services/v2/money_management/transaction_entry_service.rb +1 -2
  181. data/lib/stripe/services/v2/money_management/transaction_service.rb +1 -2
  182. data/lib/stripe/services/v2/payment_service.rb +15 -0
  183. data/lib/stripe/services/v2/payments/off_session_payment_service.rb +138 -0
  184. data/lib/stripe/services/v2/test_helpers/financial_address_service.rb +1 -2
  185. data/lib/stripe/services/v2_services.rb +2 -1
  186. data/lib/stripe/services/webhook_endpoint_service.rb +1 -2
  187. data/lib/stripe/services.rb +2 -3
  188. data/lib/stripe/version.rb +1 -1
  189. data/rbi/stripe.rbi +3903 -4131
  190. metadata +13 -8
  191. data/lib/stripe/resources/billing/meter_error_report.rb +0 -59
  192. data/lib/stripe/resources/gift_cards/card.rb +0 -208
  193. data/lib/stripe/resources/gift_cards/transaction.rb +0 -272
  194. data/lib/stripe/services/gift_cards/card_service.rb +0 -170
  195. data/lib/stripe/services/gift_cards/transaction_service.rb +0 -209
  196. data/lib/stripe/services/gift_cards_service.rb +0 -14
@@ -640,7 +640,7 @@ module Stripe
640
640
 
641
641
  # Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
642
642
  #
643
- # This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail.
643
+ # This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://docs.stripe.com/docs/sources) for more detail.
644
644
  def update(source, params = {}, opts = {})
645
645
  request(
646
646
  method: :post,
@@ -28,6 +28,15 @@ module Stripe
28
28
  end
29
29
 
30
30
  class UpdateParams < Stripe::RequestParams
31
+ class BillingThresholds < Stripe::RequestParams
32
+ # Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
33
+ attr_accessor :usage_gte
34
+
35
+ def initialize(usage_gte: nil)
36
+ @usage_gte = usage_gte
37
+ end
38
+ end
39
+
31
40
  class Discount < Stripe::RequestParams
32
41
  class DiscountEnd < Stripe::RequestParams
33
42
  class Duration < Stripe::RequestParams
@@ -112,6 +121,8 @@ module Stripe
112
121
  @unit_amount_decimal = unit_amount_decimal
113
122
  end
114
123
  end
124
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
125
+ attr_accessor :billing_thresholds
115
126
  # The coupons to redeem into discounts for the subscription item.
116
127
  attr_accessor :discounts
117
128
  # Specifies which fields in the response should be expanded.
@@ -144,6 +155,7 @@ module Stripe
144
155
  attr_accessor :tax_rates
145
156
 
146
157
  def initialize(
158
+ billing_thresholds: nil,
147
159
  discounts: nil,
148
160
  expand: nil,
149
161
  metadata: nil,
@@ -157,6 +169,7 @@ module Stripe
157
169
  quantity: nil,
158
170
  tax_rates: nil
159
171
  )
172
+ @billing_thresholds = billing_thresholds
160
173
  @discounts = discounts
161
174
  @expand = expand
162
175
  @metadata = metadata
@@ -200,6 +213,15 @@ module Stripe
200
213
  end
201
214
 
202
215
  class CreateParams < Stripe::RequestParams
216
+ class BillingThresholds < Stripe::RequestParams
217
+ # Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
218
+ attr_accessor :usage_gte
219
+
220
+ def initialize(usage_gte: nil)
221
+ @usage_gte = usage_gte
222
+ end
223
+ end
224
+
203
225
  class Discount < Stripe::RequestParams
204
226
  class DiscountEnd < Stripe::RequestParams
205
227
  class Duration < Stripe::RequestParams
@@ -296,6 +318,8 @@ module Stripe
296
318
  @type = type
297
319
  end
298
320
  end
321
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
322
+ attr_accessor :billing_thresholds
299
323
  # The coupons to redeem into discounts for the subscription item.
300
324
  attr_accessor :discounts
301
325
  # Specifies which fields in the response should be expanded.
@@ -330,6 +354,7 @@ module Stripe
330
354
  attr_accessor :trial
331
355
 
332
356
  def initialize(
357
+ billing_thresholds: nil,
333
358
  discounts: nil,
334
359
  expand: nil,
335
360
  metadata: nil,
@@ -344,6 +369,7 @@ module Stripe
344
369
  tax_rates: nil,
345
370
  trial: nil
346
371
  )
372
+ @billing_thresholds = billing_thresholds
347
373
  @discounts = discounts
348
374
  @expand = expand
349
375
  @metadata = metadata
@@ -150,6 +150,18 @@ module Stripe
150
150
  end
151
151
  end
152
152
 
153
+ class BillingThresholds < Stripe::RequestParams
154
+ # Monetary threshold that triggers the subscription to advance to a new billing period
155
+ attr_accessor :amount_gte
156
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
157
+ attr_accessor :reset_billing_cycle_anchor
158
+
159
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
160
+ @amount_gte = amount_gte
161
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
162
+ end
163
+ end
164
+
153
165
  class InvoiceSettings < Stripe::RequestParams
154
166
  class Issuer < Stripe::RequestParams
155
167
  # The connected account being referenced when `type` is `account`.
@@ -193,6 +205,8 @@ module Stripe
193
205
  attr_accessor :automatic_tax
194
206
  # Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
195
207
  attr_accessor :billing_cycle_anchor
208
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
209
+ attr_accessor :billing_thresholds
196
210
  # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the 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` on creation.
197
211
  attr_accessor :collection_method
198
212
  # ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
@@ -210,6 +224,7 @@ module Stripe
210
224
  application_fee_percent: nil,
211
225
  automatic_tax: nil,
212
226
  billing_cycle_anchor: nil,
227
+ billing_thresholds: nil,
213
228
  collection_method: nil,
214
229
  default_payment_method: nil,
215
230
  description: nil,
@@ -220,6 +235,7 @@ module Stripe
220
235
  @application_fee_percent = application_fee_percent
221
236
  @automatic_tax = automatic_tax
222
237
  @billing_cycle_anchor = billing_cycle_anchor
238
+ @billing_thresholds = billing_thresholds
223
239
  @collection_method = collection_method
224
240
  @default_payment_method = default_payment_method
225
241
  @description = description
@@ -343,6 +359,18 @@ module Stripe
343
359
  end
344
360
  end
345
361
 
362
+ class BillingThresholds < Stripe::RequestParams
363
+ # Monetary threshold that triggers the subscription to advance to a new billing period
364
+ attr_accessor :amount_gte
365
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
366
+ attr_accessor :reset_billing_cycle_anchor
367
+
368
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
369
+ @amount_gte = amount_gte
370
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
371
+ end
372
+ end
373
+
346
374
  class Discount < Stripe::RequestParams
347
375
  class DiscountEnd < Stripe::RequestParams
348
376
  class Duration < Stripe::RequestParams
@@ -413,6 +441,15 @@ module Stripe
413
441
  end
414
442
 
415
443
  class Item < Stripe::RequestParams
444
+ class BillingThresholds < Stripe::RequestParams
445
+ # Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
446
+ attr_accessor :usage_gte
447
+
448
+ def initialize(usage_gte: nil)
449
+ @usage_gte = usage_gte
450
+ end
451
+ end
452
+
416
453
  class Discount < Stripe::RequestParams
417
454
  class DiscountEnd < Stripe::RequestParams
418
455
  class Duration < Stripe::RequestParams
@@ -509,6 +546,8 @@ module Stripe
509
546
  @type = type
510
547
  end
511
548
  end
549
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
550
+ attr_accessor :billing_thresholds
512
551
  # The coupons to redeem into discounts for the subscription item.
513
552
  attr_accessor :discounts
514
553
  # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item. Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys. Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`. To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
@@ -527,6 +566,7 @@ module Stripe
527
566
  attr_accessor :trial
528
567
 
529
568
  def initialize(
569
+ billing_thresholds: nil,
530
570
  discounts: nil,
531
571
  metadata: nil,
532
572
  plan: nil,
@@ -536,6 +576,7 @@ module Stripe
536
576
  tax_rates: nil,
537
577
  trial: nil
538
578
  )
579
+ @billing_thresholds = billing_thresholds
539
580
  @discounts = discounts
540
581
  @metadata = metadata
541
582
  @plan = plan
@@ -592,6 +633,8 @@ module Stripe
592
633
  attr_accessor :automatic_tax
593
634
  # Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
594
635
  attr_accessor :billing_cycle_anchor
636
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
637
+ attr_accessor :billing_thresholds
595
638
  # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the 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` on creation.
596
639
  attr_accessor :collection_method
597
640
  # 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).
@@ -618,7 +661,7 @@ module Stripe
618
661
  attr_accessor :on_behalf_of
619
662
  # 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).
620
663
  attr_accessor :pause_collection
621
- # 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.
664
+ # Controls whether the subscription schedule should create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase if there is a difference in billing configuration. 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 (item price, quantity, etc.) of the current phase.
622
665
  attr_accessor :proration_behavior
623
666
  # The data with which to automatically create a Transfer for each of the associated subscription's invoices.
624
667
  attr_accessor :transfer_data
@@ -636,6 +679,7 @@ module Stripe
636
679
  application_fee_percent: nil,
637
680
  automatic_tax: nil,
638
681
  billing_cycle_anchor: nil,
682
+ billing_thresholds: nil,
639
683
  collection_method: nil,
640
684
  currency: nil,
641
685
  default_payment_method: nil,
@@ -660,6 +704,7 @@ module Stripe
660
704
  @application_fee_percent = application_fee_percent
661
705
  @automatic_tax = automatic_tax
662
706
  @billing_cycle_anchor = billing_cycle_anchor
707
+ @billing_thresholds = billing_thresholds
663
708
  @collection_method = collection_method
664
709
  @currency = currency
665
710
  @default_payment_method = default_payment_method
@@ -695,7 +740,7 @@ module Stripe
695
740
  end
696
741
  # 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.
697
742
  attr_accessor :billing_behavior
698
- # Configure billing_mode to opt in improved credit proration behavior.When the schedule creates a subscription, the subscription's `billing_mode` will be set to the same value as the schedule's `billing_mode`.
743
+ # Controls how prorations and invoices for subscriptions are calculated and orchestrated.
699
744
  attr_accessor :billing_mode
700
745
  # The identifier of the customer to create the subscription schedule for.
701
746
  attr_accessor :customer
@@ -781,6 +826,18 @@ module Stripe
781
826
  end
782
827
  end
783
828
 
829
+ class BillingThresholds < Stripe::RequestParams
830
+ # Monetary threshold that triggers the subscription to advance to a new billing period
831
+ attr_accessor :amount_gte
832
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
833
+ attr_accessor :reset_billing_cycle_anchor
834
+
835
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
836
+ @amount_gte = amount_gte
837
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
838
+ end
839
+ end
840
+
784
841
  class InvoiceSettings < Stripe::RequestParams
785
842
  class Issuer < Stripe::RequestParams
786
843
  # The connected account being referenced when `type` is `account`.
@@ -824,6 +881,8 @@ module Stripe
824
881
  attr_accessor :automatic_tax
825
882
  # Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
826
883
  attr_accessor :billing_cycle_anchor
884
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
885
+ attr_accessor :billing_thresholds
827
886
  # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the 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` on creation.
828
887
  attr_accessor :collection_method
829
888
  # ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
@@ -841,6 +900,7 @@ module Stripe
841
900
  application_fee_percent: nil,
842
901
  automatic_tax: nil,
843
902
  billing_cycle_anchor: nil,
903
+ billing_thresholds: nil,
844
904
  collection_method: nil,
845
905
  default_payment_method: nil,
846
906
  description: nil,
@@ -851,6 +911,7 @@ module Stripe
851
911
  @application_fee_percent = application_fee_percent
852
912
  @automatic_tax = automatic_tax
853
913
  @billing_cycle_anchor = billing_cycle_anchor
914
+ @billing_thresholds = billing_thresholds
854
915
  @collection_method = collection_method
855
916
  @default_payment_method = default_payment_method
856
917
  @description = description
@@ -974,6 +1035,18 @@ module Stripe
974
1035
  end
975
1036
  end
976
1037
 
1038
+ class BillingThresholds < Stripe::RequestParams
1039
+ # Monetary threshold that triggers the subscription to advance to a new billing period
1040
+ attr_accessor :amount_gte
1041
+ # Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
1042
+ attr_accessor :reset_billing_cycle_anchor
1043
+
1044
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
1045
+ @amount_gte = amount_gte
1046
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
1047
+ end
1048
+ end
1049
+
977
1050
  class Discount < Stripe::RequestParams
978
1051
  class DiscountEnd < Stripe::RequestParams
979
1052
  class Duration < Stripe::RequestParams
@@ -1044,6 +1117,15 @@ module Stripe
1044
1117
  end
1045
1118
 
1046
1119
  class Item < Stripe::RequestParams
1120
+ class BillingThresholds < Stripe::RequestParams
1121
+ # Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
1122
+ attr_accessor :usage_gte
1123
+
1124
+ def initialize(usage_gte: nil)
1125
+ @usage_gte = usage_gte
1126
+ end
1127
+ end
1128
+
1047
1129
  class Discount < Stripe::RequestParams
1048
1130
  class DiscountEnd < Stripe::RequestParams
1049
1131
  class Duration < Stripe::RequestParams
@@ -1140,6 +1222,8 @@ module Stripe
1140
1222
  @type = type
1141
1223
  end
1142
1224
  end
1225
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
1226
+ attr_accessor :billing_thresholds
1143
1227
  # The coupons to redeem into discounts for the subscription item.
1144
1228
  attr_accessor :discounts
1145
1229
  # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item. Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys. Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`. To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
@@ -1158,6 +1242,7 @@ module Stripe
1158
1242
  attr_accessor :trial
1159
1243
 
1160
1244
  def initialize(
1245
+ billing_thresholds: nil,
1161
1246
  discounts: nil,
1162
1247
  metadata: nil,
1163
1248
  plan: nil,
@@ -1167,6 +1252,7 @@ module Stripe
1167
1252
  tax_rates: nil,
1168
1253
  trial: nil
1169
1254
  )
1255
+ @billing_thresholds = billing_thresholds
1170
1256
  @discounts = discounts
1171
1257
  @metadata = metadata
1172
1258
  @plan = plan
@@ -1223,6 +1309,8 @@ module Stripe
1223
1309
  attr_accessor :automatic_tax
1224
1310
  # Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
1225
1311
  attr_accessor :billing_cycle_anchor
1312
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
1313
+ attr_accessor :billing_thresholds
1226
1314
  # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the 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` on creation.
1227
1315
  attr_accessor :collection_method
1228
1316
  # 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).
@@ -1249,7 +1337,7 @@ module Stripe
1249
1337
  attr_accessor :on_behalf_of
1250
1338
  # 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).
1251
1339
  attr_accessor :pause_collection
1252
- # 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.
1340
+ # Controls whether the subscription schedule should create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase if there is a difference in billing configuration. 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 (item price, quantity, etc.) of the current phase.
1253
1341
  attr_accessor :proration_behavior
1254
1342
  # The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase.
1255
1343
  attr_accessor :start_date
@@ -1269,6 +1357,7 @@ module Stripe
1269
1357
  application_fee_percent: nil,
1270
1358
  automatic_tax: nil,
1271
1359
  billing_cycle_anchor: nil,
1360
+ billing_thresholds: nil,
1272
1361
  collection_method: nil,
1273
1362
  currency: nil,
1274
1363
  default_payment_method: nil,
@@ -1294,6 +1383,7 @@ module Stripe
1294
1383
  @application_fee_percent = application_fee_percent
1295
1384
  @automatic_tax = automatic_tax
1296
1385
  @billing_cycle_anchor = billing_cycle_anchor
1386
+ @billing_thresholds = billing_thresholds
1297
1387
  @collection_method = collection_method
1298
1388
  @currency = currency
1299
1389
  @default_payment_method = default_payment_method
@@ -1342,7 +1432,7 @@ module Stripe
1342
1432
  attr_accessor :phases
1343
1433
  # If specified, the invoicing for the given billing cycle iterations will be processed now.
1344
1434
  attr_accessor :prebilling
1345
- # If the update changes the current phase, indicates whether the changes should be prorated. The default value is `create_prorations`.
1435
+ # If the update changes the billing configuration (item price, quantity, etc.) of the current phase, indicates how prorations from this change should be handled. The default value is `create_prorations`.
1346
1436
  attr_accessor :proration_behavior
1347
1437
 
1348
1438
  def initialize(