stripe 15.1.0 → 15.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -6
  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/resources/account.rb +47 -20
  9. data/lib/stripe/resources/account_session.rb +111 -7
  10. data/lib/stripe/resources/apple_pay_domain.rb +1 -2
  11. data/lib/stripe/resources/balance.rb +42 -0
  12. data/lib/stripe/resources/balance_transaction.rb +2 -0
  13. data/lib/stripe/resources/bank_account.rb +2 -2
  14. data/lib/stripe/resources/billing_portal/session.rb +1 -1
  15. data/lib/stripe/resources/capability.rb +1 -1
  16. data/lib/stripe/resources/charge.rb +13 -5
  17. data/lib/stripe/resources/checkout/session.rb +20 -4
  18. data/lib/stripe/resources/confirmation_token.rb +33 -87
  19. data/lib/stripe/resources/country_spec.rb +1 -1
  20. data/lib/stripe/resources/coupon.rb +1 -2
  21. data/lib/stripe/resources/credit_note.rb +12 -9
  22. data/lib/stripe/resources/customer.rb +2 -4
  23. data/lib/stripe/resources/customer_session.rb +3 -3
  24. data/lib/stripe/resources/dispute.rb +2 -2
  25. data/lib/stripe/resources/event.rb +1 -1
  26. data/lib/stripe/resources/file.rb +1 -1
  27. data/lib/stripe/resources/identity/verification_report.rb +6 -0
  28. data/lib/stripe/resources/identity/verification_session.rb +17 -11
  29. data/lib/stripe/resources/invoice.rb +114 -27
  30. data/lib/stripe/resources/invoice_item.rb +2 -3
  31. data/lib/stripe/resources/invoice_line_item.rb +1 -1
  32. data/lib/stripe/resources/invoice_payment.rb +9 -2
  33. data/lib/stripe/resources/issuing/authorization.rb +8 -8
  34. data/lib/stripe/resources/issuing/card.rb +1 -1
  35. data/lib/stripe/resources/issuing/dispute.rb +3 -3
  36. data/lib/stripe/resources/payment_intent.rb +196 -302
  37. data/lib/stripe/resources/payment_method.rb +46 -103
  38. data/lib/stripe/resources/payment_method_configuration.rb +297 -2
  39. data/lib/stripe/resources/payment_method_domain.rb +2 -2
  40. data/lib/stripe/resources/payout.rb +4 -4
  41. data/lib/stripe/resources/person.rb +2 -2
  42. data/lib/stripe/resources/plan.rb +2 -3
  43. data/lib/stripe/resources/price.rb +1 -1
  44. data/lib/stripe/resources/product.rb +1 -2
  45. data/lib/stripe/resources/radar/value_list.rb +1 -2
  46. data/lib/stripe/resources/radar/value_list_item.rb +1 -2
  47. data/lib/stripe/resources/refund.rb +6 -1
  48. data/lib/stripe/resources/reversal.rb +1 -1
  49. data/lib/stripe/resources/review.rb +1 -1
  50. data/lib/stripe/resources/setup_intent.rb +111 -281
  51. data/lib/stripe/resources/source.rb +1 -1
  52. data/lib/stripe/resources/subscription.rb +89 -29
  53. data/lib/stripe/resources/subscription_item.rb +33 -0
  54. data/lib/stripe/resources/subscription_schedule.rb +119 -4
  55. data/lib/stripe/resources/tax/calculation.rb +4 -0
  56. data/lib/stripe/resources/tax/calculation_line_item.rb +2 -0
  57. data/lib/stripe/resources/tax/registration.rb +1 -1
  58. data/lib/stripe/resources/tax_id.rb +1 -2
  59. data/lib/stripe/resources/tax_rate.rb +2 -2
  60. data/lib/stripe/resources/terminal/configuration.rb +1 -2
  61. data/lib/stripe/resources/terminal/location.rb +2 -3
  62. data/lib/stripe/resources/terminal/reader.rb +275 -3
  63. data/lib/stripe/resources/test_helpers/test_clock.rb +1 -2
  64. data/lib/stripe/resources/token.rb +2 -2
  65. data/lib/stripe/resources/transfer.rb +1 -1
  66. data/lib/stripe/resources/webhook_endpoint.rb +1 -2
  67. data/lib/stripe/services/account_external_account_service.rb +2 -3
  68. data/lib/stripe/services/account_login_link_service.rb +1 -1
  69. data/lib/stripe/services/account_person_service.rb +1 -2
  70. data/lib/stripe/services/account_service.rb +38 -13
  71. data/lib/stripe/services/account_session_service.rb +75 -7
  72. data/lib/stripe/services/apple_pay_domain_service.rb +1 -2
  73. data/lib/stripe/services/balance_service.rb +1 -1
  74. data/lib/stripe/services/charge_service.rb +4 -4
  75. data/lib/stripe/services/checkout/session_service.rb +11 -3
  76. data/lib/stripe/services/coupon_service.rb +1 -2
  77. data/lib/stripe/services/credit_note_service.rb +7 -8
  78. data/lib/stripe/services/customer_balance_transaction_service.rb +3 -3
  79. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +2 -2
  80. data/lib/stripe/services/customer_payment_source_service.rb +1 -1
  81. data/lib/stripe/services/customer_service.rb +3 -5
  82. data/lib/stripe/services/customer_tax_id_service.rb +1 -2
  83. data/lib/stripe/services/dispute_service.rb +1 -1
  84. data/lib/stripe/services/file_service.rb +1 -1
  85. data/lib/stripe/services/identity/verification_session_service.rb +5 -5
  86. data/lib/stripe/services/invoice_item_service.rb +1 -2
  87. data/lib/stripe/services/invoice_service.rb +92 -23
  88. data/lib/stripe/services/issuing/authorization_service.rb +4 -4
  89. data/lib/stripe/services/issuing/card_service.rb +1 -1
  90. data/lib/stripe/services/issuing/dispute_service.rb +2 -2
  91. data/lib/stripe/services/payment_intent_service.rb +176 -292
  92. data/lib/stripe/services/payment_method_configuration_service.rb +212 -2
  93. data/lib/stripe/services/payment_method_domain_service.rb +1 -1
  94. data/lib/stripe/services/payment_method_service.rb +43 -100
  95. data/lib/stripe/services/payout_service.rb +2 -2
  96. data/lib/stripe/services/plan_service.rb +2 -3
  97. data/lib/stripe/services/price_service.rb +2 -2
  98. data/lib/stripe/services/product_feature_service.rb +1 -2
  99. data/lib/stripe/services/product_service.rb +2 -3
  100. data/lib/stripe/services/promotion_code_service.rb +1 -1
  101. data/lib/stripe/services/radar/early_fraud_warning_service.rb +1 -1
  102. data/lib/stripe/services/radar/value_list_item_service.rb +1 -2
  103. data/lib/stripe/services/radar/value_list_service.rb +1 -2
  104. data/lib/stripe/services/setup_intent_service.rb +110 -280
  105. data/lib/stripe/services/source_service.rb +1 -1
  106. data/lib/stripe/services/subscription_item_service.rb +26 -0
  107. data/lib/stripe/services/subscription_schedule_service.rb +93 -3
  108. data/lib/stripe/services/subscription_service.rb +77 -26
  109. data/lib/stripe/services/tax/calculation_service.rb +4 -0
  110. data/lib/stripe/services/tax/registration_service.rb +1 -1
  111. data/lib/stripe/services/tax_id_service.rb +1 -2
  112. data/lib/stripe/services/terminal/configuration_service.rb +1 -2
  113. data/lib/stripe/services/terminal/location_service.rb +2 -3
  114. data/lib/stripe/services/terminal/reader_service.rb +106 -2
  115. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +33 -87
  116. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +43 -0
  117. data/lib/stripe/services/test_helpers/test_clock_service.rb +1 -2
  118. data/lib/stripe/services/token_service.rb +1 -1
  119. data/lib/stripe/services/transfer_service.rb +1 -1
  120. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +1 -2
  121. data/lib/stripe/services/v2/core/event_destination_service.rb +4 -10
  122. data/lib/stripe/services/v2/core/event_service.rb +1 -2
  123. data/lib/stripe/services/webhook_endpoint_service.rb +1 -2
  124. data/lib/stripe/version.rb +1 -1
  125. data/rbi/stripe/resources/account.rbi +46 -23
  126. data/rbi/stripe/resources/account_session.rbi +131 -12
  127. data/rbi/stripe/resources/apple_pay_domain.rbi +1 -3
  128. data/rbi/stripe/resources/balance.rbi +55 -0
  129. data/rbi/stripe/resources/balance_transaction.rbi +3 -0
  130. data/rbi/stripe/resources/bank_account.rbi +2 -2
  131. data/rbi/stripe/resources/billing/alert.rbi +2 -2
  132. data/rbi/stripe/resources/billing_portal/session.rbi +1 -1
  133. data/rbi/stripe/resources/capability.rbi +1 -1
  134. data/rbi/stripe/resources/charge.rbi +17 -5
  135. data/rbi/stripe/resources/checkout/session.rbi +22 -6
  136. data/rbi/stripe/resources/confirmation_token.rbi +33 -99
  137. data/rbi/stripe/resources/country_spec.rbi +1 -1
  138. data/rbi/stripe/resources/coupon.rbi +1 -3
  139. data/rbi/stripe/resources/credit_note.rbi +14 -9
  140. data/rbi/stripe/resources/customer.rbi +2 -6
  141. data/rbi/stripe/resources/customer_session.rbi +3 -3
  142. data/rbi/stripe/resources/dispute.rbi +2 -2
  143. data/rbi/stripe/resources/event.rbi +1 -1
  144. data/rbi/stripe/resources/file.rbi +1 -1
  145. data/rbi/stripe/resources/identity/verification_report.rbi +9 -0
  146. data/rbi/stripe/resources/identity/verification_session.rbi +20 -11
  147. data/rbi/stripe/resources/invoice.rbi +109 -33
  148. data/rbi/stripe/resources/invoice_item.rbi +2 -4
  149. data/rbi/stripe/resources/invoice_line_item.rbi +1 -1
  150. data/rbi/stripe/resources/invoice_payment.rbi +9 -2
  151. data/rbi/stripe/resources/issuing/authorization.rbi +8 -8
  152. data/rbi/stripe/resources/issuing/card.rbi +1 -1
  153. data/rbi/stripe/resources/issuing/dispute.rbi +3 -3
  154. data/rbi/stripe/resources/payment_intent.rbi +201 -349
  155. data/rbi/stripe/resources/payment_method.rbi +46 -116
  156. data/rbi/stripe/resources/payment_method_configuration.rbi +334 -4
  157. data/rbi/stripe/resources/payment_method_domain.rbi +2 -2
  158. data/rbi/stripe/resources/payout.rbi +4 -4
  159. data/rbi/stripe/resources/person.rbi +2 -2
  160. data/rbi/stripe/resources/plan.rbi +2 -4
  161. data/rbi/stripe/resources/price.rbi +1 -1
  162. data/rbi/stripe/resources/product.rbi +1 -3
  163. data/rbi/stripe/resources/radar/value_list.rbi +1 -3
  164. data/rbi/stripe/resources/radar/value_list_item.rbi +1 -3
  165. data/rbi/stripe/resources/refund.rbi +5 -1
  166. data/rbi/stripe/resources/reversal.rbi +1 -1
  167. data/rbi/stripe/resources/review.rbi +1 -1
  168. data/rbi/stripe/resources/setup_intent.rbi +111 -325
  169. data/rbi/stripe/resources/source.rbi +1 -1
  170. data/rbi/stripe/resources/subscription.rbi +99 -36
  171. data/rbi/stripe/resources/subscription_item.rbi +36 -2
  172. data/rbi/stripe/resources/subscription_schedule.rbi +138 -10
  173. data/rbi/stripe/resources/tax/calculation.rbi +5 -1
  174. data/rbi/stripe/resources/tax/calculation_line_item.rbi +3 -0
  175. data/rbi/stripe/resources/tax/registration.rbi +1 -1
  176. data/rbi/stripe/resources/tax_id.rbi +1 -3
  177. data/rbi/stripe/resources/tax_rate.rbi +2 -2
  178. data/rbi/stripe/resources/terminal/configuration.rbi +1 -3
  179. data/rbi/stripe/resources/terminal/location.rbi +2 -4
  180. data/rbi/stripe/resources/terminal/reader.rbi +265 -5
  181. data/rbi/stripe/resources/test_helpers/test_clock.rbi +1 -3
  182. data/rbi/stripe/resources/token.rbi +2 -2
  183. data/rbi/stripe/resources/transfer.rbi +1 -1
  184. data/rbi/stripe/resources/webhook_endpoint.rbi +1 -3
  185. data/rbi/stripe/services/account_external_account_service.rbi +2 -4
  186. data/rbi/stripe/services/account_login_link_service.rbi +1 -1
  187. data/rbi/stripe/services/account_person_service.rbi +1 -3
  188. data/rbi/stripe/services/account_service.rbi +40 -16
  189. data/rbi/stripe/services/account_session_service.rbi +86 -12
  190. data/rbi/stripe/services/apple_pay_domain_service.rbi +1 -3
  191. data/rbi/stripe/services/balance_service.rbi +1 -1
  192. data/rbi/stripe/services/billing/alert_service.rbi +2 -2
  193. data/rbi/stripe/services/charge_service.rbi +4 -4
  194. data/rbi/stripe/services/checkout/session_service.rbi +12 -5
  195. data/rbi/stripe/services/coupon_service.rbi +1 -3
  196. data/rbi/stripe/services/credit_note_service.rbi +7 -8
  197. data/rbi/stripe/services/customer_balance_transaction_service.rbi +3 -3
  198. data/rbi/stripe/services/customer_cash_balance_transaction_service.rbi +2 -2
  199. data/rbi/stripe/services/customer_payment_source_service.rbi +1 -1
  200. data/rbi/stripe/services/customer_service.rbi +3 -7
  201. data/rbi/stripe/services/customer_tax_id_service.rbi +1 -3
  202. data/rbi/stripe/services/dispute_service.rbi +1 -1
  203. data/rbi/stripe/services/file_service.rbi +1 -1
  204. data/rbi/stripe/services/identity/verification_session_service.rbi +5 -5
  205. data/rbi/stripe/services/invoice_item_service.rbi +1 -3
  206. data/rbi/stripe/services/invoice_service.rbi +90 -29
  207. data/rbi/stripe/services/issuing/authorization_service.rbi +4 -4
  208. data/rbi/stripe/services/issuing/card_service.rbi +1 -1
  209. data/rbi/stripe/services/issuing/dispute_service.rbi +2 -2
  210. data/rbi/stripe/services/payment_intent_service.rbi +179 -339
  211. data/rbi/stripe/services/payment_method_configuration_service.rbi +236 -4
  212. data/rbi/stripe/services/payment_method_domain_service.rbi +1 -1
  213. data/rbi/stripe/services/payment_method_service.rbi +43 -113
  214. data/rbi/stripe/services/payout_service.rbi +2 -2
  215. data/rbi/stripe/services/plan_service.rbi +2 -4
  216. data/rbi/stripe/services/price_service.rbi +2 -2
  217. data/rbi/stripe/services/product_feature_service.rbi +1 -3
  218. data/rbi/stripe/services/product_service.rbi +2 -4
  219. data/rbi/stripe/services/promotion_code_service.rbi +1 -1
  220. data/rbi/stripe/services/radar/early_fraud_warning_service.rbi +1 -1
  221. data/rbi/stripe/services/radar/value_list_item_service.rbi +1 -3
  222. data/rbi/stripe/services/radar/value_list_service.rbi +1 -3
  223. data/rbi/stripe/services/setup_intent_service.rbi +110 -324
  224. data/rbi/stripe/services/source_service.rbi +1 -1
  225. data/rbi/stripe/services/subscription_item_service.rbi +28 -2
  226. data/rbi/stripe/services/subscription_schedule_service.rbi +107 -9
  227. data/rbi/stripe/services/subscription_service.rbi +85 -33
  228. data/rbi/stripe/services/tax/calculation_service.rbi +5 -1
  229. data/rbi/stripe/services/tax/registration_service.rbi +1 -1
  230. data/rbi/stripe/services/tax_id_service.rbi +1 -3
  231. data/rbi/stripe/services/terminal/configuration_service.rbi +1 -3
  232. data/rbi/stripe/services/terminal/location_service.rbi +2 -4
  233. data/rbi/stripe/services/terminal/reader_service.rbi +115 -4
  234. data/rbi/stripe/services/test_helpers/confirmation_token_service.rbi +33 -99
  235. data/rbi/stripe/services/test_helpers/terminal/reader_service.rbi +31 -0
  236. data/rbi/stripe/services/test_helpers/test_clock_service.rbi +1 -3
  237. data/rbi/stripe/services/token_service.rbi +1 -1
  238. data/rbi/stripe/services/transfer_service.rbi +1 -1
  239. data/rbi/stripe/services/v2/billing/meter_event_session_service.rbi +1 -3
  240. data/rbi/stripe/services/v2/core/event_destination_service.rbi +4 -12
  241. data/rbi/stripe/services/v2/core/event_service.rbi +1 -3
  242. data/rbi/stripe/services/webhook_endpoint_service.rbi +1 -3
  243. metadata +3 -2
