stripe 15.2.1 → 15.3.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 (106) hide show
  1. checksums.yaml +4 -4
  2. data/API_VERSION +1 -0
  3. data/CHANGELOG.md +66 -39
  4. data/OPENAPI_VERSION +1 -1
  5. data/README.md +14 -50
  6. data/VERSION +1 -1
  7. data/lib/stripe/api_version.rb +2 -1
  8. data/lib/stripe/events/v2_core_event_destination_ping_event.rb +1 -1
  9. data/lib/stripe/resources/account.rb +89 -5
  10. data/lib/stripe/resources/account_session.rb +79 -79
  11. data/lib/stripe/resources/billing_portal/session.rb +2 -2
  12. data/lib/stripe/resources/charge.rb +28 -15
  13. data/lib/stripe/resources/checkout/session.rb +57 -7
  14. data/lib/stripe/resources/confirmation_token.rb +19 -11
  15. data/lib/stripe/resources/credit_note.rb +9 -9
  16. data/lib/stripe/resources/customer_session.rb +2 -2
  17. data/lib/stripe/resources/event.rb +1 -1
  18. data/lib/stripe/resources/identity/verification_session.rb +34 -0
  19. data/lib/stripe/resources/invoice.rb +29 -4
  20. data/lib/stripe/resources/invoice_item.rb +1 -4
  21. data/lib/stripe/resources/mandate.rb +3 -0
  22. data/lib/stripe/resources/payment_intent.rb +331 -12
  23. data/lib/stripe/resources/payment_method.rb +17 -9
  24. data/lib/stripe/resources/quote.rb +26 -3
  25. data/lib/stripe/resources/setup_attempt.rb +1 -1
  26. data/lib/stripe/resources/setup_intent.rb +285 -3
  27. data/lib/stripe/resources/subscription.rb +68 -6
  28. data/lib/stripe/resources/subscription_schedule.rb +22 -0
  29. data/lib/stripe/resources/tax/registration.rb +20 -0
  30. data/lib/stripe/resources/terminal/configuration.rb +1 -0
  31. data/lib/stripe/resources/terminal/reader.rb +152 -4
  32. data/lib/stripe/resources/token.rb +1 -1
  33. data/lib/stripe/resources/treasury/financial_account.rb +5 -1
  34. data/lib/stripe/services/account_service.rb +83 -5
  35. data/lib/stripe/services/account_session_service.rb +48 -48
  36. data/lib/stripe/services/billing_portal/session_service.rb +1 -1
  37. data/lib/stripe/services/checkout/session_service.rb +57 -7
  38. data/lib/stripe/services/credit_note_preview_lines_service.rb +3 -3
  39. data/lib/stripe/services/credit_note_service.rb +6 -6
  40. data/lib/stripe/services/customer_session_service.rb +1 -1
  41. data/lib/stripe/services/identity/verification_session_service.rb +16 -0
  42. data/lib/stripe/services/invoice_service.rb +29 -4
  43. data/lib/stripe/services/payment_intent_service.rb +315 -9
  44. data/lib/stripe/services/payment_method_service.rb +5 -0
  45. data/lib/stripe/services/quote_service.rb +20 -3
  46. data/lib/stripe/services/setup_intent_service.rb +275 -2
  47. data/lib/stripe/services/subscription_schedule_service.rb +13 -0
  48. data/lib/stripe/services/subscription_service.rb +48 -4
  49. data/lib/stripe/services/tax/registration_service.rb +13 -0
  50. data/lib/stripe/services/terminal/reader_service.rb +90 -0
  51. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +6 -1
  52. data/lib/stripe/services/token_service.rb +1 -1
  53. data/lib/stripe/services/treasury/financial_account_service.rb +5 -1
  54. data/lib/stripe/services/v2/billing_service.rb +2 -2
  55. data/lib/stripe/services/v2/core/event_destination_service.rb +16 -16
  56. data/lib/stripe/version.rb +1 -1
  57. data/rbi/stripe/resources/account.rbi +78 -9
  58. data/rbi/stripe/resources/account_session.rbi +79 -79
  59. data/rbi/stripe/resources/billing_portal/session.rbi +2 -2
  60. data/rbi/stripe/resources/charge.rbi +32 -15
  61. data/rbi/stripe/resources/checkout/session.rbi +65 -9
  62. data/rbi/stripe/resources/confirmation_token.rbi +23 -12
  63. data/rbi/stripe/resources/credit_note.rbi +9 -9
  64. data/rbi/stripe/resources/customer_session.rbi +2 -2
  65. data/rbi/stripe/resources/event.rbi +1 -1
  66. data/rbi/stripe/resources/identity/verification_session.rbi +39 -1
  67. data/rbi/stripe/resources/invoice.rbi +36 -6
  68. data/rbi/stripe/resources/invoice_item.rbi +1 -4
  69. data/rbi/stripe/resources/mandate.rbi +4 -0
  70. data/rbi/stripe/resources/payment_intent.rbi +361 -21
  71. data/rbi/stripe/resources/payment_method.rbi +19 -10
  72. data/rbi/stripe/resources/quote.rbi +22 -3
  73. data/rbi/stripe/resources/setup_attempt.rbi +1 -1
  74. data/rbi/stripe/resources/setup_intent.rbi +332 -9
  75. data/rbi/stripe/resources/subscription.rbi +60 -7
  76. data/rbi/stripe/resources/subscription_schedule.rbi +23 -1
  77. data/rbi/stripe/resources/tax/registration.rbi +20 -1
  78. data/rbi/stripe/resources/terminal/configuration.rbi +1 -0
  79. data/rbi/stripe/resources/terminal/location.rbi +2 -2
  80. data/rbi/stripe/resources/terminal/reader.rbi +151 -4
  81. data/rbi/stripe/resources/token.rbi +1 -1
  82. data/rbi/stripe/resources/treasury/financial_account.rbi +6 -2
  83. data/rbi/stripe/services/account_service.rbi +77 -9
  84. data/rbi/stripe/services/account_session_service.rbi +48 -48
  85. data/rbi/stripe/services/billing_portal/session_service.rbi +1 -1
  86. data/rbi/stripe/services/checkout/session_service.rbi +65 -9
  87. data/rbi/stripe/services/credit_note_preview_lines_service.rbi +3 -3
  88. data/rbi/stripe/services/credit_note_service.rbi +6 -6
  89. data/rbi/stripe/services/customer_session_service.rbi +1 -1
  90. data/rbi/stripe/services/identity/verification_session_service.rbi +17 -1
  91. data/rbi/stripe/services/invoice_service.rbi +36 -6
  92. data/rbi/stripe/services/payment_intent_service.rbi +348 -18
  93. data/rbi/stripe/services/payment_method_service.rbi +6 -1
  94. data/rbi/stripe/services/quote_service.rbi +16 -3
  95. data/rbi/stripe/services/setup_intent_service.rbi +326 -8
  96. data/rbi/stripe/services/subscription_schedule_service.rbi +12 -1
  97. data/rbi/stripe/services/subscription_service.rbi +41 -5
  98. data/rbi/stripe/services/tax/registration_service.rbi +14 -1
  99. data/rbi/stripe/services/terminal/location_service.rbi +2 -2
  100. data/rbi/stripe/services/terminal/reader_service.rbi +85 -0
  101. data/rbi/stripe/services/test_helpers/confirmation_token_service.rbi +9 -2
  102. data/rbi/stripe/services/token_service.rbi +1 -1
  103. data/rbi/stripe/services/treasury/financial_account_service.rbi +6 -2
  104. data/rbi/stripe/services/v2/billing_service.rbi +1 -1
  105. data/rbi/stripe/services/v2/core/event_destination_service.rbi +13 -13
  106. metadata +3 -2
