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
@@ -155,6 +155,18 @@ module Stripe
155
155
  end
156
156
  end
157
157
 
158
+ class BillingThresholds < Stripe::RequestParams
159
+ # Monetary threshold that triggers the subscription to advance to a new billing period
160
+ attr_accessor :amount_gte
161
+ # 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.
162
+ attr_accessor :reset_billing_cycle_anchor
163
+
164
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
165
+ @amount_gte = amount_gte
166
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
167
+ end
168
+ end
169
+
158
170
  class CancellationDetails < Stripe::RequestParams
159
171
  # Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user.
160
172
  attr_accessor :comment
@@ -234,6 +246,15 @@ module Stripe
234
246
  end
235
247
 
236
248
  class Item < Stripe::RequestParams
249
+ class BillingThresholds < Stripe::RequestParams
250
+ # 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))
251
+ attr_accessor :usage_gte
252
+
253
+ def initialize(usage_gte: nil)
254
+ @usage_gte = usage_gte
255
+ end
256
+ end
257
+
237
258
  class Discount < Stripe::RequestParams
238
259
  class DiscountEnd < Stripe::RequestParams
239
260
  class Duration < Stripe::RequestParams
@@ -318,6 +339,8 @@ module Stripe
318
339
  @unit_amount_decimal = unit_amount_decimal
319
340
  end
320
341
  end
342
+ # 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.
343
+ attr_accessor :billing_thresholds
321
344
  # Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. `clear_usage` has no effect if the plan has a billing meter attached.
322
345
  attr_accessor :clear_usage
323
346
  # A flag that, if set to `true`, will delete the specified item.
@@ -340,6 +363,7 @@ module Stripe
340
363
  attr_accessor :tax_rates
341
364
 
342
365
  def initialize(
366
+ billing_thresholds: nil,
343
367
  clear_usage: nil,
344
368
  deleted: nil,
345
369
  discounts: nil,
@@ -351,6 +375,7 @@ module Stripe
351
375
  quantity: nil,
352
376
  tax_rates: nil
353
377
  )
378
+ @billing_thresholds = billing_thresholds
354
379
  @clear_usage = clear_usage
355
380
  @deleted = deleted
356
381
  @discounts = discounts
@@ -467,14 +492,9 @@ module Stripe
467
492
  end
468
493
  end
469
494
 
470
- class IdBankTransfer < Stripe::RequestParams
471
- end
472
-
473
- class Konbini < Stripe::RequestParams
474
- end
475
-
476
- class SepaDebit < Stripe::RequestParams
477
- end
495
+ class IdBankTransfer < Stripe::RequestParams; end
496
+ class Konbini < Stripe::RequestParams; end
497
+ class SepaDebit < Stripe::RequestParams; end
478
498
 
479
499
  class UsBankAccount < Stripe::RequestParams
480
500
  class FinancialConnections < Stripe::RequestParams
@@ -627,9 +647,11 @@ module Stripe
627
647
  attr_accessor :automatic_tax
628
648
  # Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
629
649
  attr_accessor :billing_cycle_anchor
650
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
651
+ attr_accessor :billing_thresholds
630
652
  # A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period.
631
653
  attr_accessor :cancel_at
632
- # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
654
+ # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This param will be removed in a future API version. Please use `cancel_at` instead.
633
655
  attr_accessor :cancel_at_period_end
634
656
  # Details about why this subscription was cancelled
635
657
  attr_accessor :cancellation_details
@@ -677,11 +699,11 @@ module Stripe
677
699
  attr_accessor :prebilling
678
700
  # Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`.
679
701
  attr_accessor :proration_behavior
680
- # If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#upcoming_invoice) endpoint. It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations.
702
+ # If set, prorations will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same prorations that were previewed with the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint. `proration_date` can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations.
681
703
  attr_accessor :proration_date
682
704
  # If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. This will be unset if you POST an empty value.
683
705
  attr_accessor :transfer_data
684
- # Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`.
706
+ # Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, `trial_end` will override the default trial period of the plan the customer is being subscribed to. The `billing_cycle_anchor` will be updated to the `trial_end` value. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`.
685
707
  attr_accessor :trial_end
686
708
  # Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more.
687
709
  attr_accessor :trial_from_plan
@@ -693,6 +715,7 @@ module Stripe
693
715
  application_fee_percent: nil,
694
716
  automatic_tax: nil,
695
717
  billing_cycle_anchor: nil,
718
+ billing_thresholds: nil,
696
719
  cancel_at: nil,
697
720
  cancel_at_period_end: nil,
698
721
  cancellation_details: nil,
