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
@@ -38,6 +38,13 @@ module Stripe
38
38
  attr_reader :liability
39
39
  end
40
40
 
41
+ class BillingThresholds < Stripe::StripeObject
42
+ # Monetary threshold that triggers the subscription to create an invoice
43
+ attr_reader :amount_gte
44
+ # 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. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`.
45
+ attr_reader :reset_billing_cycle_anchor
46
+ end
47
+
41
48
  class InvoiceSettings < Stripe::StripeObject
42
49
  class Issuer < Stripe::StripeObject
43
50
  # The connected account being referenced when `type` is `account`.
@@ -65,6 +72,8 @@ module Stripe
65
72
  attr_reader :automatic_tax
66
73
  # Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
67
74
  attr_reader :billing_cycle_anchor
75
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
76
+ attr_reader :billing_thresholds
68
77
  # 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`.
69
78
  attr_reader :collection_method
70
79
  # ID of the default payment method for the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
@@ -114,6 +123,13 @@ module Stripe
114
123
  attr_reader :liability
115
124
  end
116
125
 
126
+ class BillingThresholds < Stripe::StripeObject
127
+ # Monetary threshold that triggers the subscription to create an invoice
128
+ attr_reader :amount_gte
129
+ # 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. This value may not be `true` if the subscription contains items with plans that have `aggregate_usage=last_ever`.
130
+ attr_reader :reset_billing_cycle_anchor
131
+ end
132
+
117
133
  class Discount < Stripe::StripeObject
118
134
  # ID of the coupon to create a new discount for.
119
135
  attr_reader :coupon
@@ -139,6 +155,11 @@ module Stripe
139
155
  end
140
156
 
141
157
  class Item < Stripe::StripeObject
158
+ class BillingThresholds < Stripe::StripeObject
159
+ # Usage threshold that triggers the subscription to create an invoice
160
+ attr_reader :usage_gte
161
+ end
162
+
142
163
  class Discount < Stripe::StripeObject
143
164
  # ID of the coupon to create a new discount for.
144
165
  attr_reader :coupon
@@ -147,6 +168,8 @@ module Stripe
147
168
  # ID of the promotion code to create a new discount for.
148
169
  attr_reader :promotion_code
149
170
  end
171
+ # Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period
172
+ attr_reader :billing_thresholds
150
173
  # The discounts applied to the subscription item. Subscription item discounts are applied before subscription discounts. Use `expand[]=discounts` to expand each discount.
151
174
  attr_reader :discounts
152
175
  # Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an item. Metadata on this item will update the underlying subscription item's `metadata` when the phase is entered.
@@ -175,6 +198,8 @@ module Stripe
175
198
  attr_reader :automatic_tax
176
199
  # Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
177
200
  attr_reader :billing_cycle_anchor
201
+ # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
202
+ attr_reader :billing_thresholds
178
203
  # 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`.
179
204
  attr_reader :collection_method
180
205
  # 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).
@@ -197,7 +222,7 @@ module Stripe
197
222
  attr_reader :metadata
198
223
  # The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription. See the Connect documentation for details.
199
224
  attr_reader :on_behalf_of
200
- # If the subscription schedule will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`.
225
+ # When transitioning phases, controls how prorations are handled (if any). Possible values are `create_prorations`, `none`, and `always_invoice`.
201
226
  attr_reader :proration_behavior
202
227
  # The start of this phase of the subscription schedule.
203
228
  attr_reader :start_date
@@ -350,6 +375,18 @@ module Stripe
350
375
  end
351
376
  end
352
377
 
378
+ class BillingThresholds < Stripe::RequestParams
379
+ # Monetary threshold that triggers the subscription to advance to a new billing period
380
+ attr_accessor :amount_gte
381
+ # 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.
382
+ attr_accessor :reset_billing_cycle_anchor
383
+
384
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
385
+ @amount_gte = amount_gte
386
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
387
+ end
388
+ end
389
+
353
390
  class InvoiceSettings < Stripe::RequestParams