@@ -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
  # ID of the coupon to create a new discount for.
33
42
  attr_accessor :coupon
@@ -84,6 +93,8 @@ module Stripe
84
93
  @unit_amount_decimal = unit_amount_decimal
85
94
  end
86
95
  end
96
+ # 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.
97
+ attr_accessor :billing_thresholds
87
98
  # The coupons to redeem into discounts for the subscription item.
88
99
  attr_accessor :discounts
89
100
  # Specifies which fields in the response should be expanded.
@@ -116,6 +127,7 @@ module Stripe
116
127
  attr_accessor :tax_rates
117
128
 
118
129
  def initialize(
130
+ billing_thresholds: nil,
119
131
  discounts: nil,
120
132
  expand: nil,
121
133
  metadata: nil,
@@ -129,6 +141,7 @@ module Stripe
129
141
  quantity: nil,
130
142
  tax_rates: nil
131
143
  )
144
+ @billing_thresholds = billing_thresholds
132
145
  @discounts = discounts
133
146
  @expand = expand
134
147
  @metadata = metadata
@@ -172,6 +185,15 @@ module Stripe
172
185
  end
173
186
 
174
187
  class CreateParams < Stripe::RequestParams
188
+ class BillingThresholds < Stripe::RequestParams
189
+ # 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))
190
+ attr_accessor :usage_gte
191
+
192
+ def initialize(usage_gte: nil)
193
+ @usage_gte = usage_gte
194
+ end
195
+ end
196
+
175
197
  class Discount < Stripe::RequestParams