@@ -227,6 +227,7 @@ module Stripe
227
227
  end
228
228
 
229
229
  class Cashapp < Stripe::RequestParams; end
230
+ class Crypto < Stripe::RequestParams; end
230
231
  class CustomerBalance < Stripe::RequestParams; end
231
232
 
232
233
  class Eps < Stripe::RequestParams
@@ -445,6 +446,8 @@ module Stripe
445
446
  attr_accessor :boleto
446
447
  # If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method.
447
448
  attr_accessor :cashapp
449
+ # If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
450
+ attr_accessor :crypto
448
451
  # If this is a `customer_balance` PaymentMethod, this hash contains details about the CustomerBalance payment method.
449
452
  attr_accessor :customer_balance
450
453
  # If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
@@ -536,6 +539,7 @@ module Stripe
536
539
  blik: nil,
537
540
  boleto: nil,
538
541
  cashapp: nil,
542
+ crypto: nil,
539
543
  customer_balance: nil,
540
544
  eps: nil,
541
545
  fpx: nil,
@@ -589,6 +593,7 @@ module Stripe
589
593
  @blik = blik
590
594
  @boleto = boleto
591
595
  @cashapp = cashapp
596
+ @crypto = crypto
592
597
  @customer_balance = customer_balance
593
598
  @eps = eps
594
599
  @fpx = fpx
@@ -841,6 +846,88 @@ module Stripe
841
846
 
842
847
  class CardPresent < Stripe::RequestParams; end
843
848
 
