stripe 15.4.0.pre.beta.2 → 15.5.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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/API_VERSION +1 -1
  3. data/CHANGELOG.md +61 -5
  4. data/OPENAPI_VERSION +1 -1
  5. data/README.md +1 -1
  6. data/VERSION +1 -1
  7. data/lib/stripe/api_version.rb +1 -1
  8. data/lib/stripe/event_types.rb +2 -2
  9. data/lib/stripe/events/{v2_core_account_link_completed_event.rb → v2_core_account_link_returned_event.rb} +2 -2
  10. data/lib/stripe/events/{v2_off_session_payment_requires_capture_event.rb → v2_money_management_payout_method_updated_event.rb} +3 -3
  11. data/lib/stripe/events/v2_payments_off_session_payment_authorization_attempt_failed_event.rb +1 -1
  12. data/lib/stripe/events/v2_payments_off_session_payment_authorization_attempt_started_event.rb +2 -1
  13. data/lib/stripe/events/v2_payments_off_session_payment_canceled_event.rb +1 -1
  14. data/lib/stripe/events/v2_payments_off_session_payment_created_event.rb +1 -1
  15. data/lib/stripe/events/v2_payments_off_session_payment_failed_event.rb +1 -1
  16. data/lib/stripe/events/v2_payments_off_session_payment_succeeded_event.rb +1 -1
  17. data/lib/stripe/object_types.rb +3 -0
  18. data/lib/stripe/resources/account.rb +5 -5
  19. data/lib/stripe/resources/account_link.rb +3 -1
  20. data/lib/stripe/resources/account_session.rb +51 -0
  21. data/lib/stripe/resources/balance_settings.rb +13 -13
  22. data/lib/stripe/resources/billing/credit_grant.rb +1 -1
  23. data/lib/stripe/resources/billing/meter_usage.rb +23 -0
  24. data/lib/stripe/resources/billing/meter_usage_row.rb +28 -0
  25. data/lib/stripe/resources/billing_portal/configuration.rb +46 -2
  26. data/lib/stripe/resources/charge.rb +7 -5
  27. data/lib/stripe/resources/checkout/session.rb +106 -6
  28. data/lib/stripe/resources/confirmation_token.rb +3 -3
  29. data/lib/stripe/resources/customer.rb +1 -1
  30. data/lib/stripe/resources/dispute.rb +10 -1
  31. data/lib/stripe/resources/event.rb +14 -26
  32. data/lib/stripe/resources/fx_quote.rb +6 -4
  33. data/lib/stripe/resources/invoice.rb +101 -8
  34. data/lib/stripe/resources/invoice_item.rb +1 -1
  35. data/lib/stripe/resources/payment_attempt_record.rb +6 -4
  36. data/lib/stripe/resources/payment_intent.rb +815 -4
  37. data/lib/stripe/resources/payment_link.rb +83 -5
  38. data/lib/stripe/resources/payment_method.rb +4 -4
  39. data/lib/stripe/resources/payment_record.rb +6 -4
  40. data/lib/stripe/resources/quote.rb +1 -1
  41. data/lib/stripe/resources/quote_preview_invoice.rb +17 -0
  42. data/lib/stripe/resources/radar/value_list.rb +2 -2
  43. data/lib/stripe/resources/refund.rb +1 -1
  44. data/lib/stripe/resources/review.rb +2 -2
  45. data/lib/stripe/resources/setup_attempt.rb +1 -1
  46. data/lib/stripe/resources/subscription.rb +79 -2
  47. data/lib/stripe/resources/subscription_item.rb +2 -2
  48. data/lib/stripe/resources/subscription_schedule.rb +35 -3
  49. data/lib/stripe/resources/tax/registration.rb +408 -30
  50. data/lib/stripe/resources/terminal/configuration.rb +196 -0
  51. data/lib/stripe/resources/terminal/onboarding_link.rb +84 -0
  52. data/lib/stripe/resources/v2/core/account.rb +11 -0
  53. data/lib/stripe/resources/v2/core/account_link.rb +18 -2
  54. data/lib/stripe/resources/v2/money_management/payout_method.rb +2 -0
  55. data/lib/stripe/resources/v2/payments/off_session_payment.rb +40 -23
  56. data/lib/stripe/resources.rb +5 -2
  57. data/lib/stripe/services/account_link_service.rb +3 -1
  58. data/lib/stripe/services/account_service.rb +3 -3
  59. data/lib/stripe/services/account_session_service.rb +34 -0
  60. data/lib/stripe/services/balance_settings_service.rb +10 -10
  61. data/lib/stripe/services/billing/credit_grant_service.rb +1 -1
  62. data/lib/stripe/services/billing/meter_usage_service.rb +76 -0
  63. data/lib/stripe/services/billing_portal/configuration_service.rb +36 -2
  64. data/lib/stripe/services/billing_service.rb +2 -1
  65. data/lib/stripe/services/checkout/session_service.rb +93 -5
  66. data/lib/stripe/services/invoice_item_service.rb +1 -1
  67. data/lib/stripe/services/invoice_service.rb +84 -8
  68. data/lib/stripe/services/payment_intent_service.rb +809 -3
  69. data/lib/stripe/services/payment_link_service.rb +81 -5
  70. data/lib/stripe/services/payment_method_service.rb +1 -1
  71. data/lib/stripe/services/quote_service.rb +1 -1
  72. data/lib/stripe/services/radar/value_list_service.rb +1 -1
  73. data/lib/stripe/services/subscription_item_service.rb +2 -2
  74. data/lib/stripe/services/subscription_schedule_service.rb +35 -3
  75. data/lib/stripe/services/subscription_service.rb +62 -2
  76. data/lib/stripe/services/tax/registration_service.rb +360 -30
  77. data/lib/stripe/services/terminal/configuration_service.rb +152 -0
  78. data/lib/stripe/services/terminal/onboarding_link_service.rb +56 -0
  79. data/lib/stripe/services/terminal_service.rb +2 -1
  80. data/lib/stripe/services/v2/core/account_link_service.rb +41 -3
  81. data/lib/stripe/services/v2/core/account_service.rb +38 -2
  82. data/lib/stripe/services/v2/payments/off_session_payment_service.rb +34 -19
  83. data/lib/stripe/services/v2/test_helpers/financial_address_service.rb +4 -0
  84. data/lib/stripe/services.rb +2 -0
  85. data/lib/stripe/version.rb +1 -1
  86. data/rbi/stripe.rbi +4893 -390
  87. metadata +9 -4