354
391
  class Issuer < Stripe::RequestParams
355
392
  # The connected account being referenced when `type` is `account`.
@@ -393,6 +430,8 @@ module Stripe
393
430
  attr_accessor :automatic_tax
394
431
  # 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).
395
432
  attr_accessor :billing_cycle_anchor
433
+ # 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.
434
+ attr_accessor :billing_thresholds
396
435
  # 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.
397
436
  attr_accessor :collection_method
398
437
  # 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.
@@ -410,6 +449,7 @@ module Stripe
410
449
  application_fee_percent: nil,
411
450
  automatic_tax: nil,
412
451
  billing_cycle_anchor: nil,
452
+ billing_thresholds: nil,
413
453
  collection_method: nil,
414
454
  default_payment_method: nil,
415
455
  description: nil,
@@ -420,6 +460,7 @@ module Stripe
420
460
  @application_fee_percent = application_fee_percent
421
461
  @automatic_tax = automatic_tax
422
462
  @billing_cycle_anchor = billing_cycle_anchor
463
+ @billing_thresholds = billing_thresholds
423
464
  @collection_method = collection_method
424
465
  @default_payment_method = default_payment_method
425
466
  @description = description
@@ -515,6 +556,18 @@ module Stripe
515
556
  end
516
557
  end
517
558
 
559
+ class BillingThresholds < Stripe::RequestParams
560
+ # Monetary threshold that triggers the subscription to advance to a new billing period
561
+ attr_accessor :amount_gte
562
+ # 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.
563
+ attr_accessor :reset_billing_cycle_anchor
564
+
565
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
566
+ @amount_gte = amount_gte
567
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
568
+ end
569
+ end
570
+
518
571
  class Discount < Stripe::RequestParams
519
572
  # ID of the coupon to create a new discount for.
520
573
  attr_accessor :coupon
@@ -557,6 +610,15 @@ module Stripe
557
610
  end
558
611
 
559
612
  class Item < Stripe::RequestParams
613
+ class BillingThresholds < Stripe::RequestParams
614
+ # 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))
615
+ attr_accessor :usage_gte
616
+
617
+ def initialize(usage_gte: nil)
618
+ @usage_gte = usage_gte
619
+ end
620
+ end
621
+
560
622
  class Discount < Stripe::RequestParams
561
623
  # ID of the coupon to create a new discount for.
562
624
  attr_accessor :coupon
@@ -613,6 +675,8 @@ module Stripe
613
675
  @unit_amount_decimal = unit_amount_decimal
614
676
  end
615
677
  end
678
+ # 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.
679
+ attr_accessor :billing_thresholds
616
680
  # The coupons to redeem into discounts for the subscription item.
617
681
  attr_accessor :discounts
618
682
  # 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`.
@@ -629,6 +693,7 @@ module Stripe
629
693
  attr_accessor :tax_rates
630
694
 
631
695
  def initialize(
696
+ billing_thresholds: nil,
632
697
  discounts: nil,
633
698
  metadata: nil,
634
699
  plan: nil,
@@ -637,6 +702,7 @@ module Stripe
637
702
  quantity: nil,
638
703
  tax_rates: nil
639
704
  )
705
+ @billing_thresholds = billing_thresholds
640
706
  @discounts = discounts
641
707
  @metadata = metadata
642
708
  @plan = plan
@@ -666,6 +732,8 @@ module Stripe
666
732
  attr_accessor :automatic_tax
667
733
  # 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).
668
734
  attr_accessor :billing_cycle_anchor
735
+ # 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.
736
+ attr_accessor :billing_thresholds
669
737
  # 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.
670
738
  attr_accessor :collection_method
671
739
  # 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).
@@ -690,7 +758,7 @@ module Stripe
690
758
  attr_accessor :metadata