176
198
  # ID of the coupon to create a new discount for.
177
199
  attr_accessor :coupon
@@ -228,6 +250,8 @@ module Stripe
228
250
  @unit_amount_decimal = unit_amount_decimal
229
251
  end
230
252
  end
253
+ # 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.
254
+ attr_accessor :billing_thresholds
231
255
  # The coupons to redeem into discounts for the subscription item.
232
256
  attr_accessor :discounts
233
257
  # Specifies which fields in the response should be expanded.
@@ -260,6 +284,7 @@ module Stripe
260
284
  attr_accessor :tax_rates
261
285
 
262
286
  def initialize(
287
+ billing_thresholds: nil,
263
288
  discounts: nil,
264
289
  expand: nil,
265
290
  metadata: nil,
@@ -273,6 +298,7 @@ module Stripe
273
298
  subscription: nil,
274
299
  tax_rates: nil
275
300
  )
301
+ @billing_thresholds = billing_thresholds
276
302
  @discounts = discounts
277
303
  @expand = expand
278
304
  @metadata = metadata
@@ -146,6 +146,18 @@ module Stripe
146
146
  end
147
147
  end
148
148
 
149
+ class BillingThresholds < Stripe::RequestParams
150
+ # Monetary threshold that triggers the subscription to advance to a new billing period
151
+ attr_accessor :amount_gte
152
+ # 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.
153
+ attr_accessor :reset_billing_cycle_anchor
154
+
155
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
156
+ @amount_gte = amount_gte
157
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
158
+ end
159
+ end
160
+
149
161
  class InvoiceSettings < Stripe::RequestParams