@@ -725,6 +748,7 @@ module Stripe
725
748
  @application_fee_percent = application_fee_percent
726
749
  @automatic_tax = automatic_tax
727
750
  @billing_cycle_anchor = billing_cycle_anchor
751
+ @billing_thresholds = billing_thresholds
728
752
  @cancel_at = cancel_at
729
753
  @cancel_at_period_end = cancel_at_period_end
730
754
  @cancellation_details = cancellation_details
@@ -755,8 +779,7 @@ module Stripe
755
779
  end
756
780
  end
757
781
 
758
- class DeleteDiscountParams < Stripe::RequestParams
759
- end
782
+ class DeleteDiscountParams < Stripe::RequestParams; end
760
783
 
761
784
  class ListParams < Stripe::RequestParams
762
785
  class AutomaticTax < Stripe::RequestParams
@@ -1022,6 +1045,18 @@ module Stripe
1022
1045
  end
1023
1046
  end
1024
1047
 
1048
+ class BillingThresholds < Stripe::RequestParams
1049
+ # Monetary threshold that triggers the subscription to advance to a new billing period
1050
+ attr_accessor :amount_gte
1051
+ # 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.
1052
+ attr_accessor :reset_billing_cycle_anchor
1053
+
1054
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
1055
+ @amount_gte = amount_gte
1056
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
1057
+ end
1058
+ end
1059
+
1025
1060
  class Discount < Stripe::RequestParams
1026
1061
  class DiscountEnd < Stripe::RequestParams
1027
1062
  class Duration < Stripe::RequestParams
@@ -1089,6 +1124,15 @@ module Stripe
1089
1124
  end
1090
1125
 
1091
1126
  class Item < Stripe::RequestParams
1127
+ class BillingThresholds < Stripe::RequestParams
1128
+ # 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))
1129
+ attr_accessor :usage_gte
1130
+
1131
+ def initialize(usage_gte: nil)
1132
+ @usage_gte = usage_gte
1133
+ end
1134
+ end
1135
+
1092
1136
  class Discount < Stripe::RequestParams
1093
1137
  class DiscountEnd < Stripe::RequestParams
1094
1138
  class Duration < Stripe::RequestParams
@@ -1185,6 +1229,8 @@ module Stripe
1185
1229
  @type = type
1186
1230
  end
1187
1231
  end
1232
+ # 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.
1233
+ attr_accessor :billing_thresholds
1188
1234
  # The coupons to redeem into discounts for the subscription item.
1189
1235
  attr_accessor :discounts
1190
1236
  # 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`.
@@ -1203,6 +1249,7 @@ module Stripe
1203
1249
  attr_accessor :trial
1204
1250
 
1205
1251
  def initialize(
1252
+ billing_thresholds: nil,
1206
1253
  discounts: nil,
1207
1254
  metadata: nil,
1208
1255
  plan: nil,
@@ -1212,6 +1259,7 @@ module Stripe
1212
1259
  tax_rates: nil,
1213
1260
  trial: nil
1214
1261
  )
1262
+ @billing_thresholds = billing_thresholds
1215
1263
  @discounts = discounts
1216
1264
  @metadata = metadata
1217
1265
  @plan = plan
@@ -1314,14 +1362,9 @@ module Stripe
1314
1362
  end
1315
1363
  end
1316
1364
 
1317
- class IdBankTransfer < Stripe::RequestParams
1318
- end
1319
-
1320
- class Konbini < Stripe::RequestParams
1321
- end
1322
-
1323
- class SepaDebit < Stripe::RequestParams
1324
- end
1365
+ class IdBankTransfer < Stripe::RequestParams; end
1366
+ class Konbini < Stripe::RequestParams; end
1367
+ class SepaDebit < Stripe::RequestParams; end
1325
1368
 
1326
1369
  class UsBankAccount < Stripe::RequestParams
1327
1370
  class FinancialConnections < Stripe::RequestParams
@@ -1478,11 +1521,13 @@ module Stripe
1478
1521
  attr_accessor :billing_cycle_anchor
1479
1522
  # Mutually exclusive with billing_cycle_anchor and only valid with monthly and yearly price intervals. When provided, the billing_cycle_anchor is set to the next occurence of the day_of_month at the hour, minute, and second UTC.
1480
1523
  attr_accessor :billing_cycle_anchor_config
1481
- # Configure billing_mode in each subscription to opt in improved credit proration behavior.
1524
+ # Controls how prorations and invoices for subscriptions are calculated and orchestrated.
1482
1525
  attr_accessor :billing_mode