849
+ class Klarna < Stripe::RequestParams
850
+ class OnDemand < Stripe::RequestParams
851
+ # Your average amount value. You can use a value across your customer base, or segment based on customer type, country, etc.
852
+ attr_accessor :average_amount
853
+ # The maximum value you may charge a customer per purchase. You can use a value across your customer base, or segment based on customer type, country, etc.
854
+ attr_accessor :maximum_amount
855
+ # The lowest or minimum value you may charge a customer per purchase. You can use a value across your customer base, or segment based on customer type, country, etc.
856
+ attr_accessor :minimum_amount
857
+ # Interval at which the customer is making purchases
858
+ attr_accessor :purchase_interval
859
+ # The number of `purchase_interval` between charges
860
+ attr_accessor :purchase_interval_count
861
+
862
+ def initialize(
863
+ average_amount: nil,
864
+ maximum_amount: nil,
865
+ minimum_amount: nil,
866
+ purchase_interval: nil,
867
+ purchase_interval_count: nil
868
+ )
869
+ @average_amount = average_amount
870
+ @maximum_amount = maximum_amount
871
+ @minimum_amount = minimum_amount
872
+ @purchase_interval = purchase_interval
873
+ @purchase_interval_count = purchase_interval_count
874
+ end
875
+ end
876
+
877
+ class Subscription < Stripe::RequestParams
878
+ class NextBilling < Stripe::RequestParams
879
+ # The amount of the next charge for the subscription.
880
+ attr_accessor :amount
881
+ # The date of the next charge for the subscription in YYYY-MM-DD format.
882
+ attr_accessor :date
883
+
884
+ def initialize(amount: nil, date: nil)
885
+ @amount = amount
886
+ @date = date
887
+ end
888
+ end
889
+ # Unit of time between subscription charges.
890
+ attr_accessor :interval
891
+ # The number of intervals (specified in the `interval` attribute) between subscription charges. For example, `interval=month` and `interval_count=3` charges every 3 months.
892
+ attr_accessor :interval_count
893
+ # Name for subscription.
894
+ attr_accessor :name
895
+ # Describes the upcoming charge for this subscription.
896
+ attr_accessor :next_billing
897
+ # A non-customer-facing reference to correlate subscription charges in the Klarna app. Use a value that persists across subscription charges.
898
+ attr_accessor :reference
899
+
900
+ def initialize(
901
+ interval: nil,
902
+ interval_count: nil,
903
+ name: nil,
904
+ next_billing: nil,
905
+ reference: nil
906
+ )
907
+ @interval = interval
908
+ @interval_count = interval_count
909
+ @name = name
910
+ @next_billing = next_billing
911
+ @reference = reference
912
+ end
913
+ end
914
+ # The currency of the SetupIntent. Three letter ISO currency code.
915
+ attr_accessor :currency
916
+ # On-demand details if setting up a payment method for on-demand payments.
917
+ attr_accessor :on_demand
918
+ # Preferred language of the Klarna authorization page that the customer is redirected to
919
+ attr_accessor :preferred_locale
920
+ # Subscription details if setting up or charging a subscription
921
+ attr_accessor :subscriptions
922
+
923
+ def initialize(currency: nil, on_demand: nil, preferred_locale: nil, subscriptions: nil)
924
+ @currency = currency
925
+ @on_demand = on_demand
926
+ @preferred_locale = preferred_locale
927
+ @subscriptions = subscriptions
928
+ end
929
+ end
930
+
844
931
  class Link < Stripe::RequestParams
845
932
  # [Deprecated] This is a legacy parameter that no longer has any function.
846
933
  attr_accessor :persistent_token
@@ -951,6 +1038,8 @@ module Stripe
951
1038
  attr_accessor :card
952
1039
  # If this is a `card_present` PaymentMethod, this sub-hash contains details about the card-present payment method options.
953
1040
  attr_accessor :card_present
1041
+ # If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method options.
1042
+ attr_accessor :klarna
954
1043
  # If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options.
955
1044
  attr_accessor :link
956
1045
  # If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options.
@@ -966,6 +1055,7 @@ module Stripe
966
1055
  bacs_debit: nil,
967
1056
  card: nil,
968
1057
  card_present: nil,
1058
+ klarna: nil,
969
1059
  link: nil,
970
1060
  paypal: nil,
971
1061
  sepa_debit: nil,
@@ -976,6 +1066,7 @@ module Stripe
976
1066
  @bacs_debit = bacs_debit
977
1067
  @card = card
978
1068
  @card_present = card_present
1069
+ @klarna = klarna
979
1070
  @link = link
980
1071
  @paypal = paypal
981
1072
  @sepa_debit = sepa_debit