@@ -23,6 +23,8 @@ require "stripe/resources/billing/meter"
23
23
  require "stripe/resources/billing/meter_event"
24
24
  require "stripe/resources/billing/meter_event_adjustment"
25
25
  require "stripe/resources/billing/meter_event_summary"
26
+ require "stripe/resources/billing/meter_usage"
27
+ require "stripe/resources/billing/meter_usage_row"
26
28
  require "stripe/resources/billing_portal/configuration"
27
29
  require "stripe/resources/billing_portal/session"
28
30
  require "stripe/resources/capability"
@@ -145,6 +147,7 @@ require "stripe/resources/tax_rate"
145
147
  require "stripe/resources/terminal/configuration"
146
148
  require "stripe/resources/terminal/connection_token"
147
149
  require "stripe/resources/terminal/location"
150
+ require "stripe/resources/terminal/onboarding_link"
148
151
  require "stripe/resources/terminal/reader"
149
152
  require "stripe/resources/terminal/reader_collected_data"
150
153
  require "stripe/resources/test_helpers/test_clock"
@@ -205,7 +208,7 @@ require "stripe/events/v2_core_account_including_configuration_storer_updated_ev
205
208
  require "stripe/events/v2_core_account_including_defaults_updated_event"
206
209
  require "stripe/events/v2_core_account_including_identity_updated_event"
207
210
  require "stripe/events/v2_core_account_including_requirements_updated_event"
208
- require "stripe/events/v2_core_account_link_completed_event"
211
+ require "stripe/events/v2_core_account_link_returned_event"
209
212
  require "stripe/events/v2_core_account_person_created_event"
210
213
  require "stripe/events/v2_core_account_person_deleted_event"
211
214
  require "stripe/events/v2_core_account_person_updated_event"
@@ -234,6 +237,7 @@ require "stripe/events/v2_money_management_outbound_transfer_failed_event"
234
237
  require "stripe/events/v2_money_management_outbound_transfer_posted_event"
235
238
  require "stripe/events/v2_money_management_outbound_transfer_returned_event"
236
239
  require "stripe/events/v2_money_management_outbound_transfer_updated_event"
240
+ require "stripe/events/v2_money_management_payout_method_updated_event"
237
241
  require "stripe/events/v2_money_management_received_credit_available_event"