691
759
  # The account on behalf of which to charge, for each of the associated subscription's invoices.
692
760
  attr_accessor :on_behalf_of
693
- # 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.
761
+ # 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.
694
762
  attr_accessor :proration_behavior
695
763
  # The data with which to automatically create a Transfer for each of the associated subscription's invoices.
696
764
  attr_accessor :transfer_data
@@ -704,6 +772,7 @@ module Stripe
704
772
  application_fee_percent: nil,
705
773
  automatic_tax: nil,
706
774
  billing_cycle_anchor: nil,
775
+ billing_thresholds: nil,
707
776
  collection_method: nil,
708
777
  currency: nil,
709
778
  default_payment_method: nil,
@@ -725,6 +794,7 @@ module Stripe
725
794
  @application_fee_percent = application_fee_percent
726
795
  @automatic_tax = automatic_tax
727
796
  @billing_cycle_anchor = billing_cycle_anchor
797
+ @billing_thresholds = billing_thresholds
728
798
  @collection_method = collection_method
729
799
  @currency = currency
730
800
  @default_payment_method = default_payment_method
@@ -806,6 +876,18 @@ module Stripe
806
876
  end
807
877
  end
808
878
 
879
+ class BillingThresholds < Stripe::RequestParams
880
+ # Monetary threshold that triggers the subscription to advance to a new billing period
881
+ attr_accessor :amount_gte
882
+ # 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.
883
+ attr_accessor :reset_billing_cycle_anchor
884
+
885
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
886
+ @amount_gte = amount_gte
887
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
888
+ end
889
+ end
890
+
809
891
  class InvoiceSettings < Stripe::RequestParams
810
892
  class Issuer < Stripe::RequestParams
811
893
  # The connected account being referenced when `type` is `account`.
@@ -849,6 +931,8 @@ module Stripe
849
931
  attr_accessor :automatic_tax
850
932
  # 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).
851
933
  attr_accessor :billing_cycle_anchor
934
+ # 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.
935
+ attr_accessor :billing_thresholds
852
936
  # 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.
853
937
  attr_accessor :collection_method
854
938
  # 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.
@@ -866,6 +950,7 @@ module Stripe
866
950
  application_fee_percent: nil,
867
951
  automatic_tax: nil,
868
952
  billing_cycle_anchor: nil,
953
+ billing_thresholds: nil,
869
954
  collection_method: nil,
870
955
  default_payment_method: nil,
871
956
  description: nil,
@@ -876,6 +961,7 @@ module Stripe
876
961
  @application_fee_percent = application_fee_percent
877
962
  @automatic_tax = automatic_tax
878
963
  @billing_cycle_anchor = billing_cycle_anchor
964
+ @billing_thresholds = billing_thresholds
879
965
  @collection_method = collection_method
880
966
  @default_payment_method = default_payment_method
881
967
  @description = description
@@ -971,6 +1057,18 @@ module Stripe
971
1057
  end
972
1058
  end
973
1059
 
1060
+ class BillingThresholds < Stripe::RequestParams
1061
+ # Monetary threshold that triggers the subscription to advance to a new billing period
1062
+ attr_accessor :amount_gte
1063
+ # 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.
1064
+ attr_accessor :reset_billing_cycle_anchor
1065
+
1066
+ def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil)
1067
+ @amount_gte = amount_gte
1068
+ @reset_billing_cycle_anchor = reset_billing_cycle_anchor
1069
+ end
1070
+ end
1071
+
974
1072
  class Discount < Stripe::RequestParams
975
1073
  # ID of the coupon to create a new discount for.
976
1074
  attr_accessor :coupon
@@ -1013,6 +1111,15 @@ module Stripe
1013
1111
  end
1014
1112
 
1015
1113
  class Item < Stripe::RequestParams