150
162
  class Issuer < Stripe::RequestParams
151
163
  # The connected account being referenced when `type` is `account`.
@@ -189,6 +201,8 @@ module Stripe
189
201
  attr_accessor :automatic_tax
190
202
  # 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).
191
203
  attr_accessor :billing_cycle_anchor
204
+ # 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.
205
+ attr_accessor :billing_thresholds
192
206
  # 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.
193
207
  attr_accessor :collection_method
194
208
  # 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.
@@ -206,6 +220,7 @@ module Stripe
206
220
  application_fee_percent: nil,
207
221
  automatic_tax: nil,
208
222
  billing_cycle_anchor: nil,
223
+ billing_thresholds: nil,
209
224
  collection_method: nil,
210
225
  default_payment_method: nil,
211
226
  description: nil,
@@ -216,6 +231,7 @@ module Stripe
216
231
  @application_fee_percent = application_fee_percent
217
232
  @automatic_tax = automatic_tax
218
233
  @billing_cycle_anchor = billing_cycle_anchor
234
+ @billing_thresholds = billing_thresholds
219
235
  @collection_method = collection_method
220
236
  @default_payment_method = default_payment_method
221
237
  @description = description
@@ -311,6 +327,18 @@ module Stripe
311
327
  end
312
328
  end