1526
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
1527
+ attr_accessor :billing_thresholds
1483
1528
  # A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period.
1484
1529
  attr_accessor :cancel_at
1485
- # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
1530
+ # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This param will be removed in a future API version. Please use `cancel_at` instead.
1486
1531
  attr_accessor :cancel_at_period_end
1487
1532
  # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the 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`.
1488
1533
  attr_accessor :collection_method
@@ -1555,6 +1600,7 @@ module Stripe
1555
1600
  billing_cycle_anchor: nil,
1556
1601
  billing_cycle_anchor_config: nil,
1557
1602
  billing_mode: nil,
1603
+ billing_thresholds: nil,
1558
1604
  cancel_at: nil,
1559
1605
  cancel_at_period_end: nil,
1560
1606
  collection_method: nil,
@@ -1591,6 +1637,7 @@ module Stripe
1591
1637
  @billing_cycle_anchor = billing_cycle_anchor
1592
1638
  @billing_cycle_anchor_config = billing_cycle_anchor_config
1593
1639
  @billing_mode = billing_mode
1640
+ @billing_thresholds = billing_thresholds
1594
1641
  @cancel_at = cancel_at
1595
1642
  @cancel_at_period_end = cancel_at_period_end
1596
1643
  @collection_method = collection_method
@@ -1640,14 +1687,26 @@ module Stripe
1640
1687
  end
1641
1688
  end
1642
1689
 
1690
+ class MigrateParams < Stripe::RequestParams
1691
+ # Controls how prorations and invoices for subscriptions are calculated and orchestrated.
1692
+ attr_accessor :billing_mode
1693
+ # Specifies which fields in the response should be expanded.
1694
+ attr_accessor :expand
1695
+
1696
+ def initialize(billing_mode: nil, expand: nil)
1697
+ @billing_mode = billing_mode
1698
+ @expand = expand
1699
+ end
1700
+ end
1701
+
1643
1702
  class ResumeParams < Stripe::RequestParams
1644
1703
  # The billing cycle anchor that applies when the subscription is resumed. Either `now` or `unchanged`. The default is `now`. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
1645
1704
  attr_accessor :billing_cycle_anchor
1646
1705
  # Specifies which fields in the response should be expanded.
1647
1706
  attr_accessor :expand
1648
- # Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`.
1707
+ # Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) resulting from the `billing_cycle_anchor` being `unchanged`. When the `billing_cycle_anchor` is set to `now` (default value), no prorations are generated. If no value is passed, the default is `create_prorations`.
1649
1708
  attr_accessor :proration_behavior
1650
- # If set, the proration will be calculated as though the subscription was resumed at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint.
1709
+ # If set, prorations will be calculated as though the subscription was resumed at the given time. This can be used to apply exactly the same prorations that were previewed with the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint.
1651
1710
  attr_accessor :proration_date
1652
1711
 