@@ -1033,7 +1124,7 @@ module Stripe
1033
1124
  attr_accessor :payment_method_data
1034
1125
  # Payment method-specific configuration for this SetupIntent.
1035
1126
  attr_accessor :payment_method_options
1036
- # The list of payment method types (for example, card) that this SetupIntent can use. If you don't provide this, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods).
1127
+ # The list of payment method types (for example, card) that this SetupIntent can use. If you don't provide this, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). A list of valid payment method types can be found [here](https://docs.stripe.com/api/payment_methods/object#payment_method_object-type).
1037
1128
  attr_accessor :payment_method_types
1038
1129
  # The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. To redirect to a mobile application, you can alternatively supply an application URI scheme. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm).
1039
1130
  attr_accessor :return_url
@@ -1216,6 +1307,7 @@ module Stripe
1216
1307
  end
1217
1308
 
1218
1309
  class Cashapp < Stripe::RequestParams; end
1310
+ class Crypto < Stripe::RequestParams; end
1219
1311
  class CustomerBalance < Stripe::RequestParams; end
1220
1312
 
1221
1313
  class Eps < Stripe::RequestParams
@@ -1434,6 +1526,8 @@ module Stripe
1434
1526
  attr_accessor :boleto
1435
1527
  # If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method.
1436
1528
  attr_accessor :cashapp
1529
+ # If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
1530
+ attr_accessor :crypto
1437
1531
  # If this is a `customer_balance` PaymentMethod, this hash contains details about the CustomerBalance payment method.
1438
1532
  attr_accessor :customer_balance
1439
1533
  # If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
@@ -1525,6 +1619,7 @@ module Stripe
1525
1619
  blik: nil,
1526
1620
  boleto: nil,
1527
1621
  cashapp: nil,
1622
+ crypto: nil,
1528
1623
  customer_balance: nil,
1529
1624
  eps: nil,
1530
1625
  fpx: nil,
@@ -1578,6 +1673,7 @@ module Stripe
1578
1673
  @blik = blik
1579
1674
  @boleto = boleto
1580
1675
  @cashapp = cashapp
1676
+ @crypto = crypto
1581
1677
  @customer_balance = customer_balance
1582
1678
  @eps = eps
1583
1679
  @fpx = fpx
@@ -1830,6 +1926,88 @@ module Stripe
1830
1926
 
1831
1927
  class CardPresent < Stripe::RequestParams; end
1832
1928
 
1929
+ class Klarna < Stripe::RequestParams
1930
+ class OnDemand < Stripe::RequestParams
1931
+ # Your average amount value. You can use a value across your customer base, or segment based on customer type, country, etc.
1932
+ attr_accessor :average_amount
1933
+ # The maximum value you may charge a customer per purchase. You can use a value across your customer base, or segment based on customer type, country, etc.
1934
+ attr_accessor :maximum_amount
1935
+ # The lowest or minimum value you may charge a customer per purchase. You can use a value across your customer base, or segment based on customer type, country, etc.
1936
+ attr_accessor :minimum_amount
1937
+ # Interval at which the customer is making purchases
1938
+ attr_accessor :purchase_interval
1939
+ # The number of `purchase_interval` between charges
1940
+ attr_accessor :purchase_interval_count
1941
+
1942
+ def initialize(
1943
+ average_amount: nil,
1944
+ maximum_amount: nil,
1945
+ minimum_amount: nil,
1946
+ purchase_interval: nil,
1947
+ purchase_interval_count: nil
1948
+ )
1949
+ @average_amount = average_amount
1950
+ @maximum_amount = maximum_amount
1951
+ @minimum_amount = minimum_amount
1952
+ @purchase_interval = purchase_interval
1953
+ @purchase_interval_count = purchase_interval_count
1954
+ end
1955
+ end
1956
+
1957
+ class Subscription < Stripe::RequestParams
1958
+ class NextBilling < Stripe::RequestParams
1959
+ # The amount of the next charge for the subscription.
1960
+ attr_accessor :amount
1961
+ # The date of the next charge for the subscription in YYYY-MM-DD format.
1962
+ attr_accessor :date
1963
+
1964
+ def initialize(amount: nil, date: nil)
1965
+ @amount = amount
1966
+ @date = date
1967
+ end
1968
+ end
1969
+ # Unit of time between subscription charges.
1970
+ attr_accessor :interval
1971
+ # The number of intervals (specified in the `interval` attribute) between subscription charges. For example, `interval=month` and `interval_count=3` charges every 3 months.
1972
+ attr_accessor :interval_count
1973
+ # Name for subscription.
1974
+ attr_accessor :name
1975
+ # Describes the upcoming charge for this subscription.
1976
+ attr_accessor :next_billing
1977
+ # A non-customer-facing reference to correlate subscription charges in the Klarna app. Use a value that persists across subscription charges.
1978
+ attr_accessor :reference
1979
+
1980
+ def initialize(
1981
+ interval: nil,
1982
+ interval_count: nil,
1983
+ name: nil,
1984
+ next_billing: nil,
1985
+ reference: nil
1986
+ )
1987
+ @interval = interval
1988
+ @interval_count = interval_count
1989
+ @name = name
1990
+ @next_billing = next_billing
1991
+ @reference = reference
1992
+ end
1993
+ end
1994
+ # The currency of the SetupIntent. Three letter ISO currency code.
1995
+ attr_accessor :currency
1996
+ # On-demand details if setting up a payment method for on-demand payments.
1997
+ attr_accessor :on_demand
1998
+ # Preferred language of the Klarna authorization page that the customer is redirected to
1999
+ attr_accessor :preferred_locale
2000
+ # Subscription details if setting up or charging a subscription
2001
+ attr_accessor :subscriptions
2002
+
2003
+ def initialize(currency: nil, on_demand: nil, preferred_locale: nil, subscriptions: nil)
2004
+ @currency = currency
2005
+ @on_demand = on_demand
2006
+ @preferred_locale = preferred_locale
2007
+ @subscriptions = subscriptions
2008
+ end
2009
+ end
2010
+
1833
2011
  class Link < Stripe::RequestParams