313
329
 
330
+ class BillingThresholds < Stripe::RequestParams
331
+ # Monetary threshold that triggers the subscription to advance to a new billing period
332
+ attr_accessor :amount_gte
333
+ # 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.
334
+ attr_accessor :reset_billing_cycle_anchor
335
+
336
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
337
+ @amount_gte = amount_gte
338
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
339
+ end
340
+ end
341
+
314
342
  class Discount < Stripe::RequestParams
315
343
  # ID of the coupon to create a new discount for.
316
344
  attr_accessor :coupon
@@ -353,6 +381,15 @@ module Stripe
353
381
  end
354
382
 
355
383
  class Item < Stripe::RequestParams
384
+ class BillingThresholds < Stripe::RequestParams
385
+ # 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))
386
+ attr_accessor :usage_gte
387
+
388
+ def initialize(usage_gte: nil)
389
+ @usage_gte = usage_gte
390
+ end
391
+ end
392
+
356
393
  class Discount < Stripe::RequestParams
357
394
  # ID of the coupon to create a new discount for.
358
395
  attr_accessor :coupon
@@ -409,6 +446,8 @@ module Stripe
409
446
  @unit_amount_decimal = unit_amount_decimal
410
447
  end
411
448
  end
449
+ # 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.
450
+ attr_accessor :billing_thresholds
412
451
  # The coupons to redeem into discounts for the subscription item.