1114
+ class BillingThresholds < Stripe::RequestParams
1115
+ # 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))
1116
+ attr_accessor :usage_gte
1117
+
1118
+ def initialize(usage_gte: nil)
1119
+ @usage_gte = usage_gte
1120
+ end
1121
+ end
1122
+
1016
1123
  class Discount < Stripe::RequestParams
1017
1124
  # ID of the coupon to create a new discount for.
1018
1125
  attr_accessor :coupon
@@ -1069,6 +1176,8 @@ module Stripe
1069
1176
  @unit_amount_decimal = unit_amount_decimal
1070
1177
  end
1071
1178
  end
1179
+ # 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.
1180
+ attr_accessor :billing_thresholds
1072
1181
  # The coupons to redeem into discounts for the subscription item.
1073
1182
  attr_accessor :discounts
1074
1183
  # 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`.
@@ -1085,6 +1194,7 @@ module Stripe
1085
1194
  attr_accessor :tax_rates
1086
1195
 
1087
1196
  def initialize(
1197
+ billing_thresholds: nil,
1088
1198
  discounts: nil,
1089
1199
  metadata: nil,
1090
1200
  plan: nil,
@@ -1093,6 +1203,7 @@ module Stripe
1093
1203
  quantity: nil,
1094
1204
  tax_rates: nil
1095
1205
  )
1206
+ @billing_thresholds = billing_thresholds
1096
1207
  @discounts = discounts
1097
1208
  @metadata = metadata
1098
1209
  @plan = plan
@@ -1122,6 +1233,8 @@ module Stripe
1122
1233
  attr_accessor :automatic_tax
1123
1234
  # 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).
1124
1235
  attr_accessor :billing_cycle_anchor
1236
+ # 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.
1237
+ attr_accessor :billing_thresholds
1125
1238
  # 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.
1126
1239
  attr_accessor :collection_method
1127
1240
  # 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).
@@ -1146,7 +1259,7 @@ module Stripe
1146
1259
  attr_accessor :metadata
1147
1260
  # The account on behalf of which to charge, for each of the associated subscription's invoices.
1148
1261
  attr_accessor :on_behalf_of
1149
- # 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.
1262
+ # 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.
1150
1263
  attr_accessor :proration_behavior
1151
1264
  # The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase.
1152
1265
  attr_accessor :start_date
@@ -1162,6 +1275,7 @@ module Stripe
1162
1275
  application_fee_percent: nil,
1163
1276
  automatic_tax: nil,
1164
1277
  billing_cycle_anchor: nil,
1278
+ billing_thresholds: nil,
1165
1279
  collection_method: nil,
1166
1280
  currency: nil,
1167
1281
  default_payment_method: nil,
@@ -1184,6 +1298,7 @@ module Stripe
1184
1298
  @application_fee_percent = application_fee_percent
1185
1299
  @automatic_tax = automatic_tax
1186
1300
  @billing_cycle_anchor = billing_cycle_anchor
1301
+ @billing_thresholds = billing_thresholds
1187
1302
  @collection_method = collection_method
1188
1303
  @currency = currency
1189
1304
  @default_payment_method = default_payment_method
@@ -1213,7 +1328,7 @@ module Stripe
1213
1328
  attr_accessor :metadata
1214
1329
  # 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.
1215
1330
  attr_accessor :phases
1216
- # If the update changes the current phase, indicates whether the changes should be prorated. The default value is `create_prorations`.
1331
+ # 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`.
1217
1332
  attr_accessor :proration_behavior
1218
1333
 