1834
2012
  # [Deprecated] This is a legacy parameter that no longer has any function.
1835
2013
  attr_accessor :persistent_token
@@ -1940,6 +2118,8 @@ module Stripe
1940
2118
  attr_accessor :card
1941
2119
  # If this is a `card_present` PaymentMethod, this sub-hash contains details about the card-present payment method options.
1942
2120
  attr_accessor :card_present
2121
+ # If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method options.
2122
+ attr_accessor :klarna
1943
2123
  # If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options.
1944
2124
  attr_accessor :link
1945
2125
  # If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options.
@@ -1955,6 +2135,7 @@ module Stripe
1955
2135
  bacs_debit: nil,
1956
2136
  card: nil,
1957
2137
  card_present: nil,
2138
+ klarna: nil,
1958
2139
  link: nil,
1959
2140
  paypal: nil,
1960
2141
  sepa_debit: nil,
@@ -1965,6 +2146,7 @@ module Stripe
1965
2146
  @bacs_debit = bacs_debit
1966
2147
  @card = card
1967
2148
  @card_present = card_present
2149
+ @klarna = klarna
1968
2150
  @link = link
1969
2151
  @paypal = paypal
1970
2152
  @sepa_debit = sepa_debit
@@ -1998,7 +2180,7 @@ module Stripe
1998
2180
  attr_accessor :payment_method_data
1999
2181
  # Payment method-specific configuration for this SetupIntent.
2000
2182
  attr_accessor :payment_method_options
2001
- # The list of payment method types (for example, card) that this SetupIntent can set up. If you don't provide this, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods).
2183
+ # The list of payment method types (for example, card) that this SetupIntent can set up. If you don't provide this, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). A list of valid payment method types can be found [here](https://docs.stripe.com/api/payment_methods/object#payment_method_object-type).
2002
2184
  attr_accessor :payment_method_types
2003
2185
 