238
242
  require "stripe/events/v2_money_management_received_credit_failed_event"
239
243
  require "stripe/events/v2_money_management_received_credit_returned_event"
@@ -245,7 +249,6 @@ require "stripe/events/v2_money_management_received_debit_succeeded_event"
245
249
  require "stripe/events/v2_money_management_received_debit_updated_event"
246
250
  require "stripe/events/v2_money_management_transaction_created_event"
247
251
  require "stripe/events/v2_money_management_transaction_updated_event"
248
- require "stripe/events/v2_off_session_payment_requires_capture_event"
249
252
  require "stripe/events/v2_payments_off_session_payment_authorization_attempt_failed_event"
250
253
  require "stripe/events/v2_payments_off_session_payment_authorization_attempt_started_event"
251
254
  require "stripe/events/v2_payments_off_session_payment_canceled_event"
@@ -27,7 +27,9 @@ module Stripe
27
27
  attr_accessor :refresh_url
28
28
  # The URL that the user will be redirected to upon leaving or completing the linked flow.
29
29
  attr_accessor :return_url
30
- # The type of account link the user is requesting. Possible values are `account_onboarding` or `account_update`.
30
+ # The type of account link the user is requesting.
31
+ #
32
+ # You can create Account Links of type `account_update` only for connected accounts where your platform is responsible for collecting requirements, including Custom accounts. You can't create them for accounts that have access to a Stripe-hosted Dashboard. If you use [Connect embedded components](/connect/get-started-connect-embedded-components), you can include components that allow your connected accounts to update their own information. For an account without Stripe-hosted Dashboard access where Stripe is liable for negative balances, you must use embedded components.
31
33
  attr_accessor :type
32
34
 