413
452
  attr_accessor :discounts
414
453
  # 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`.
@@ -425,6 +464,7 @@ module Stripe
425
464
  attr_accessor :tax_rates
426
465
 
427
466
  def initialize(
467
+ billing_thresholds: nil,
428
468
  discounts: nil,
429
469
  metadata: nil,
430
470
  plan: nil,
@@ -433,6 +473,7 @@ module Stripe
433
473
  quantity: nil,
434
474
  tax_rates: nil
435
475
  )
476
+ @billing_thresholds = billing_thresholds
436
477
  @discounts = discounts
437
478
  @metadata = metadata
438
479
  @plan = plan
@@ -462,6 +503,8 @@ module Stripe
462
503
  attr_accessor :automatic_tax
463
504
  # 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).
464
505
  attr_accessor :billing_cycle_anchor
506
+ # 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.
507
+ attr_accessor :billing_thresholds
465
508
  # 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.
466
509
  attr_accessor :collection_method
467
510
  # 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).
@@ -486,7 +529,7 @@ module Stripe
486
529
  attr_accessor :metadata
487
530
  # The account on behalf of which to charge, for each of the associated subscription's invoices.
488
531
  attr_accessor :on_behalf_of
489
- # 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.
532
+ # 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.
490
533
  attr_accessor :proration_behavior