2004
2186
  def initialize(
@@ -2192,6 +2374,7 @@ module Stripe
2192
2374
  end
2193
2375
 
2194
2376
  class Cashapp < Stripe::RequestParams; end
2377
+ class Crypto < Stripe::RequestParams; end
2195
2378
  class CustomerBalance < Stripe::RequestParams; end
2196
2379
 
2197
2380
  class Eps < Stripe::RequestParams
@@ -2410,6 +2593,8 @@ module Stripe
2410
2593
  attr_accessor :boleto
2411
2594
  # If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method.
2412
2595
  attr_accessor :cashapp
2596
+ # If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
2597
+ attr_accessor :crypto
2413
2598
  # If this is a `customer_balance` PaymentMethod, this hash contains details about the CustomerBalance payment method.
2414
2599
  attr_accessor :customer_balance
2415
2600
  # If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
@@ -2501,6 +2686,7 @@ module Stripe
2501
2686
  blik: nil,
2502
2687
  boleto: nil,
2503
2688
  cashapp: nil,
2689
+ crypto: nil,
2504
2690
  customer_balance: nil,
2505
2691
  eps: nil,
2506
2692
  fpx: nil,
@@ -2554,6 +2740,7 @@ module Stripe
2554
2740
  @blik = blik
2555
2741
  @boleto = boleto
2556
2742
  @cashapp = cashapp
2743
+ @crypto = crypto
2557
2744
  @customer_balance = customer_balance
2558
2745
  @eps = eps
2559
2746
  @fpx = fpx
@@ -2806,6 +2993,88 @@ module Stripe
2806
2993
 
2807
2994
  class CardPresent < Stripe::RequestParams; end
2808
2995
 
2996
+ class Klarna < Stripe::RequestParams
2997
+ class OnDemand < Stripe::RequestParams
2998
+ # Your average amount value. You can use a value across your customer base, or segment based on customer type, country, etc.
2999
+ attr_accessor :average_amount
3000
+ # The maximum value you may charge a customer per purchase. You can use a value across your customer base, or segment based on customer type, country, etc.
3001
+ attr_accessor :maximum_amount
3002
+ # The lowest or minimum value you may charge a customer per purchase. You can use a value across your customer base, or segment based on customer type, country, etc.
3003
+ attr_accessor :minimum_amount
3004
+ # Interval at which the customer is making purchases
3005
+ attr_accessor :purchase_interval
3006
+ # The number of `purchase_interval` between charges
3007
+ attr_accessor :purchase_interval_count
3008
+
3009
+ def initialize(
3010
+ average_amount: nil,
3011
+ maximum_amount: nil,
3012
+ minimum_amount: nil,
3013
+ purchase_interval: nil,
3014
+ purchase_interval_count: nil
3015
+ )
3016
+ @average_amount = average_amount
3017
+ @maximum_amount = maximum_amount
3018
+ @minimum_amount = minimum_amount
3019
+ @purchase_interval = purchase_interval
3020
+ @purchase_interval_count = purchase_interval_count
3021
+ end
3022
+ end
3023
+
3024
+ class Subscription < Stripe::RequestParams
3025
+ class NextBilling < Stripe::RequestParams
3026
+ # The amount of the next charge for the subscription.
3027
+ attr_accessor :amount
3028
+ # The date of the next charge for the subscription in YYYY-MM-DD format.
3029
+ attr_accessor :date
3030
+
3031
+ def initialize(amount: nil, date: nil)
3032
+ @amount = amount
3033
+ @date = date
3034
+ end
3035
+ end
3036
+ # Unit of time between subscription charges.
3037
+ attr_accessor :interval
3038
+ # The number of intervals (specified in the `interval` attribute) between subscription charges. For example, `interval=month` and `interval_count=3` charges every 3 months.
3039
+ attr_accessor :interval_count
3040
+ # Name for subscription.
3041
+ attr_accessor :name
3042
+ # Describes the upcoming charge for this subscription.
3043
+ attr_accessor :next_billing
3044
+ # A non-customer-facing reference to correlate subscription charges in the Klarna app. Use a value that persists across subscription charges.
3045
+ attr_accessor :reference
3046
+
3047
+ def initialize(
3048
+ interval: nil,
3049
+ interval_count: nil,
3050
+ name: nil,
3051
+ next_billing: nil,
3052
+ reference: nil
3053
+ )
3054
+ @interval = interval
3055
+ @interval_count = interval_count
3056
+ @name = name
3057
+ @next_billing = next_billing
3058
+ @reference = reference
3059
+ end
3060
+ end
3061
+ # The currency of the SetupIntent. Three letter ISO currency code.
3062
+ attr_accessor :currency
3063
+ # On-demand details if setting up a payment method for on-demand payments.
3064
+ attr_accessor :on_demand
3065
+ # Preferred language of the Klarna authorization page that the customer is redirected to
3066
+ attr_accessor :preferred_locale
3067
+ # Subscription details if setting up or charging a subscription
3068
+ attr_accessor :subscriptions
3069
+
3070
+ def initialize(currency: nil, on_demand: nil, preferred_locale: nil, subscriptions: nil)
3071
+ @currency = currency
3072
+ @on_demand = on_demand
3073
+ @preferred_locale = preferred_locale
3074
+ @subscriptions = subscriptions
3075
+ end
3076
+ end
3077
+
2809
3078
  class Link < Stripe::RequestParams
2810
3079
  # [Deprecated] This is a legacy parameter that no longer has any function.
2811
3080
  attr_accessor :persistent_token
@@ -2916,6 +3185,8 @@ module Stripe
2916
3185
  attr_accessor :card
2917
3186
  # If this is a `card_present` PaymentMethod, this sub-hash contains details about the card-present payment method options.
2918
3187
  attr_accessor :card_present
3188
+ # If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method options.
3189
+ attr_accessor :klarna
2919
3190
  # If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options.
2920
3191
  attr_accessor :link
2921
3192
  # If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options.
@@ -2931,6 +3202,7 @@ module Stripe
2931
3202
  bacs_debit: nil,
2932
3203
  card: nil,
2933
3204
  card_present: nil,
3205
+ klarna: nil,
2934
3206
  link: nil,
2935
3207
  paypal: nil,
2936
3208
  sepa_debit: nil,
@@ -2941,6 +3213,7 @@ module Stripe
2941
3213
  @bacs_debit = bacs_debit
2942
3214
  @card = card
2943
3215
  @card_present = card_present
3216
+ @klarna = klarna
2944
3217
  @link = link
2945
3218
  @paypal = paypal
2946
3219
  @sepa_debit = sepa_debit
@@ -122,6 +122,15 @@ module Stripe
122
122
  end
123
123
 
124
124
  class CreateParams < Stripe::RequestParams
125
+ class BillingMode < Stripe::RequestParams
126
+ # Attribute for param field type
127
+ attr_accessor :type
128
+
129
+ def initialize(type: nil)
130
+ @type = type
131
+ end
132
+ end
133
+
125
134
  class DefaultSettings < Stripe::RequestParams
126
135
  class AutomaticTax < Stripe::RequestParams
127
136
  class Liability < Stripe::RequestParams
@@ -584,6 +593,8 @@ module Stripe
584
593
  @trial_end = trial_end
585
594
  end
586
595
  end
596
+ # Controls how prorations and invoices for subscriptions are calculated and orchestrated.
597
+ attr_accessor :billing_mode
587
598
  # The identifier of the customer to create the subscription schedule for.
588
599
  attr_accessor :customer
589
600
  # Object representing the subscription schedule's default settings.
@@ -602,6 +613,7 @@ module Stripe
602
613
  attr_accessor :start_date
603
614
 
604
615
  def initialize(
616
+ billing_mode: nil,
605
617
  customer: nil,
606
618
  default_settings: nil,
607
619
  end_behavior: nil,
@@ -611,6 +623,7 @@ module Stripe
611
623
  phases: nil,
612
624
  start_date: nil
613
625
  )
626
+ @billing_mode = billing_mode
614
627
  @customer = customer
615
628
  @default_settings = default_settings
616
629
  @end_behavior = end_behavior
@@ -547,7 +547,7 @@ module Stripe
547
547
  attr_accessor :billing_thresholds
548
548
  # A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period.
549
549
  attr_accessor :cancel_at
550
- # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This param will be removed in a future API version. Please use `cancel_at` instead.
550
+ # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
551
551
  attr_accessor :cancel_at_period_end
552
552
  # Details about why this subscription was cancelled
553
553
  attr_accessor :cancellation_details
@@ -905,6 +905,15 @@ module Stripe
905
905
  end
906
906
  end
907
907
 
908
+ class BillingMode < Stripe::RequestParams
909
+ # Attribute for param field type
910
+ attr_accessor :type
911
+
912
+ def initialize(type: nil)
913
+ @type = type
914
+ end
915
+ end
916
+
908
917
  class BillingThresholds < Stripe::RequestParams
909
918
  # Monetary threshold that triggers the subscription to advance to a new billing period
910
919
  attr_accessor :amount_gte
@@ -1281,19 +1290,21 @@ module Stripe
1281
1290
  attr_accessor :add_invoice_items
1282
1291
  # A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
1283
1292
  attr_accessor :application_fee_percent
1284
- # Automatic tax settings for this subscription. We recommend you only include this parameter when the existing value is being changed.
1293
+ # Automatic tax settings for this subscription.
1285
1294
  attr_accessor :automatic_tax
1286
- # For new subscriptions, a past timestamp to backdate the subscription's start date to. If set, the first invoice will contain a proration for the timespan between the start date and the current time. Can be combined with trials and the billing cycle anchor.
1295
+ # A past timestamp to backdate the subscription's start date to. If set, the first invoice will contain line items for the timespan between the start date and the current time. Can be combined with trials and the billing cycle anchor.
1287
1296
  attr_accessor :backdate_start_date
1288
1297
  # A future timestamp in UTC format to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). The anchor is the reference point that aligns future billing cycle dates. It sets the day of week for `week` intervals, the day of month for `month` and `year` intervals, and the month of year for `year` intervals.
1289
1298
  attr_accessor :billing_cycle_anchor
1290
1299
  # Mutually exclusive with billing_cycle_anchor and only valid with monthly and yearly price intervals. When provided, the billing_cycle_anchor is set to the next occurence of the day_of_month at the hour, minute, and second UTC.
1291
1300
  attr_accessor :billing_cycle_anchor_config
1301
+ # Controls how prorations and invoices for subscriptions are calculated and orchestrated.
1302
+ attr_accessor :billing_mode
1292
1303
  # Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
1293
1304
  attr_accessor :billing_thresholds
1294
1305
  # A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. If set during a future period, this will always cause a proration for that period.
1295
1306
  attr_accessor :cancel_at
1296
- # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This param will be removed in a future API version. Please use `cancel_at` instead.
1307
+ # Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
1297
1308
  attr_accessor :cancel_at_period_end
1298
1309
  # Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically`.
1299
1310
  attr_accessor :collection_method
@@ -1361,6 +1372,7 @@ module Stripe
1361
1372
  backdate_start_date: nil,
1362
1373
  billing_cycle_anchor: nil,
1363
1374
  billing_cycle_anchor_config: nil,
1375
+ billing_mode: nil,
1364
1376
  billing_thresholds: nil,
1365
1377
  cancel_at: nil,
1366
1378
  cancel_at_period_end: nil,
@@ -1395,6 +1407,7 @@ module Stripe
1395
1407
  @backdate_start_date = backdate_start_date
1396
1408
  @billing_cycle_anchor = billing_cycle_anchor
1397
1409
  @billing_cycle_anchor_config = billing_cycle_anchor_config
1410
+ @billing_mode = billing_mode
1398
1411
  @billing_thresholds = billing_thresholds
1399
1412
  @cancel_at = cancel_at
1400
1413
  @cancel_at_period_end = cancel_at_period_end
@@ -1443,6 +1456,26 @@ module Stripe
1443
1456
  end
1444
1457
  end
1445
1458
 
1459
+ class MigrateParams < Stripe::RequestParams
1460
+ class BillingMode < Stripe::RequestParams
1461
+ # Attribute for param field type
1462
+ attr_accessor :type
1463
+
1464
+ def initialize(type: nil)
1465
+ @type = type
1466
+ end
1467
+ end
1468
+ # Controls how prorations and invoices for subscriptions are calculated and orchestrated.
1469
+ attr_accessor :billing_mode
1470
+ # Specifies which fields in the response should be expanded.
1471
+ attr_accessor :expand
1472
+
1473
+ def initialize(billing_mode: nil, expand: nil)
1474
+ @billing_mode = billing_mode
1475
+ @expand = expand
1476
+ end
1477
+ end
1478
+
1446
1479
  class ResumeParams < Stripe::RequestParams
1447
1480
  # The billing cycle anchor that applies when the subscription is resumed. Either `now` or `unchanged`. The default is `now`. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
1448
1481
  attr_accessor :billing_cycle_anchor
@@ -1520,6 +1553,17 @@ module Stripe
1520
1553
  )