33
35
  def initialize(
@@ -124,7 +124,7 @@ module Stripe
124
124
  attr_accessor :estimated_worker_count
125
125
  # [The merchant category code for the account](/connect/setting-mcc). MCCs are used to classify businesses based on the goods or services they provide.
126
126
  attr_accessor :mcc
127
- # Whether the business is a minority-owned, women-owned, and/or LGBTQI+-owned business.
127
+ # Whether the business is a minority-owned, women-owned, and/or LGBTQI+ -owned business.
128
128
  attr_accessor :minority_owned_business_designation
129
129
  # An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India.
130
130
  attr_accessor :monthly_estimated_revenue
@@ -2446,7 +2446,7 @@ module Stripe
2446
2446
  attr_accessor :estimated_worker_count
2447
2447
  # [The merchant category code for the account](/connect/setting-mcc). MCCs are used to classify businesses based on the goods or services they provide.
2448
2448
  attr_accessor :mcc
2449
- # Whether the business is a minority-owned, women-owned, and/or LGBTQI+-owned business.
2449
+ # Whether the business is a minority-owned, women-owned, and/or LGBTQI+ -owned business.
2450
2450
  attr_accessor :minority_owned_business_designation
2451
2451
  # An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India.
2452
2452
  attr_accessor :monthly_estimated_revenue
@@ -4737,7 +4737,7 @@ module Stripe
4737
4737
  #
4738
4738
  # Test-mode accounts can be deleted at any time.
4739
4739
  #
4740
- # Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero.
4740
+ # Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all [balances](https://docs.stripe.com/api/balance/balance_object) are zero.
4741
4741
  #
4742
4742
  # If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
4743
4743
  def delete(account, params = {}, opts = {})
@@ -301,6 +301,36 @@ module Stripe
301
301
  end
302
302
  end
303
303
 
304
+ class InstantPayoutsPromotion < Stripe::RequestParams
305
+ class Features < Stripe::RequestParams
306
+ # Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
307
+ attr_accessor :disable_stripe_user_authentication
308
+ # Whether external account collection is enabled. This feature can only be `false` for accounts where you’re responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
309
+ attr_accessor :external_account_collection
310
+ # Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
311
+ attr_accessor :instant_payouts
312
+
313
+ def initialize(
314
+ disable_stripe_user_authentication: nil,
315
+ external_account_collection: nil,
316
+ instant_payouts: nil
317
+ )
318
+ @disable_stripe_user_authentication = disable_stripe_user_authentication
319
+ @external_account_collection = external_account_collection
320
+ @instant_payouts = instant_payouts
321
+ end
322
+ end
323
+ # Whether the embedded component is enabled.
324
+ attr_accessor :enabled
325
+ # The list of features enabled in the embedded component.
326
+ attr_accessor :features
327
+
328
+ def initialize(enabled: nil, features: nil)
329
+ @enabled = enabled
330
+ @features = features
331
+ end
332
+ end
333
+
304
334
  class IssuingCard < Stripe::RequestParams
305
335
  class Features < Stripe::RequestParams
306
336
  # Whether to allow card management features.
@@ -673,6 +703,8 @@ module Stripe
673
703
  attr_accessor :financial_account
674
704
  # Configuration for the [financial account transactions](/connect/supported-embedded-components/financial-account-transactions/) embedded component.
675
705
  attr_accessor :financial_account_transactions
706
+ # Configuration for the [instant payouts promotion](/connect/supported-embedded-components/instant-payouts-promotion/) embedded component.
707
+ attr_accessor :instant_payouts_promotion
676
708
  # Configuration for the [issuing card](/connect/supported-embedded-components/issuing-card/) embedded component.
677
709
  attr_accessor :issuing_card
678
710
  # Configuration for the [issuing cards list](/connect/supported-embedded-components/issuing-cards-list/) embedded component.
@@ -719,6 +751,7 @@ module Stripe
719
751
  export_tax_transactions: nil,
720
752
  financial_account: nil,
721
753
  financial_account_transactions: nil,
754
+ instant_payouts_promotion: nil,
722
755
  issuing_card: nil,
723
756
  issuing_cards_list: nil,
724
757
  notification_banner: nil,
@@ -749,6 +782,7 @@ module Stripe
749
782
  @export_tax_transactions = export_tax_transactions
750
783
  @financial_account = financial_account
751
784
  @financial_account_transactions = financial_account_transactions
785
+ @instant_payouts_promotion = instant_payouts_promotion
752
786
  @issuing_card = issuing_card
753
787
  @issuing_cards_list = issuing_cards_list
754
788
  @notification_banner = notification_banner
@@ -17,15 +17,15 @@ module Stripe
17
17
  class Schedule < Stripe::RequestParams
18
18
  # How frequently available funds are paid out. One of: `daily`, `manual`, `weekly`, or `monthly`. Default is `daily`.
19
19
  attr_accessor :interval
20
- # The day of the month when available funds are paid out, specified as a number between 1--31. Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. Required and applicable only if `interval` is `monthly`.
21
- attr_accessor :monthly_anchor
22
- # The day of the week when available funds are paid out (required and applicable only if `interval` is `weekly`.)
23
- attr_accessor :weekly_anchor
20
+ # The days of the month when available funds are paid out, specified as an array of numbers between 1--31. Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. Required and applicable only if `interval` is `monthly`.
21
+ attr_accessor :monthly_payout_days
22
+ # The days of the week when available funds are paid out, specified as an array, e.g., [`monday`, `tuesday`]. (required and applicable only if `interval` is `weekly`.)
23
+ attr_accessor :weekly_payout_days
24
24
 
25
- def initialize(interval: nil, monthly_anchor: nil, weekly_anchor: nil)
25
+ def initialize(interval: nil, monthly_payout_days: nil, weekly_payout_days: nil)
26
26
  @interval = interval
27
- @monthly_anchor = monthly_anchor
28
- @weekly_anchor = weekly_anchor
27
+ @monthly_payout_days = monthly_payout_days
28
+ @weekly_payout_days = weekly_payout_days
29
29
  end
30
30
  end
31
31
  # Details on when funds from charges are available, and when they are paid out to an external account. For details, see our [Setting Bank and Debit Card Payouts](/connect/bank-transfers#payout-information) documentation.
@@ -41,10 +41,10 @@ module Stripe
41
41
 
42
42
  class SettlementTiming < Stripe::RequestParams
43
43
  # The number of days charge funds are held before becoming available. May also be set to `minimum`, representing the lowest available value for the account country. Default is `minimum`. The `delay_days` parameter remains at the last configured value if `payouts.schedule.interval` is `manual`. [Learn more about controlling payout delay days](/connect/manage-payout-schedule).
44
- attr_accessor :delay_days
44
+ attr_accessor :delay_days_override
45
45
 
46
- def initialize(delay_days: nil)
47
- @delay_days = delay_days
46
+ def initialize(delay_days_override: nil)
47
+ @delay_days_override = delay_days_override
48
48
  end
49
49
  end
50
50
  # A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. For details, see [Understanding Connect Account Balances](/connect/account-balances).
@@ -50,7 +50,7 @@ module Stripe
50
50
  end
51
51
  # The monetary amount.
52
52
  attr_accessor :monetary
53
- # Specify the type of this amount. We currently only support `monetary` billing credits.
53
+ # The type of this amount. We currently only support `monetary` billing credits.
54
54
  attr_accessor :type
55
55
 
56
56
  def initialize(monetary: nil, type: nil)
@@ -0,0 +1,76 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Billing
6
+ class MeterUsageService < StripeService
7
+ class RetrieveParams < Stripe::RequestParams
8
+ class Meter < Stripe::RequestParams
9
+ # Key-value pairs used to filter usage events by meter dimension values. If specified, usage will be filtered for matching usage events.
10
+ attr_accessor :dimension_filters
11
+ # List of meter dimension keys to group by. If specified, usage events will be grouped by the given meter dimension key's values.
12
+ attr_accessor :dimension_group_by_keys
13
+ # Meter id to query usage for.
14
+ attr_accessor :meter_id
15
+ # Key-value pairs used to filter usage events by high cardinality tenant dimension values. If specified, usage will be filtered for matching usage events.
16
+ attr_accessor :tenant_filters
17
+
18
+ def initialize(
19
+ dimension_filters: nil,
20
+ dimension_group_by_keys: nil,
21
+ meter_id: nil,
22
+ tenant_filters: nil
23
+ )
24
+ @dimension_filters = dimension_filters
25
+ @dimension_group_by_keys = dimension_group_by_keys
26
+ @meter_id = meter_id
27
+ @tenant_filters = tenant_filters
28
+ end
29
+ end
30
+ # The customer id to fetch meter usage data for.
31
+ attr_accessor :customer
32
+ # The timestamp from when to stop aggregating meter events (exclusive). Must be aligned with minute boundaries.
33
+ attr_accessor :end_time
34
+ # Specifies which fields in the response should be expanded.
35
+ attr_accessor :expand
36
+ # An array of meter parameters to specify which meters to include in the usage data. If not specified, usage across all meters for the customer is included.
37
+ attr_accessor :meters
38
+ # The timestamp from when to start aggregating meter events (inclusive). Must be aligned with minute boundaries.
39
+ attr_accessor :start_time
40
+ # The timezone to use for the start and end times. Defaults to UTC if not specified.
41
+ attr_accessor :timezone
42
+ # Specifies what granularity to use when aggregating meter usage events. If not specified, a single event would be returned for the specified time range.
43
+ attr_accessor :value_grouping_window
44
+
45
+ def initialize(
46
+ customer: nil,
47
+ end_time: nil,
48
+ expand: nil,
49
+ meters: nil,
50
+ start_time: nil,
51
+ timezone: nil,
52
+ value_grouping_window: nil
53
+ )
54
+ @customer = customer
55
+ @end_time = end_time
56
+ @expand = expand
57
+ @meters = meters
58
+ @start_time = start_time
59
+ @timezone = timezone
60
+ @value_grouping_window = value_grouping_window
61
+ end
62
+ end
63
+
64
+ # Returns aggregated meter usage data for a customer within a specified time interval. The data can be grouped by various dimensions and can include multiple meters if specified.
65
+ def retrieve(params = {}, opts = {})
66
+ request(
67
+ method: :get,
68
+ path: "/v1/billing/analytics/meter_usage",
69
+ params: params,
70
+ opts: opts,
71
+ base_address: :api
72
+ )
73
+ end
74
+ end
75
+ end
76
+ end
@@ -118,12 +118,29 @@ module Stripe
118
118
 
119
119
  class SubscriptionUpdate < Stripe::RequestParams
120
120
  class Product < Stripe::RequestParams
121
+ class AdjustableQuantity < Stripe::RequestParams
122
+ # Set to true if the quantity can be adjusted to any non-negative integer.
123
+ attr_accessor :enabled
124
+ # The maximum quantity that can be set for the product.
125
+ attr_accessor :maximum
126
+ # The minimum quantity that can be set for the product.
127
+ attr_accessor :minimum
128
+
129
+ def initialize(enabled: nil, maximum: nil, minimum: nil)
130
+ @enabled = enabled
131
+ @maximum = maximum
132
+ @minimum = minimum
133
+ end
134
+ end
135
+ # Control whether the quantity of the product can be adjusted.
136
+ attr_accessor :adjustable_quantity
121
137
  # The list of price IDs for the product that a subscription can be updated to.
122
138
  attr_accessor :prices
123
139
  # The product id.
124
140
  attr_accessor :product
125
141
 
126
- def initialize(prices: nil, product: nil)
142
+ def initialize(adjustable_quantity: nil, prices: nil, product: nil)
143
+ @adjustable_quantity = adjustable_quantity
127
144
  @prices = prices
128
145
  @product = product
129
146
  end
@@ -326,12 +343,29 @@ module Stripe
326
343
 
327
344
  class SubscriptionUpdate < Stripe::RequestParams
328
345
  class Product < Stripe::RequestParams
346
+ class AdjustableQuantity < Stripe::RequestParams
347
+ # Set to true if the quantity can be adjusted to any non-negative integer.
348
+ attr_accessor :enabled
349
+ # The maximum quantity that can be set for the product.
350
+ attr_accessor :maximum
351
+ # The minimum quantity that can be set for the product.
352
+ attr_accessor :minimum
353
+
354
+ def initialize(enabled: nil, maximum: nil, minimum: nil)
355
+ @enabled = enabled
356
+ @maximum = maximum
357
+ @minimum = minimum
358
+ end
359
+ end
360
+ # Control whether the quantity of the product can be adjusted.
361
+ attr_accessor :adjustable_quantity
329
362
  # The list of price IDs for the product that a subscription can be updated to.
330
363
  attr_accessor :prices
331
364
  # The product id.
332
365
  attr_accessor :product
333
366
 
334
- def initialize(prices: nil, product: nil)
367
+ def initialize(adjustable_quantity: nil, prices: nil, product: nil)
368
+ @adjustable_quantity = adjustable_quantity
335
369
  @prices = prices
336
370
  @product = product
337
371
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Stripe
5
5
  class BillingService < StripeService
6
- attr_reader :alerts, :credit_balance_summary, :credit_balance_transactions, :credit_grants, :meters, :meter_events, :meter_event_adjustments
6
+ attr_reader :alerts, :credit_balance_summary, :credit_balance_transactions, :credit_grants, :meters, :meter_events, :meter_event_adjustments, :meter_usage
7
7
 
8
8
  def initialize(requestor)
9
9
  super
@@ -15,6 +15,7 @@ module Stripe
15
15
  @meters = Stripe::Billing::MeterService.new(@requestor)
16
16
  @meter_events = Stripe::Billing::MeterEventService.new(@requestor)
17
17
  @meter_event_adjustments = Stripe::Billing::MeterEventAdjustmentService.new(@requestor)
18
+ @meter_usage = Stripe::Billing::MeterUsageService.new(@requestor)
18
19
  end
19
20
  end
20
21
  end
@@ -395,9 +395,12 @@ module Stripe
395
395
  class RenderingOptions < Stripe::RequestParams
396
396
  # How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
397
397
  attr_accessor :amount_tax_display
398
+ # ID of the invoice rendering template to use for this invoice.
399
+ attr_accessor :template
398
400
 
399
- def initialize(amount_tax_display: nil)
401
+ def initialize(amount_tax_display: nil, template: nil)
400
402
  @amount_tax_display = amount_tax_display
403
+ @template = template
401
404
  end
402
405
  end
403
406
  # The account tax IDs associated with the invoice.
@@ -1486,9 +1489,18 @@ module Stripe
1486
1489
  class Pix < Stripe::RequestParams
1487
1490
  # The number of seconds (between 10 and 1209600) after which Pix payment will expire. Defaults to 86400 seconds.
1488
1491
  attr_accessor :expires_after_seconds
1492
+ # Indicates that you intend to make future payments with this PaymentIntent's payment method.
1493
+ #
1494
+ # If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
1495
+ #
1496
+ # If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
1497
+ #
1498
+ # When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
1499
+ attr_accessor :setup_future_usage
1489
1500
 
1490
- def initialize(expires_after_seconds: nil)
1501
+ def initialize(expires_after_seconds: nil, setup_future_usage: nil)
1491
1502
  @expires_after_seconds = expires_after_seconds
1503
+ @setup_future_usage = setup_future_usage
1492
1504
  end
1493
1505
  end
1494
1506
 
@@ -1817,6 +1829,10 @@ module Stripe
1817
1829
  end
1818
1830
  # Permissions for updating the Checkout Session.
1819
1831
  attr_accessor :update
1832
+ # Determines which entity is allowed to update the discounts (coupons or promotion codes) that apply to this session.
1833
+ #
1834
+ # Default is `client_only`. Stripe Checkout client will automatically handle discount updates. If set to `server_only`, only your server is allowed to update discounts.
1835
+ attr_accessor :update_discounts
1820
1836
  # Determines which entity is allowed to update the line items.
1821
1837
  #
1822
1838
  # Default is `client_only`. Stripe Checkout client will automatically update the line items. If set to `server_only`, only your server is allowed to update the line items.
@@ -1830,8 +1846,14 @@ module Stripe
1830
1846
  # When set to `server_only`, you must add the onShippingDetailsChange event handler when initializing the Stripe Checkout client and manually update the shipping details from your server using the Stripe API.
1831
1847
  attr_accessor :update_shipping_details
1832
1848
 
1833
- def initialize(update: nil, update_line_items: nil, update_shipping_details: nil)
1849
+ def initialize(
1850
+ update: nil,
1851
+ update_discounts: nil,
1852
+ update_line_items: nil,
1853
+ update_shipping_details: nil
1854
+ )
1834
1855
  @update = update
1856
+ @update_discounts = update_discounts
1835
1857
  @update_line_items = update_line_items
1836
1858
  @update_shipping_details = update_shipping_details
1837
1859
  end
@@ -2000,7 +2022,7 @@ module Stripe
2000
2022
 
2001
2023
  class SubscriptionData < Stripe::RequestParams
2002
2024
  class BillingMode < Stripe::RequestParams
2003
- # Attribute for param field type
2025
+ # Controls the calculation and orchestration of prorations and invoices for subscriptions.
2004
2026
  attr_accessor :type
2005
2027
 
2006
2028
  def initialize(type: nil)
@@ -2230,6 +2252,8 @@ module Stripe
2230
2252
  #
2231
2253
  # For `subscription` mode, there is a maximum of 20 line items and optional items with recurring Prices and 20 line items and optional items with one-time Prices.
2232
2254
  attr_accessor :optional_items
2255
+ # Where the user is coming from. This informs the optimizations that are applied to the session. For example, a session originating from a mobile app may behave more like a native app, depending on the platform. This parameter is currently not allowed if `ui_mode` is `custom`.
2256
+ attr_accessor :origin_context
2233
2257
  # A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode.
2234
2258
  attr_accessor :payment_intent_data
2235
2259
  # Specify whether Checkout should collect a payment method. When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.
@@ -2326,6 +2350,7 @@ module Stripe
2326
2350
  metadata: nil,
2327
2351
  mode: nil,
2328
2352
  optional_items: nil,
2353
+ origin_context: nil,
2329
2354
  payment_intent_data: nil,
2330
2355
  payment_method_collection: nil,
2331
2356
  payment_method_configuration: nil,
@@ -2372,6 +2397,7 @@ module Stripe
2372
2397
  @metadata = metadata
2373
2398
  @mode = mode
2374
2399
  @optional_items = optional_items
2400
+ @origin_context = origin_context
2375
2401
  @payment_intent_data = payment_intent_data
2376
2402
  @payment_method_collection = payment_method_collection
2377
2403
  @payment_method_configuration = payment_method_configuration
@@ -2455,6 +2481,48 @@ module Stripe
2455
2481
  end
2456
2482
  end
2457
2483
 
2484
+ class Discount < Stripe::RequestParams
2485
+ class CouponData < Stripe::RequestParams
2486
+ # A positive integer representing the amount to subtract from an invoice total (required if `percent_off` is not passed).
2487
+ attr_accessor :amount_off
2488
+ # Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `amount_off` parameter (required if `amount_off` is passed).
2489
+ attr_accessor :currency
2490
+ # Specifies how long the discount will be in effect if used on a subscription. Defaults to `once`.
2491
+ attr_accessor :duration
2492
+ # 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`.
2493
+ attr_accessor :metadata
2494
+ # Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set.
2495
+ attr_accessor :name
2496
+ # A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if `amount_off` is not passed).
2497
+ attr_accessor :percent_off
2498
+
2499
+ def initialize(
2500
+ amount_off: nil,
2501
+ currency: nil,
2502
+ duration: nil,
2503
+ metadata: nil,
2504
+ name: nil,
2505
+ percent_off: nil
2506
+ )
2507
+ @amount_off = amount_off
2508
+ @currency = currency
2509
+ @duration = duration
2510
+ @metadata = metadata
2511
+ @name = name
2512
+ @percent_off = percent_off
2513
+ end
2514
+ end
2515
+ # The ID of the [Coupon](https://stripe.com/docs/api/coupons) to apply to this Session. One of `coupon` or `coupon_data` is required when updating discounts.
2516
+ attr_accessor :coupon
2517
+ # Data used to generate a new [Coupon](https://stripe.com/docs/api/coupon) object inline. One of `coupon` or `coupon_data` is required when updating discounts.
2518
+ attr_accessor :coupon_data
2519
+
2520
+ def initialize(coupon: nil, coupon_data: nil)
2521
+ @coupon = coupon
2522
+ @coupon_data = coupon_data
2523
+ end
2524
+ end
2525
+
2458
2526
  class LineItem < Stripe::RequestParams
2459
2527
  class AdjustableQuantity < Stripe::RequestParams
2460
2528
  # Set to true if the quantity can be adjusted to any positive integer. Setting to false will remove any previously specified constraints on quantity.
@@ -2676,8 +2744,22 @@ module Stripe
2676
2744
  @shipping_rate_data = shipping_rate_data
2677
2745
  end
2678
2746
  end
2747
+
2748
+ class SubscriptionData < Stripe::RequestParams
2749
+ # Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. Has to be at least 48 hours in the future.
2750
+ attr_accessor :trial_end
2751
+ # Integer representing the number of trial period days before the customer is charged for the first time. Has to be at least 1.
2752
+ attr_accessor :trial_period_days
2753
+
2754
+ def initialize(trial_end: nil, trial_period_days: nil)
2755
+ @trial_end = trial_end
2756
+ @trial_period_days = trial_period_days
2757
+ end
2758
+ end
2679
2759
  # Information about the customer collected within the Checkout Session. Can only be set when updating `embedded` or `custom` sessions.
2680
2760
  attr_accessor :collected_information
2761
+ # List of coupons and promotion codes attached to the Checkout Session.
2762
+ attr_accessor :discounts
2681
2763
  # Specifies which fields in the response should be expanded.
2682
2764
  attr_accessor :expand
2683
2765
  # A list of items the customer is purchasing.
@@ -2698,19 +2780,25 @@ module Stripe
2698
2780
  attr_accessor :metadata
2699
2781
  # The shipping rate options to apply to this Session. Up to a maximum of 5.
2700
2782
  attr_accessor :shipping_options
2783
+ # A subset of parameters to be passed to subscription creation for Checkout Sessions in `subscription` mode.
2784
+ attr_accessor :subscription_data
2701
2785
 
2702
2786
  def initialize(
2703
2787
  collected_information: nil,
2788
+ discounts: nil,
2704
2789
  expand: nil,
2705
2790
  line_items: nil,
2706
2791
  metadata: nil,
2707
- shipping_options: nil
2792
+ shipping_options: nil,
2793
+ subscription_data: nil
2708
2794
  )
2709
2795
  @collected_information = collected_information
2796
+ @discounts = discounts
2710
2797
  @expand = expand
2711
2798
  @line_items = line_items
2712
2799
  @metadata = metadata
2713
2800
  @shipping_options = shipping_options
2801
+ @subscription_data = subscription_data
2714
2802
  end
2715
2803
  end
2716
2804
 
@@ -338,7 +338,7 @@ module Stripe
338
338
  attr_accessor :discounts
339
339
  # Specifies which fields in the response should be expanded.
340
340
  attr_accessor :expand
341
- # The ID of an existing invoice to add this invoice item to. When left blank, the invoice item will be added to the next upcoming scheduled invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices and there is a maximum of 250 items per invoice.
341
+ # The ID of an existing invoice to add this invoice item to. For subscription invoices, when left blank, the invoice item will be added to the next upcoming scheduled invoice. For standalone invoices, the invoice item won't be automatically added unless you pass `pending_invoice_item_behavior: 'include'` when creating the invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices and there is a maximum of 250 items per invoice.
342
342
  attr_accessor :invoice
343
343
  # The ids of the margins to apply to the invoice item. When set, the `default_margins` on the invoice do not apply to this invoice item.
344
344
  attr_accessor :margins