491
534
  # The data with which to automatically create a Transfer for each of the associated subscription's invoices.
492
535
  attr_accessor :transfer_data
@@ -500,6 +543,7 @@ module Stripe
500
543
  application_fee_percent: nil,
501
544
  automatic_tax: nil,
502
545
  billing_cycle_anchor: nil,
546
+ billing_thresholds: nil,
503
547
  collection_method: nil,
504
548
  currency: nil,
505
549
  default_payment_method: nil,
@@ -521,6 +565,7 @@ module Stripe
521
565
  @application_fee_percent = application_fee_percent
522
566
  @automatic_tax = automatic_tax
523
567
  @billing_cycle_anchor = billing_cycle_anchor
568
+ @billing_thresholds = billing_thresholds
524
569
  @collection_method = collection_method
525
570
  @currency = currency
526
571
  @default_payment_method = default_payment_method
@@ -611,6 +656,18 @@ module Stripe
611
656
  end
612
657
  end
613
658
 
659
+ class BillingThresholds < Stripe::RequestParams
660
+ # Monetary threshold that triggers the subscription to advance to a new billing period
661
+ attr_accessor :amount_gte
662
+ # 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.
663
+ attr_accessor :reset_billing_cycle_anchor
664
+
665
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
666
+ @amount_gte = amount_gte
667
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
668
+ end
669
+ end
670
+
614
671
  class InvoiceSettings < Stripe::RequestParams
615
672
  class Issuer < Stripe::RequestParams
616
673
  # The connected account being referenced when `type` is `account`.
@@ -654,6 +711,8 @@ module Stripe
654
711
  attr_accessor :automatic_tax
655
712
  # 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).
656
713
  attr_accessor :billing_cycle_anchor
714
+ # 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.
715
+ attr_accessor :billing_thresholds
657
716
  # 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.
658
717
  attr_accessor :collection_method
659
718
  # 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.
@@ -671,6 +730,7 @@ module Stripe
671
730
  application_fee_percent: nil,
672
731
  automatic_tax: nil,
673
732
  billing_cycle_anchor: nil,
733
+ billing_thresholds: nil,
674
734
  collection_method: nil,
675
735
  default_payment_method: nil,
676
736
  description: nil,
@@ -681,6 +741,7 @@ module Stripe
681
741
  @application_fee_percent = application_fee_percent
682
742
  @automatic_tax = automatic_tax
683
743
  @billing_cycle_anchor = billing_cycle_anchor
744
+ @billing_thresholds = billing_thresholds
684
745
  @collection_method = collection_method
685
746
  @default_payment_method = default_payment_method
686
747
  @description = description
@@ -776,6 +837,18 @@ module Stripe
776
837
  end
777
838
  end
778
839
 