1521
1554
  end
1522
1555
 
1556
+ # Upgrade the billing_mode of an existing subscription.
1557
+ def migrate(subscription, params = {}, opts = {})
1558
+ request(
1559
+ method: :post,
1560
+ path: format("/v1/subscriptions/%<subscription>s/migrate", { subscription: CGI.escape(subscription) }),
1561
+ params: params,
1562
+ opts: opts,
1563
+ base_address: :api
1564
+ )
1565
+ end
1566
+
1523
1567
  # Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date.
1524
1568
  def resume(subscription, params = {}, opts = {})
1525
1569
  request(
@@ -1151,6 +1151,15 @@ module Stripe
1151
1151
  end
1152
1152
  end
1153
1153
 
1154
+ class Ua < Stripe::RequestParams
1155
+ # Type of registration to be created in `country`.
1156
+ attr_accessor :type
1157
+
1158
+ def initialize(type: nil)
1159
+ @type = type
1160
+ end
1161
+ end
1162
+
1154
1163
  class Ug < Stripe::RequestParams
1155
1164
  # Type of registration to be created in `country`.
1156
1165
  attr_accessor :type
@@ -1457,6 +1466,8 @@ module Stripe
1457
1466
  attr_accessor :tr
1458
1467
  # Options for the registration in TZ.
1459
1468
  attr_accessor :tz
1469
+ # Options for the registration in UA.
1470
+ attr_accessor :ua
1460
1471
  # Options for the registration in UG.
1461
1472
  attr_accessor :ug
1462
1473
  # Options for the registration in US.
@@ -1565,6 +1576,7 @@ module Stripe
1565
1576
  tj: nil,
1566
1577
  tr: nil,
1567
1578
  tz: nil,
1579
+ ua: nil,
1568
1580
  ug: nil,
1569
1581
  us: nil,
1570
1582
  uy: nil,
@@ -1664,6 +1676,7 @@ module Stripe
1664
1676
  @tj = tj
1665
1677
  @tr = tr
1666
1678
  @tz = tz
1679
+ @ua = ua
1667
1680
  @ug = ug
1668
1681
  @us = us
1669
1682
  @uy = uy