1219
1334
  def initialize(
@@ -240,6 +240,8 @@ module Stripe
240
240
  # A positive integer representing the line item's total price in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
241
241
  # If `tax_behavior=inclusive`, then this amount includes taxes. Otherwise, taxes are calculated on top of this amount.
242
242
  attr_accessor :amount
243
+ # 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.
244
+ attr_accessor :metadata
243
245
  # If provided, the product's `tax_code` will be used as the line item's `tax_code`.
244
246
  attr_accessor :product
245
247
  # 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.
@@ -253,6 +255,7 @@ module Stripe
253
255
 
254
256
  def initialize(
255
257
  amount: nil,
258
+ metadata: nil,
256
259
  product: nil,
257
260
  quantity: nil,
258
261
  reference: nil,
@@ -260,6 +263,7 @@ module Stripe
260
263
  tax_code: nil
261
264
  )
262
265
  @amount = amount
266
+ @metadata = metadata
263
267
  @product = product
264
268
  @quantity = quantity
265
269
  @reference = reference
@@ -50,6 +50,8 @@ module Stripe
50
50
  attr_reader :id
51
51
  # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
52
52
  attr_reader :livemode
53
+ # 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.
54
+ attr_reader :metadata
53
55
  # String representing the object's type. Objects of the same type share the same value.
54
56
  attr_reader :object
55
57
  # The ID of an existing [Product](https://stripe.com/docs/api/products/object).
@@ -2060,7 +2060,7 @@ module Stripe
2060
2060
 
2061
2061
  class Us < Stripe::RequestParams
2062
2062
  class LocalAmusementTax < Stripe::RequestParams
2063
- # 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).
2063
+ # 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).
2064
2064
  attr_accessor :jurisdiction
2065
2065
 
2066
2066
  def initialize(jurisdiction: nil)
@@ -36,8 +36,7 @@ module Stripe
36
36
  attr_reader :verified_name
37
37
  end
38
38
 
39
- class DeleteParams < Stripe::RequestParams
40
- end
39
+ class DeleteParams < Stripe::RequestParams; end
41
40
 
42
41
  class ListParams < Stripe::RequestParams
43
42
  class Owner < Stripe::RequestParams
@@ -2,9 +2,9 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
- # Tax rates can be applied to [invoices](https://stripe.com/invoicing/taxes/tax-rates), [subscriptions](https://stripe.com/billing/taxes/tax-rates) and [Checkout Sessions](https://stripe.com/payments/checkout/use-manual-tax-rates) to collect tax.
5
+ # Tax rates can be applied to [invoices](https://docs.stripe.com/invoicing/taxes/tax-rates), [subscriptions](https://docs.stripe.com/billing/taxes/tax-rates) and [Checkout Sessions](https://docs.stripe.com/payments/checkout/use-manual-tax-rates) to collect tax.
6
6
  #
7
- # Related guide: [Tax rates](https://stripe.com/billing/taxes/tax-rates)
7
+ # Related guide: [Tax rates](https://docs.stripe.com/billing/taxes/tax-rates)
8
8
  class TaxRate < APIResource
9
9
  extend Stripe::APIOperations::Create
10
10
  extend Stripe::APIOperations::List
@@ -261,8 +261,7 @@ module Stripe
261
261
  attr_reader :type
262
262
  end
263
263
 
264
- class DeleteParams < Stripe::RequestParams
265
- end
264
+ class DeleteParams < Stripe::RequestParams; end
266
265
 
267
266
  class UpdateParams < Stripe::RequestParams
268
267
  class BbposWiseposE < Stripe::RequestParams
@@ -32,8 +32,7 @@ module Stripe
32
32
  attr_reader :state
33
33
  end
34
34
 
35
- class DeleteParams < Stripe::RequestParams
36
- end
35
+ class DeleteParams < Stripe::RequestParams; end
37
36
 
38
37
  class UpdateParams < Stripe::RequestParams
39
38
  class Address < Stripe::RequestParams
@@ -184,7 +183,7 @@ module Stripe
184
183
  attr_reader :deleted
185
184
 
186
185
  # Creates a new Location object.
187
- # For further details, including which address fields are required in each country, see the [Manage locations](https://stripe.com/docs/terminal/fleet/locations) guide.
186
+ # 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.
188
187
  def self.create(params = {}, opts = {})
189
188
  request_stripe_object(
190
189
  method: :post,