840
+ class BillingThresholds < Stripe::RequestParams
841
+ # Monetary threshold that triggers the subscription to advance to a new billing period
842
+ attr_accessor :amount_gte
843
+ # 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.
844
+ attr_accessor :reset_billing_cycle_anchor
845
+
846
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
847
+ @amount_gte = amount_gte
848
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
849
+ end
850
+ end
851
+
779
852
  class Discount < Stripe::RequestParams
780
853
  # ID of the coupon to create a new discount for.
781
854
  attr_accessor :coupon
@@ -818,6 +891,15 @@ module Stripe
818
891
  end
819
892
 
820
893
  class Item < Stripe::RequestParams
894
+ class BillingThresholds < Stripe::RequestParams
895
+ # 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))
896
+ attr_accessor :usage_gte
897
+
898
+ def initialize(usage_gte: nil)
899
+ @usage_gte = usage_gte
900
+ end
901
+ end
902
+
821
903
  class Discount < Stripe::RequestParams
822
904
  # ID of the coupon to create a new discount for.
823
905
  attr_accessor :coupon
@@ -874,6 +956,8 @@ module Stripe
874
956
  @unit_amount_decimal = unit_amount_decimal
875
957
  end
876
958
  end
959
+ # 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.
960
+ attr_accessor :billing_thresholds
877
961
  # The coupons to redeem into discounts for the subscription item.
878
962
  attr_accessor :discounts
879
963
  # 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`.
@@ -890,6 +974,7 @@ module Stripe
890
974
  attr_accessor :tax_rates
891
975
 
892
976
  def initialize(
977
+ billing_thresholds: nil,
893
978
  discounts: nil,
894
979
  metadata: nil,
895
980
  plan: nil,
@@ -898,6 +983,7 @@ module Stripe
898
983
  quantity: nil,
899
984
  tax_rates: nil
900
985
  )
986
+ @billing_thresholds = billing_thresholds
901
987
  @discounts = discounts
902
988
  @metadata = metadata
903
989
  @plan = plan
@@ -927,6 +1013,8 @@ module Stripe
927
1013
  attr_accessor :automatic_tax
928
1014
  # 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).
929
1015
  attr_accessor :billing_cycle_anchor
1016
+ # 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.
1017
+ attr_accessor :billing_thresholds
930
1018
  # 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.
931
1019
  attr_accessor :collection_method
932
1020
  # 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).
@@ -951,7 +1039,7 @@ module Stripe
951
1039
  attr_accessor :metadata
952
1040
  # The account on behalf of which to charge, for each of the associated subscription's invoices.
953
1041
  attr_accessor :on_behalf_of
954
- # 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.
1042
+ # 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.
955
1043
  attr_accessor :proration_behavior
956
1044
  # The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase.
957
1045
  attr_accessor :start_date
@@ -967,6 +1055,7 @@ module Stripe
967
1055
  application_fee_percent: nil,
968
1056
  automatic_tax: nil,
969
1057
  billing_cycle_anchor: nil,
1058
+ billing_thresholds: nil,
970
1059
  collection_method: nil,
971
1060
  currency: nil,
972
1061
  default_payment_method: nil,
@@ -989,6 +1078,7 @@ module Stripe
989
1078
  @application_fee_percent = application_fee_percent
990
1079
  @automatic_tax = automatic_tax
991
1080
  @billing_cycle_anchor = billing_cycle_anchor
1081
+ @billing_thresholds = billing_thresholds
992
1082
  @collection_method = collection_method
993
1083
  @currency = currency
994
1084
  @default_payment_method = default_payment_method
@@ -1018,7 +1108,7 @@ module Stripe
1018
1108
  attr_accessor :metadata
1019
1109
  # List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. Note that past phases can be omitted.
1020
1110
  attr_accessor :phases
1021
- # If the update changes the current phase, indicates whether the changes should be prorated. The default value is `create_prorations`.
1111
+ # 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`.
1022
1112
  attr_accessor :proration_behavior
1023
1113
 
1024
1114
  def initialize(