1653
1712
  def initialize(
@@ -1663,9 +1722,9 @@ module Stripe
1663
1722
  end
1664
1723
  end
1665
1724
 
1666
- # Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata).
1725
+ # Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://docs.stripe.com/metadata).
1667
1726
  #
1668
- # Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed if invoice_now and prorate are both set to true.
1727
+ # Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://docs.stripe.com/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed if invoice_now and prorate are both set to true.
1669
1728
  #
1670
1729
  # By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
1671
1730
  def cancel(subscription_exposed_id, params = {}, opts = {})
@@ -1683,7 +1742,7 @@ module Stripe
1683
1742
  # When you create a subscription with collection_method=charge_automatically, the first invoice is finalized as part of the request.
1684
1743
  # The payment_behavior parameter determines the exact behavior of the initial payment.
1685
1744
  #
1686
- # To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
1745
+ # To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://docs.stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
1687
1746
  # Schedules provide the flexibility to model more complex billing configurations that change over time.
1688
1747
  def create(params = {}, opts = {})
1689
1748
  request(
@@ -1717,6 +1776,17 @@ module Stripe
1717
1776
  )
1718
1777
  end
1719
1778
 
1779
+ # Upgrade the billing_mode of an existing subscription.
1780
+ def migrate(subscription, params = {}, opts = {})
1781
+ request(
1782
+ method: :post,
1783
+ path: format("/v1/subscriptions/%<subscription>s/migrate", { subscription: CGI.escape(subscription) }),
1784
+ params: params,
1785
+ opts: opts,
1786
+ base_address: :api
1787
+ )
1788
+ end
1789
+
1720
1790
  # Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date.
1721
1791
  def resume(subscription, params = {}, opts = {})
1722
1792
  request(
@@ -1739,7 +1809,7 @@ module Stripe
1739
1809
  )
1740
1810
  end
1741
1811
 
1742
- # Search for subscriptions you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
1812
+ # Search for subscriptions you've previously created using Stripe's [Search Query Language](https://docs.stripe.com/docs/search#search-query-language).
1743
1813
  # Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
1744
1814
  # conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
1745
1815
  # to an hour behind during outages. Search functionality is not available to merchants in India.
@@ -1755,7 +1825,7 @@ module Stripe
1755
1825
 
1756
1826
  # Updates an existing subscription to match the specified parameters.
1757
1827
  # When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes.
1758
- # To preview how the proration is calculated, use the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint.
1828
+ # To preview how the proration is calculated, use the [create preview](https://docs.stripe.com/docs/api/invoices/create_preview) endpoint.
1759
1829
  #
1760
1830
  # By default, we prorate subscription changes. For example, if a customer signs up on May 1 for a 100 price, they'll be billed 100 immediately. If on May 15 they switch to a 200 price, then on June 1 they'll be billed 250 (200 for a renewal of her subscription, plus a 50 prorating adjustment for half of the previous month's 100 difference). Similarly, a downgrade generates a credit that is applied to the next invoice. We also prorate when you make quantity changes.
1761
1831
  #
@@ -1767,13 +1837,13 @@ module Stripe
1767
1837
  # A trial starts or ends.
1768
1838
  #
1769
1839
  #
1770
- # In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment).
1840
+ # In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://docs.stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment).
1771
1841
  #
1772
- # If you want to charge for an upgrade immediately, pass proration_behavior as always_invoice to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you pass create_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription's renewal date, you need to manually [invoice the customer](https://stripe.com/docs/api/invoices/create).
1842
+ # If you want to charge for an upgrade immediately, pass proration_behavior as always_invoice to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you pass create_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription's renewal date, you need to manually [invoice the customer](https://docs.stripe.com/docs/api/invoices/create).
1773
1843
  #
1774
1844
  # If you don't want to prorate, set the proration_behavior option to none. With this option, the customer is billed 100 on May 1 and 200 on June 1. Similarly, if you set proration_behavior to none when switching between different billing intervals (for example, from monthly to yearly), we don't generate any credits for the old subscription's unused time. We still reset the billing date and bill immediately for the new subscription.
1775
1845
  #
1776
- # Updating the quantity on a subscription many times in an hour may result in [rate limiting. If you need to bill for a frequently changing quantity, consider integrating <a href="/docs/billing/subscriptions/usage-based">usage-based billing](https://stripe.com/docs/rate-limits) instead.
1846
+ # Updating the quantity on a subscription many times in an hour may result in [rate limiting. If you need to bill for a frequently changing quantity, consider integrating <a href="/docs/billing/subscriptions/usage-based">usage-based billing](https://docs.stripe.com/docs/rate-limits) instead.
1777
1847
  def update(subscription_exposed_id, params = {}, opts = {})
1778
1848
  request(
1779
1849
  method: :post,
@@ -94,6 +94,8 @@ module Stripe
94
94
  # A positive integer representing the line item's total price in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
95
95
  # If `tax_behavior=inclusive`, then this amount includes taxes. Otherwise, taxes are calculated on top of this amount.
96
96
  attr_accessor :amount
97
+ # 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.
98
+ attr_accessor :metadata
97
99
  # If provided, the product's `tax_code` will be used as the line item's `tax_code`.
98
100
  attr_accessor :product
99
101
  # The number of units of the item being purchased. Used to calculate the per-unit price from the total `amount` for the line. For example, if `amount=100` and `quantity=4`, the calculated unit price is 25.
@@ -107,6 +109,7 @@ module Stripe
107
109
 
108
110
  def initialize(
109
111
  amount: nil,
112
+ metadata: nil,
110
113
  product: nil,
111
114
  quantity: nil,
112
115
  reference: nil,
@@ -114,6 +117,7 @@ module Stripe
114
117
  tax_code: nil
115
118
  )
116
119
  @amount = amount
120
+ @metadata = metadata
117
121
  @product = product
118
122
  @quantity = quantity
119
123
  @reference = reference
@@ -1162,7 +1162,7 @@ module Stripe
1162
1162
 
1163
1163
  class Us < Stripe::RequestParams
1164
1164
  class LocalAmusementTax < Stripe::RequestParams
1165
- # A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. Supported FIPS codes are: `14000` (Chicago), `06613` (Bloomington), `21696` (East Dundee), `24582` (Evanston), `45421` (Lynwood), `64343` (River Grove), and `68081` (Schiller Park).
1165
+ # A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction. Supported FIPS codes are: `14000` (Chicago), `06613` (Bloomington), `21696` (East Dundee), `24582` (Evanston), `45421` (Lynwood), `48892` (Midlothian), `64343` (River Grove), and `68081` (Schiller Park).
1166
1166
  attr_accessor :jurisdiction
1167
1167
 
1168
1168
  def initialize(jurisdiction: nil)
@@ -3,8 +3,7 @@
3
3
 
4
4
  module Stripe
5
5
  class TaxIdService < StripeService
6
- class DeleteParams < Stripe::RequestParams
7
- end
6
+ class DeleteParams < Stripe::RequestParams; end
8
7
 
9
8
  class RetrieveParams < Stripe::RequestParams
10
9
  # Specifies which fields in the response should be expanded.
@@ -4,8 +4,7 @@
4
4
  module Stripe
5
5
  module Terminal
6
6
  class ConfigurationService < StripeService
7
- class DeleteParams < Stripe::RequestParams
8
- end
7
+ class DeleteParams < Stripe::RequestParams; end
9
8
 
10
9
  class RetrieveParams < Stripe::RequestParams
11
10
  # Specifies which fields in the response should be expanded.
@@ -4,8 +4,7 @@
4
4
  module Stripe
5
5
  module Terminal
6
6
  class LocationService < StripeService
7
- class DeleteParams < Stripe::RequestParams
8
- end
7
+ class DeleteParams < Stripe::RequestParams; end
9
8
 
10
9
  class RetrieveParams < Stripe::RequestParams
11
10
  # Specifies which fields in the response should be expanded.
@@ -149,7 +148,7 @@ module Stripe
149
148
  end
150
149
 
151
150
  # Creates a new Location object.
152
- # For further details, including which address fields are required in each country, see the [Manage locations](https://stripe.com/docs/terminal/fleet/locations) guide.
151
+ # For further details, including which address fields are required in each country, see the [Manage locations](https://docs.stripe.com/docs/terminal/fleet/locations) guide.
153
152
  def create(params = {}, opts = {})
154
153
  request(
155
154
  method: :post,
@@ -4,8 +4,7 @@
4
4
  module Stripe
5
5
  module Terminal
6
6
  class ReaderService < StripeService
7
- class DeleteParams < Stripe::RequestParams
8
- end
7
+ class DeleteParams < Stripe::RequestParams; end
9
8
 
10
9
  class RetrieveParams < Stripe::RequestParams
11
10
  # Specifies which fields in the response should be expanded.
@@ -242,12 +241,23 @@ module Stripe
242
241
  end
243
242
 
244
243
  class ConfirmPaymentIntentParams < Stripe::RequestParams
244
+ class ConfirmConfig < Stripe::RequestParams
245
+ # The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme.
246
+ attr_accessor :return_url
247
+
248
+ def initialize(return_url: nil)
249
+ @return_url = return_url
250
+ end
251
+ end
252
+ # Configuration overrides
253
+ attr_accessor :confirm_config
245
254
  # Specifies which fields in the response should be expanded.
246
255
  attr_accessor :expand
247
256
  # PaymentIntent ID
248
257
  attr_accessor :payment_intent
249
258
 
250
- def initialize(expand: nil, payment_intent: nil)
259
+ def initialize(confirm_config: nil, expand: nil, payment_intent: nil)
260
+ @confirm_config = confirm_config
251
261
  @expand = expand
252
262
  @payment_intent = payment_intent
253
263
  end
@@ -267,6 +277,8 @@ module Stripe
267
277
  attr_accessor :allow_redisplay
268
278
  # Enables cancel button on transaction screens.
269
279
  attr_accessor :enable_customer_cancellation
280
+ # The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme.
281
+ attr_accessor :return_url
270
282
  # Override showing a tipping selection screen on this transaction.
271
283
  attr_accessor :skip_tipping
272
284
  # Tipping configuration for this transaction.
@@ -275,11 +287,13 @@ module Stripe
275
287
  def initialize(
276
288
  allow_redisplay: nil,
277
289
  enable_customer_cancellation: nil,
290
+ return_url: nil,
278
291
  skip_tipping: nil,
279
292
  tipping: nil
280
293
  )
281
294
  @allow_redisplay = allow_redisplay
282
295
  @enable_customer_cancellation = enable_customer_cancellation
296
+ @return_url = return_url
283
297
  @skip_tipping = skip_tipping
284
298
  @tipping = tipping
285
299
  end