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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -6
- data/CONTRIBUTING.md +25 -0
- data/OPENAPI_VERSION +1 -1
- data/README.md +10 -7
- data/VERSION +1 -1
- data/lib/stripe/api_version.rb +1 -1
- data/lib/stripe/resources/account.rb +47 -20
- data/lib/stripe/resources/account_session.rb +111 -7
- data/lib/stripe/resources/apple_pay_domain.rb +1 -2
- data/lib/stripe/resources/balance.rb +42 -0
- data/lib/stripe/resources/balance_transaction.rb +2 -0
- data/lib/stripe/resources/bank_account.rb +2 -2
- data/lib/stripe/resources/billing_portal/session.rb +1 -1
- data/lib/stripe/resources/capability.rb +1 -1
- data/lib/stripe/resources/charge.rb +13 -5
- data/lib/stripe/resources/checkout/session.rb +20 -4
- data/lib/stripe/resources/confirmation_token.rb +33 -87
- data/lib/stripe/resources/country_spec.rb +1 -1
- data/lib/stripe/resources/coupon.rb +1 -2
- data/lib/stripe/resources/credit_note.rb +12 -9
- data/lib/stripe/resources/customer.rb +2 -4
- data/lib/stripe/resources/customer_session.rb +3 -3
- data/lib/stripe/resources/dispute.rb +2 -2
- data/lib/stripe/resources/event.rb +1 -1
- data/lib/stripe/resources/file.rb +1 -1
- data/lib/stripe/resources/identity/verification_report.rb +6 -0
- data/lib/stripe/resources/identity/verification_session.rb +17 -11
- data/lib/stripe/resources/invoice.rb +114 -27
- data/lib/stripe/resources/invoice_item.rb +2 -3
- data/lib/stripe/resources/invoice_line_item.rb +1 -1
- data/lib/stripe/resources/invoice_payment.rb +9 -2
- data/lib/stripe/resources/issuing/authorization.rb +8 -8
- data/lib/stripe/resources/issuing/card.rb +1 -1
- data/lib/stripe/resources/issuing/dispute.rb +3 -3
- data/lib/stripe/resources/payment_intent.rb +196 -302
- data/lib/stripe/resources/payment_method.rb +46 -103
- data/lib/stripe/resources/payment_method_configuration.rb +297 -2
- data/lib/stripe/resources/payment_method_domain.rb +2 -2
- data/lib/stripe/resources/payout.rb +4 -4
- data/lib/stripe/resources/person.rb +2 -2
- data/lib/stripe/resources/plan.rb +2 -3
- data/lib/stripe/resources/price.rb +1 -1
- data/lib/stripe/resources/product.rb +1 -2
- data/lib/stripe/resources/radar/value_list.rb +1 -2
- data/lib/stripe/resources/radar/value_list_item.rb +1 -2
- data/lib/stripe/resources/refund.rb +6 -1
- data/lib/stripe/resources/reversal.rb +1 -1
- data/lib/stripe/resources/review.rb +1 -1
- data/lib/stripe/resources/setup_intent.rb +111 -281
- data/lib/stripe/resources/source.rb +1 -1
- data/lib/stripe/resources/subscription.rb +89 -29
- data/lib/stripe/resources/subscription_item.rb +33 -0
- data/lib/stripe/resources/subscription_schedule.rb +119 -4
- data/lib/stripe/resources/tax/calculation.rb +4 -0
- data/lib/stripe/resources/tax/calculation_line_item.rb +2 -0
- data/lib/stripe/resources/tax/registration.rb +1 -1
- data/lib/stripe/resources/tax_id.rb +1 -2
- data/lib/stripe/resources/tax_rate.rb +2 -2
- data/lib/stripe/resources/terminal/configuration.rb +1 -2
- data/lib/stripe/resources/terminal/location.rb +2 -3
- data/lib/stripe/resources/terminal/reader.rb +275 -3
- data/lib/stripe/resources/test_helpers/test_clock.rb +1 -2
- data/lib/stripe/resources/token.rb +2 -2
- data/lib/stripe/resources/transfer.rb +1 -1
- data/lib/stripe/resources/webhook_endpoint.rb +1 -2
- data/lib/stripe/services/account_external_account_service.rb +2 -3
- data/lib/stripe/services/account_login_link_service.rb +1 -1
- data/lib/stripe/services/account_person_service.rb +1 -2
- data/lib/stripe/services/account_service.rb +38 -13
- data/lib/stripe/services/account_session_service.rb +75 -7
- data/lib/stripe/services/apple_pay_domain_service.rb +1 -2
- data/lib/stripe/services/balance_service.rb +1 -1
- data/lib/stripe/services/charge_service.rb +4 -4
- data/lib/stripe/services/checkout/session_service.rb +11 -3
- data/lib/stripe/services/coupon_service.rb +1 -2
- data/lib/stripe/services/credit_note_service.rb +7 -8
- data/lib/stripe/services/customer_balance_transaction_service.rb +3 -3
- data/lib/stripe/services/customer_cash_balance_transaction_service.rb +2 -2
- data/lib/stripe/services/customer_payment_source_service.rb +1 -1
- data/lib/stripe/services/customer_service.rb +3 -5
- data/lib/stripe/services/customer_tax_id_service.rb +1 -2
- data/lib/stripe/services/dispute_service.rb +1 -1
- data/lib/stripe/services/file_service.rb +1 -1
- data/lib/stripe/services/identity/verification_session_service.rb +5 -5
- data/lib/stripe/services/invoice_item_service.rb +1 -2
- data/lib/stripe/services/invoice_service.rb +92 -23
- data/lib/stripe/services/issuing/authorization_service.rb +4 -4
- data/lib/stripe/services/issuing/card_service.rb +1 -1
- data/lib/stripe/services/issuing/dispute_service.rb +2 -2
- data/lib/stripe/services/payment_intent_service.rb +176 -292
- data/lib/stripe/services/payment_method_configuration_service.rb +212 -2
- data/lib/stripe/services/payment_method_domain_service.rb +1 -1
- data/lib/stripe/services/payment_method_service.rb +43 -100
- data/lib/stripe/services/payout_service.rb +2 -2
- data/lib/stripe/services/plan_service.rb +2 -3
- data/lib/stripe/services/price_service.rb +2 -2
- data/lib/stripe/services/product_feature_service.rb +1 -2
- data/lib/stripe/services/product_service.rb +2 -3
- data/lib/stripe/services/promotion_code_service.rb +1 -1
- data/lib/stripe/services/radar/early_fraud_warning_service.rb +1 -1
- data/lib/stripe/services/radar/value_list_item_service.rb +1 -2
- data/lib/stripe/services/radar/value_list_service.rb +1 -2
- data/lib/stripe/services/setup_intent_service.rb +110 -280
- data/lib/stripe/services/source_service.rb +1 -1
- data/lib/stripe/services/subscription_item_service.rb +26 -0
- data/lib/stripe/services/subscription_schedule_service.rb +93 -3
- data/lib/stripe/services/subscription_service.rb +77 -26
- data/lib/stripe/services/tax/calculation_service.rb +4 -0
- data/lib/stripe/services/tax/registration_service.rb +1 -1
- data/lib/stripe/services/tax_id_service.rb +1 -2
- data/lib/stripe/services/terminal/configuration_service.rb +1 -2
- data/lib/stripe/services/terminal/location_service.rb +2 -3
- data/lib/stripe/services/terminal/reader_service.rb +106 -2
- data/lib/stripe/services/test_helpers/confirmation_token_service.rb +33 -87
- data/lib/stripe/services/test_helpers/terminal/reader_service.rb +43 -0
- data/lib/stripe/services/test_helpers/test_clock_service.rb +1 -2
- data/lib/stripe/services/token_service.rb +1 -1
- data/lib/stripe/services/transfer_service.rb +1 -1
- data/lib/stripe/services/v2/billing/meter_event_session_service.rb +1 -2
- data/lib/stripe/services/v2/core/event_destination_service.rb +4 -10
- data/lib/stripe/services/v2/core/event_service.rb +1 -2
- data/lib/stripe/services/webhook_endpoint_service.rb +1 -2
- data/lib/stripe/version.rb +1 -1
- data/rbi/stripe/resources/account.rbi +46 -23
- data/rbi/stripe/resources/account_session.rbi +131 -12
- data/rbi/stripe/resources/apple_pay_domain.rbi +1 -3
- data/rbi/stripe/resources/balance.rbi +55 -0
- data/rbi/stripe/resources/balance_transaction.rbi +3 -0
- data/rbi/stripe/resources/bank_account.rbi +2 -2
- data/rbi/stripe/resources/billing/alert.rbi +2 -2
- data/rbi/stripe/resources/billing_portal/session.rbi +1 -1
- data/rbi/stripe/resources/capability.rbi +1 -1
- data/rbi/stripe/resources/charge.rbi +17 -5
- data/rbi/stripe/resources/checkout/session.rbi +22 -6
- data/rbi/stripe/resources/confirmation_token.rbi +33 -99
- data/rbi/stripe/resources/country_spec.rbi +1 -1
- data/rbi/stripe/resources/coupon.rbi +1 -3
- data/rbi/stripe/resources/credit_note.rbi +14 -9
- data/rbi/stripe/resources/customer.rbi +2 -6
- data/rbi/stripe/resources/customer_session.rbi +3 -3
- data/rbi/stripe/resources/dispute.rbi +2 -2
- data/rbi/stripe/resources/event.rbi +1 -1
- data/rbi/stripe/resources/file.rbi +1 -1
- data/rbi/stripe/resources/identity/verification_report.rbi +9 -0
- data/rbi/stripe/resources/identity/verification_session.rbi +20 -11
- data/rbi/stripe/resources/invoice.rbi +109 -33
- data/rbi/stripe/resources/invoice_item.rbi +2 -4
- data/rbi/stripe/resources/invoice_line_item.rbi +1 -1
- data/rbi/stripe/resources/invoice_payment.rbi +9 -2
- data/rbi/stripe/resources/issuing/authorization.rbi +8 -8
- data/rbi/stripe/resources/issuing/card.rbi +1 -1
- data/rbi/stripe/resources/issuing/dispute.rbi +3 -3
- data/rbi/stripe/resources/payment_intent.rbi +201 -349
- data/rbi/stripe/resources/payment_method.rbi +46 -116
- data/rbi/stripe/resources/payment_method_configuration.rbi +334 -4
- data/rbi/stripe/resources/payment_method_domain.rbi +2 -2
- data/rbi/stripe/resources/payout.rbi +4 -4
- data/rbi/stripe/resources/person.rbi +2 -2
- data/rbi/stripe/resources/plan.rbi +2 -4
- data/rbi/stripe/resources/price.rbi +1 -1
- data/rbi/stripe/resources/product.rbi +1 -3
- data/rbi/stripe/resources/radar/value_list.rbi +1 -3
- data/rbi/stripe/resources/radar/value_list_item.rbi +1 -3
- data/rbi/stripe/resources/refund.rbi +5 -1
- data/rbi/stripe/resources/reversal.rbi +1 -1
- data/rbi/stripe/resources/review.rbi +1 -1
- data/rbi/stripe/resources/setup_intent.rbi +111 -325
- data/rbi/stripe/resources/source.rbi +1 -1
- data/rbi/stripe/resources/subscription.rbi +99 -36
- data/rbi/stripe/resources/subscription_item.rbi +36 -2
- data/rbi/stripe/resources/subscription_schedule.rbi +138 -10
- data/rbi/stripe/resources/tax/calculation.rbi +5 -1
- data/rbi/stripe/resources/tax/calculation_line_item.rbi +3 -0
- data/rbi/stripe/resources/tax/registration.rbi +1 -1
- data/rbi/stripe/resources/tax_id.rbi +1 -3
- data/rbi/stripe/resources/tax_rate.rbi +2 -2
- data/rbi/stripe/resources/terminal/configuration.rbi +1 -3
- data/rbi/stripe/resources/terminal/location.rbi +2 -4
- data/rbi/stripe/resources/terminal/reader.rbi +265 -5
- data/rbi/stripe/resources/test_helpers/test_clock.rbi +1 -3
- data/rbi/stripe/resources/token.rbi +2 -2
- data/rbi/stripe/resources/transfer.rbi +1 -1
- data/rbi/stripe/resources/webhook_endpoint.rbi +1 -3
- data/rbi/stripe/services/account_external_account_service.rbi +2 -4
- data/rbi/stripe/services/account_login_link_service.rbi +1 -1
- data/rbi/stripe/services/account_person_service.rbi +1 -3
- data/rbi/stripe/services/account_service.rbi +40 -16
- data/rbi/stripe/services/account_session_service.rbi +86 -12
- data/rbi/stripe/services/apple_pay_domain_service.rbi +1 -3
- data/rbi/stripe/services/balance_service.rbi +1 -1
- data/rbi/stripe/services/billing/alert_service.rbi +2 -2
- data/rbi/stripe/services/charge_service.rbi +4 -4
- data/rbi/stripe/services/checkout/session_service.rbi +12 -5
- data/rbi/stripe/services/coupon_service.rbi +1 -3
- data/rbi/stripe/services/credit_note_service.rbi +7 -8
- data/rbi/stripe/services/customer_balance_transaction_service.rbi +3 -3
- data/rbi/stripe/services/customer_cash_balance_transaction_service.rbi +2 -2
- data/rbi/stripe/services/customer_payment_source_service.rbi +1 -1
- data/rbi/stripe/services/customer_service.rbi +3 -7
- data/rbi/stripe/services/customer_tax_id_service.rbi +1 -3
- data/rbi/stripe/services/dispute_service.rbi +1 -1
- data/rbi/stripe/services/file_service.rbi +1 -1
- data/rbi/stripe/services/identity/verification_session_service.rbi +5 -5
- data/rbi/stripe/services/invoice_item_service.rbi +1 -3
- data/rbi/stripe/services/invoice_service.rbi +90 -29
- data/rbi/stripe/services/issuing/authorization_service.rbi +4 -4
- data/rbi/stripe/services/issuing/card_service.rbi +1 -1
- data/rbi/stripe/services/issuing/dispute_service.rbi +2 -2
- data/rbi/stripe/services/payment_intent_service.rbi +179 -339
- data/rbi/stripe/services/payment_method_configuration_service.rbi +236 -4
- data/rbi/stripe/services/payment_method_domain_service.rbi +1 -1
- data/rbi/stripe/services/payment_method_service.rbi +43 -113
- data/rbi/stripe/services/payout_service.rbi +2 -2
- data/rbi/stripe/services/plan_service.rbi +2 -4
- data/rbi/stripe/services/price_service.rbi +2 -2
- data/rbi/stripe/services/product_feature_service.rbi +1 -3
- data/rbi/stripe/services/product_service.rbi +2 -4
- data/rbi/stripe/services/promotion_code_service.rbi +1 -1
- data/rbi/stripe/services/radar/early_fraud_warning_service.rbi +1 -1
- data/rbi/stripe/services/radar/value_list_item_service.rbi +1 -3
- data/rbi/stripe/services/radar/value_list_service.rbi +1 -3
- data/rbi/stripe/services/setup_intent_service.rbi +110 -324
- data/rbi/stripe/services/source_service.rbi +1 -1
- data/rbi/stripe/services/subscription_item_service.rbi +28 -2
- data/rbi/stripe/services/subscription_schedule_service.rbi +107 -9
- data/rbi/stripe/services/subscription_service.rbi +85 -33
- data/rbi/stripe/services/tax/calculation_service.rbi +5 -1
- data/rbi/stripe/services/tax/registration_service.rbi +1 -1
- data/rbi/stripe/services/tax_id_service.rbi +1 -3
- data/rbi/stripe/services/terminal/configuration_service.rbi +1 -3
- data/rbi/stripe/services/terminal/location_service.rbi +2 -4
- data/rbi/stripe/services/terminal/reader_service.rbi +115 -4
- data/rbi/stripe/services/test_helpers/confirmation_token_service.rbi +33 -99
- data/rbi/stripe/services/test_helpers/terminal/reader_service.rbi +31 -0
- data/rbi/stripe/services/test_helpers/test_clock_service.rbi +1 -3
- data/rbi/stripe/services/token_service.rbi +1 -1
- data/rbi/stripe/services/transfer_service.rbi +1 -1
- data/rbi/stripe/services/v2/billing/meter_event_session_service.rbi +1 -3
- data/rbi/stripe/services/v2/core/event_destination_service.rbi +4 -12
- data/rbi/stripe/services/v2/core/event_service.rbi +1 -3
- data/rbi/stripe/services/webhook_endpoint_service.rbi +1 -3
- metadata +3 -2
@@ -1475,7 +1475,7 @@ module Stripe
|
|
1475
1475
|
|
1476
1476
|
# Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
1477
1477
|
#
|
1478
|
-
# This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail.
|
1478
|
+
# This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://docs.stripe.com/docs/sources) for more detail.
|
1479
1479
|
sig {
|
1480
1480
|
params(source: String, params: T.any(::Stripe::Source::UpdateParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(Stripe::Source)
|
1481
1481
|
}
|
@@ -43,6 +43,14 @@ module Stripe
|
|
43
43
|
sig { returns(T.nilable(Integer)) }
|
44
44
|
attr_reader :second
|
45
45
|
end
|
46
|
+
class BillingThresholds < Stripe::StripeObject
|
47
|
+
# Monetary threshold that triggers the subscription to create an invoice
|
48
|
+
sig { returns(T.nilable(Integer)) }
|
49
|
+
attr_reader :amount_gte
|
50
|
+
# 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`.
|
51
|
+
sig { returns(T.nilable(T::Boolean)) }
|
52
|
+
attr_reader :reset_billing_cycle_anchor
|
53
|
+
end
|
46
54
|
class CancellationDetails < Stripe::StripeObject
|
47
55
|
# Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user.
|
48
56
|
sig { returns(T.nilable(String)) }
|
@@ -257,10 +265,13 @@ module Stripe
|
|
257
265
|
# The fixed values used to calculate the `billing_cycle_anchor`.
|
258
266
|
sig { returns(T.nilable(BillingCycleAnchorConfig)) }
|
259
267
|
attr_reader :billing_cycle_anchor_config
|
268
|
+
# Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
|
269
|
+
sig { returns(T.nilable(BillingThresholds)) }
|
270
|
+
attr_reader :billing_thresholds
|
260
271
|
# A date in the future at which the subscription will automatically get canceled
|
261
272
|
sig { returns(T.nilable(Integer)) }
|
262
273
|
attr_reader :cancel_at
|
263
|
-
# Whether this subscription will (if `status=active`) or did (if `status=canceled`) cancel at the end of the current billing period.
|
274
|
+
# Whether this subscription will (if `status=active`) or did (if `status=canceled`) cancel at the end of the current billing period. This field will be removed in a future API version. Please use `cancel_at` instead.
|
264
275
|
sig { returns(T::Boolean) }
|
265
276
|
attr_reader :cancel_at_period_end
|
266
277
|
# If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with `cancel_at_period_end`, `canceled_at` will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state.
|
@@ -377,7 +388,7 @@ module Stripe
|
|
377
388
|
# Settings related to subscription trials.
|
378
389
|
sig { returns(T.nilable(TrialSettings)) }
|
379
390
|
attr_reader :trial_settings
|
380
|
-
# If the subscription has a trial, the beginning of that trial.
|
391
|
+
# If the subscription has a trial, the beginning of that trial. For subsequent trials, this date remains as the start of the first ever trial on the subscription.
|
381
392
|
sig { returns(T.nilable(Integer)) }
|
382
393
|
attr_reader :trial_start
|
383
394
|
class CancelParams < Stripe::RequestParams
|
@@ -504,6 +515,18 @@ module Stripe
|
|
504
515
|
}
|
505
516
|
def initialize(enabled: nil, liability: nil); end
|
506
517
|
end
|
518
|
+
class BillingThresholds < Stripe::RequestParams
|
519
|
+
# Monetary threshold that triggers the subscription to advance to a new billing period
|
520
|
+
sig { returns(T.nilable(Integer)) }
|
521
|
+
attr_accessor :amount_gte
|
522
|
+
# 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.
|
523
|
+
sig { returns(T.nilable(T::Boolean)) }
|
524
|
+
attr_accessor :reset_billing_cycle_anchor
|
525
|
+
sig {
|
526
|
+
params(amount_gte: T.nilable(Integer), reset_billing_cycle_anchor: T.nilable(T::Boolean)).void
|
527
|
+
}
|
528
|
+
def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil); end
|
529
|
+
end
|
507
530
|
class CancellationDetails < Stripe::RequestParams
|
508
531
|
# Additional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user.
|
509
532
|
sig { returns(T.nilable(T.nilable(String))) }
|
@@ -554,6 +577,13 @@ module Stripe
|
|
554
577
|
def initialize(account_tax_ids: nil, issuer: nil); end
|
555
578
|
end
|
556
579
|
class Item < Stripe::RequestParams
|
580
|
+
class BillingThresholds < Stripe::RequestParams
|
581
|
+
# 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))
|
582
|
+
sig { returns(Integer) }
|
583
|
+
attr_accessor :usage_gte
|
584
|
+
sig { params(usage_gte: Integer).void }
|
585
|
+
def initialize(usage_gte: nil); end
|
586
|
+
end
|
557
587
|
class Discount < Stripe::RequestParams
|
558
588
|
# ID of the coupon to create a new discount for.
|
559
589
|
sig { returns(T.nilable(String)) }
|
@@ -610,6 +640,11 @@ module Stripe
|
|
610
640
|
unit_amount_decimal: nil
|
611
641
|
); end
|
612
642
|
end
|
643
|
+
# 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.
|
644
|
+
sig {
|
645
|
+
returns(T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::Item::BillingThresholds))))
|
646
|
+
}
|
647
|
+
attr_accessor :billing_thresholds
|
613
648
|
# Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. `clear_usage` has no effect if the plan has a billing meter attached.
|
614
649
|
sig { returns(T.nilable(T::Boolean)) }
|
615
650
|
attr_accessor :clear_usage
|
@@ -643,9 +678,10 @@ module Stripe
|
|
643
678
|
sig { returns(T.nilable(T.nilable(T.any(String, T::Array[String])))) }
|
644
679
|
attr_accessor :tax_rates
|
645
680
|
sig {
|
646
|
-
params(clear_usage: T.nilable(T::Boolean), deleted: T.nilable(T::Boolean), discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::Subscription::UpdateParams::Item::Discount]))), id: T.nilable(String), metadata: T.nilable(T.nilable(T.any(String, T::Hash[String, String]))), plan: T.nilable(String), price: T.nilable(String), price_data: T.nilable(::Stripe::Subscription::UpdateParams::Item::PriceData), quantity: T.nilable(Integer), tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String])))).void
|
681
|
+
params(billing_thresholds: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::Item::BillingThresholds))), clear_usage: T.nilable(T::Boolean), deleted: T.nilable(T::Boolean), discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::Subscription::UpdateParams::Item::Discount]))), id: T.nilable(String), metadata: T.nilable(T.nilable(T.any(String, T::Hash[String, String]))), plan: T.nilable(String), price: T.nilable(String), price_data: T.nilable(::Stripe::Subscription::UpdateParams::Item::PriceData), quantity: T.nilable(Integer), tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String])))).void
|
647
682
|
}
|
648
683
|
def initialize(
|
684
|
+
billing_thresholds: nil,
|
649
685
|
clear_usage: nil,
|
650
686
|
deleted: nil,
|
651
687
|
discounts: nil,
|
@@ -765,12 +801,8 @@ module Stripe
|
|
765
801
|
}
|
766
802
|
def initialize(bank_transfer: nil, funding_type: nil); end
|
767
803
|
end
|
768
|
-
class Konbini < Stripe::RequestParams
|
769
|
-
|
770
|
-
end
|
771
|
-
class SepaDebit < Stripe::RequestParams
|
772
|
-
|
773
|
-
end
|
804
|
+
class Konbini < Stripe::RequestParams; end
|
805
|
+
class SepaDebit < Stripe::RequestParams; end
|
774
806
|
class UsBankAccount < Stripe::RequestParams
|
775
807
|
class FinancialConnections < Stripe::RequestParams
|
776
808
|
class Filters < Stripe::RequestParams
|
@@ -925,10 +957,15 @@ module Stripe
|
|
925
957
|
# Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
|
926
958
|
sig { returns(T.nilable(String)) }
|
927
959
|
attr_accessor :billing_cycle_anchor
|
960
|
+
# 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.
|
961
|
+
sig {
|
962
|
+
returns(T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::BillingThresholds))))
|
963
|
+
}
|
964
|
+
attr_accessor :billing_thresholds
|
928
965
|
# 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.
|
929
966
|
sig { returns(T.nilable(T.nilable(T.any(String, Integer)))) }
|
930
967
|
attr_accessor :cancel_at
|
931
|
-
# Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
|
968
|
+
# 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.
|
932
969
|
sig { returns(T.nilable(T::Boolean)) }
|
933
970
|
attr_accessor :cancel_at_period_end
|
934
971
|
# Details about why this subscription was cancelled
|
@@ -1000,7 +1037,7 @@ module Stripe
|
|
1000
1037
|
# Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`.
|
1001
1038
|
sig { returns(T.nilable(String)) }
|
1002
1039
|
attr_accessor :proration_behavior
|
1003
|
-
# If set,
|
1040
|
+
# If set, prorations will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same prorations that were previewed with the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint. `proration_date` can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations.
|
1004
1041
|
sig { returns(T.nilable(Integer)) }
|
1005
1042
|
attr_accessor :proration_date
|
1006
1043
|
# If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. This will be unset if you POST an empty value.
|
@@ -1008,7 +1045,7 @@ module Stripe
|
|
1008
1045
|
returns(T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::TransferData))))
|
1009
1046
|
}
|
1010
1047
|
attr_accessor :transfer_data
|
1011
|
-
# Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`.
|
1048
|
+
# Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, `trial_end` will override the default trial period of the plan the customer is being subscribed to. The `billing_cycle_anchor` will be updated to the `trial_end` value. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`.
|
1012
1049
|
sig { returns(T.nilable(T.any(String, Integer))) }
|
1013
1050
|
attr_accessor :trial_end
|
1014
1051
|
# Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more.
|
@@ -1018,13 +1055,14 @@ module Stripe
|
|
1018
1055
|
sig { returns(T.nilable(::Stripe::Subscription::UpdateParams::TrialSettings)) }
|
1019
1056
|
attr_accessor :trial_settings
|
1020
1057
|
sig {
|
1021
|
-
params(add_invoice_items: T.nilable(T::Array[::Stripe::Subscription::UpdateParams::AddInvoiceItem]), application_fee_percent: T.nilable(T.nilable(T.any(String, Float))), automatic_tax: T.nilable(::Stripe::Subscription::UpdateParams::AutomaticTax), billing_cycle_anchor: T.nilable(String), cancel_at: T.nilable(T.nilable(T.any(String, Integer))), cancel_at_period_end: T.nilable(T::Boolean), cancellation_details: T.nilable(::Stripe::Subscription::UpdateParams::CancellationDetails), collection_method: T.nilable(String), days_until_due: T.nilable(Integer), default_payment_method: T.nilable(String), default_source: T.nilable(T.nilable(String)), default_tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String]))), description: T.nilable(T.nilable(String)), discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::Subscription::UpdateParams::Discount]))), expand: T.nilable(T::Array[String]), invoice_settings: T.nilable(::Stripe::Subscription::UpdateParams::InvoiceSettings), items: T.nilable(T::Array[::Stripe::Subscription::UpdateParams::Item]), metadata: T.nilable(T.nilable(T.any(String, T::Hash[String, String]))), off_session: T.nilable(T::Boolean), on_behalf_of: T.nilable(T.nilable(String)), pause_collection: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::PauseCollection))), payment_behavior: T.nilable(String), payment_settings: T.nilable(::Stripe::Subscription::UpdateParams::PaymentSettings), pending_invoice_item_interval: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::PendingInvoiceItemInterval))), proration_behavior: T.nilable(String), proration_date: T.nilable(Integer), transfer_data: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::TransferData))), trial_end: T.nilable(T.any(String, Integer)), trial_from_plan: T.nilable(T::Boolean), trial_settings: T.nilable(::Stripe::Subscription::UpdateParams::TrialSettings)).void
|
1058
|
+
params(add_invoice_items: T.nilable(T::Array[::Stripe::Subscription::UpdateParams::AddInvoiceItem]), application_fee_percent: T.nilable(T.nilable(T.any(String, Float))), automatic_tax: T.nilable(::Stripe::Subscription::UpdateParams::AutomaticTax), billing_cycle_anchor: T.nilable(String), billing_thresholds: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::BillingThresholds))), cancel_at: T.nilable(T.nilable(T.any(String, Integer))), cancel_at_period_end: T.nilable(T::Boolean), cancellation_details: T.nilable(::Stripe::Subscription::UpdateParams::CancellationDetails), collection_method: T.nilable(String), days_until_due: T.nilable(Integer), default_payment_method: T.nilable(String), default_source: T.nilable(T.nilable(String)), default_tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String]))), description: T.nilable(T.nilable(String)), discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::Subscription::UpdateParams::Discount]))), expand: T.nilable(T::Array[String]), invoice_settings: T.nilable(::Stripe::Subscription::UpdateParams::InvoiceSettings), items: T.nilable(T::Array[::Stripe::Subscription::UpdateParams::Item]), metadata: T.nilable(T.nilable(T.any(String, T::Hash[String, String]))), off_session: T.nilable(T::Boolean), on_behalf_of: T.nilable(T.nilable(String)), pause_collection: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::PauseCollection))), payment_behavior: T.nilable(String), payment_settings: T.nilable(::Stripe::Subscription::UpdateParams::PaymentSettings), pending_invoice_item_interval: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::PendingInvoiceItemInterval))), proration_behavior: T.nilable(String), proration_date: T.nilable(Integer), transfer_data: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::UpdateParams::TransferData))), trial_end: T.nilable(T.any(String, Integer)), trial_from_plan: T.nilable(T::Boolean), trial_settings: T.nilable(::Stripe::Subscription::UpdateParams::TrialSettings)).void
|
1022
1059
|
}
|
1023
1060
|
def initialize(
|
1024
1061
|
add_invoice_items: nil,
|
1025
1062
|
application_fee_percent: nil,
|
1026
1063
|
automatic_tax: nil,
|
1027
1064
|
billing_cycle_anchor: nil,
|
1065
|
+
billing_thresholds: nil,
|
1028
1066
|
cancel_at: nil,
|
1029
1067
|
cancel_at_period_end: nil,
|
1030
1068
|
cancellation_details: nil,
|
@@ -1053,9 +1091,7 @@ module Stripe
|
|
1053
1091
|
trial_settings: nil
|
1054
1092
|
); end
|
1055
1093
|
end
|
1056
|
-
class DeleteDiscountParams < Stripe::RequestParams
|
1057
|
-
|
1058
|
-
end
|
1094
|
+
class DeleteDiscountParams < Stripe::RequestParams; end
|
1059
1095
|
class ListParams < Stripe::RequestParams
|
1060
1096
|
class AutomaticTax < Stripe::RequestParams
|
1061
1097
|
# Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
|
@@ -1299,6 +1335,18 @@ module Stripe
|
|
1299
1335
|
}
|
1300
1336
|
def initialize(day_of_month: nil, hour: nil, minute: nil, month: nil, second: nil); end
|
1301
1337
|
end
|
1338
|
+
class BillingThresholds < Stripe::RequestParams
|
1339
|
+
# Monetary threshold that triggers the subscription to advance to a new billing period
|
1340
|
+
sig { returns(T.nilable(Integer)) }
|
1341
|
+
attr_accessor :amount_gte
|
1342
|
+
# 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.
|
1343
|
+
sig { returns(T.nilable(T::Boolean)) }
|
1344
|
+
attr_accessor :reset_billing_cycle_anchor
|
1345
|
+
sig {
|
1346
|
+
params(amount_gte: T.nilable(Integer), reset_billing_cycle_anchor: T.nilable(T::Boolean)).void
|
1347
|
+
}
|
1348
|
+
def initialize(amount_gte: nil, reset_billing_cycle_anchor: nil); end
|
1349
|
+
end
|
1302
1350
|
class Discount < Stripe::RequestParams
|
1303
1351
|
# ID of the coupon to create a new discount for.
|
1304
1352
|
sig { returns(T.nilable(String)) }
|
@@ -1337,6 +1385,13 @@ module Stripe
|
|
1337
1385
|
def initialize(account_tax_ids: nil, issuer: nil); end
|
1338
1386
|
end
|
1339
1387
|
class Item < Stripe::RequestParams
|
1388
|
+
class BillingThresholds < Stripe::RequestParams
|
1389
|
+
# 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))
|
1390
|
+
sig { returns(Integer) }
|
1391
|
+
attr_accessor :usage_gte
|
1392
|
+
sig { params(usage_gte: Integer).void }
|
1393
|
+
def initialize(usage_gte: nil); end
|
1394
|
+
end
|
1340
1395
|
class Discount < Stripe::RequestParams
|
1341
1396
|
# ID of the coupon to create a new discount for.
|
1342
1397
|
sig { returns(T.nilable(String)) }
|
@@ -1393,6 +1448,11 @@ module Stripe
|
|
1393
1448
|
unit_amount_decimal: nil
|
1394
1449
|
); end
|
1395
1450
|
end
|
1451
|
+
# 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.
|
1452
|
+
sig {
|
1453
|
+
returns(T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::CreateParams::Item::BillingThresholds))))
|
1454
|
+
}
|
1455
|
+
attr_accessor :billing_thresholds
|
1396
1456
|
# The coupons to redeem into discounts for the subscription item.
|
1397
1457
|
sig {
|
1398
1458
|
returns(T.nilable(T.nilable(T.any(String, T::Array[::Stripe::Subscription::CreateParams::Item::Discount]))))
|
@@ -1417,9 +1477,10 @@ module Stripe
|
|
1417
1477
|
sig { returns(T.nilable(T.nilable(T.any(String, T::Array[String])))) }
|
1418
1478
|
attr_accessor :tax_rates
|
1419
1479
|
sig {
|
1420
|
-
params(discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::Subscription::CreateParams::Item::Discount]))), metadata: T.nilable(T::Hash[String, String]), plan: T.nilable(String), price: T.nilable(String), price_data: T.nilable(::Stripe::Subscription::CreateParams::Item::PriceData), quantity: T.nilable(Integer), tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String])))).void
|
1480
|
+
params(billing_thresholds: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::CreateParams::Item::BillingThresholds))), discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::Subscription::CreateParams::Item::Discount]))), metadata: T.nilable(T::Hash[String, String]), plan: T.nilable(String), price: T.nilable(String), price_data: T.nilable(::Stripe::Subscription::CreateParams::Item::PriceData), quantity: T.nilable(Integer), tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String])))).void
|
1421
1481
|
}
|
1422
1482
|
def initialize(
|
1483
|
+
billing_thresholds: nil,
|
1423
1484
|
discounts: nil,
|
1424
1485
|
metadata: nil,
|
1425
1486
|
plan: nil,
|
@@ -1526,12 +1587,8 @@ module Stripe
|
|
1526
1587
|
}
|
1527
1588
|
def initialize(bank_transfer: nil, funding_type: nil); end
|
1528
1589
|
end
|
1529
|
-
class Konbini < Stripe::RequestParams
|
1530
|
-
|
1531
|
-
end
|
1532
|
-
class SepaDebit < Stripe::RequestParams
|
1533
|
-
|
1534
|
-
end
|
1590
|
+
class Konbini < Stripe::RequestParams; end
|
1591
|
+
class SepaDebit < Stripe::RequestParams; end
|
1535
1592
|
class UsBankAccount < Stripe::RequestParams
|
1536
1593
|
class FinancialConnections < Stripe::RequestParams
|
1537
1594
|
class Filters < Stripe::RequestParams
|
@@ -1692,10 +1749,15 @@ module Stripe
|
|
1692
1749
|
# 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.
|
1693
1750
|
sig { returns(T.nilable(::Stripe::Subscription::CreateParams::BillingCycleAnchorConfig)) }
|
1694
1751
|
attr_accessor :billing_cycle_anchor_config
|
1752
|
+
# 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.
|
1753
|
+
sig {
|
1754
|
+
returns(T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::CreateParams::BillingThresholds))))
|
1755
|
+
}
|
1756
|
+
attr_accessor :billing_thresholds
|
1695
1757
|
# 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.
|
1696
1758
|
sig { returns(T.nilable(Integer)) }
|
1697
1759
|
attr_accessor :cancel_at
|
1698
|
-
# Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
|
1760
|
+
# 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.
|
1699
1761
|
sig { returns(T.nilable(T::Boolean)) }
|
1700
1762
|
attr_accessor :cancel_at_period_end
|
1701
1763
|
# 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`.
|
@@ -1785,7 +1847,7 @@ module Stripe
|
|
1785
1847
|
sig { returns(T.nilable(::Stripe::Subscription::CreateParams::TrialSettings)) }
|
1786
1848
|
attr_accessor :trial_settings
|
1787
1849
|
sig {
|
1788
|
-
params(add_invoice_items: T.nilable(T::Array[::Stripe::Subscription::CreateParams::AddInvoiceItem]), application_fee_percent: T.nilable(T.nilable(T.any(String, Float))), automatic_tax: T.nilable(::Stripe::Subscription::CreateParams::AutomaticTax), backdate_start_date: T.nilable(Integer), billing_cycle_anchor: T.nilable(Integer), billing_cycle_anchor_config: T.nilable(::Stripe::Subscription::CreateParams::BillingCycleAnchorConfig), cancel_at: T.nilable(Integer), cancel_at_period_end: T.nilable(T::Boolean), collection_method: T.nilable(String), currency: T.nilable(String), customer: String, days_until_due: T.nilable(Integer), default_payment_method: T.nilable(String), default_source: T.nilable(String), default_tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String]))), description: T.nilable(String), discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::Subscription::CreateParams::Discount]))), expand: T.nilable(T::Array[String]), invoice_settings: T.nilable(::Stripe::Subscription::CreateParams::InvoiceSettings), items: T.nilable(T::Array[::Stripe::Subscription::CreateParams::Item]), metadata: T.nilable(T.nilable(T.any(String, T::Hash[String, String]))), off_session: T.nilable(T::Boolean), on_behalf_of: T.nilable(T.nilable(String)), payment_behavior: T.nilable(String), payment_settings: T.nilable(::Stripe::Subscription::CreateParams::PaymentSettings), pending_invoice_item_interval: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::CreateParams::PendingInvoiceItemInterval))), proration_behavior: T.nilable(String), transfer_data: T.nilable(::Stripe::Subscription::CreateParams::TransferData), trial_end: T.nilable(T.any(String, Integer)), trial_from_plan: T.nilable(T::Boolean), trial_period_days: T.nilable(Integer), trial_settings: T.nilable(::Stripe::Subscription::CreateParams::TrialSettings)).void
|
1850
|
+
params(add_invoice_items: T.nilable(T::Array[::Stripe::Subscription::CreateParams::AddInvoiceItem]), application_fee_percent: T.nilable(T.nilable(T.any(String, Float))), automatic_tax: T.nilable(::Stripe::Subscription::CreateParams::AutomaticTax), backdate_start_date: T.nilable(Integer), billing_cycle_anchor: T.nilable(Integer), billing_cycle_anchor_config: T.nilable(::Stripe::Subscription::CreateParams::BillingCycleAnchorConfig), billing_thresholds: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::CreateParams::BillingThresholds))), cancel_at: T.nilable(Integer), cancel_at_period_end: T.nilable(T::Boolean), collection_method: T.nilable(String), currency: T.nilable(String), customer: String, days_until_due: T.nilable(Integer), default_payment_method: T.nilable(String), default_source: T.nilable(String), default_tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String]))), description: T.nilable(String), discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::Subscription::CreateParams::Discount]))), expand: T.nilable(T::Array[String]), invoice_settings: T.nilable(::Stripe::Subscription::CreateParams::InvoiceSettings), items: T.nilable(T::Array[::Stripe::Subscription::CreateParams::Item]), metadata: T.nilable(T.nilable(T.any(String, T::Hash[String, String]))), off_session: T.nilable(T::Boolean), on_behalf_of: T.nilable(T.nilable(String)), payment_behavior: T.nilable(String), payment_settings: T.nilable(::Stripe::Subscription::CreateParams::PaymentSettings), pending_invoice_item_interval: T.nilable(T.nilable(T.any(String, ::Stripe::Subscription::CreateParams::PendingInvoiceItemInterval))), proration_behavior: T.nilable(String), transfer_data: T.nilable(::Stripe::Subscription::CreateParams::TransferData), trial_end: T.nilable(T.any(String, Integer)), trial_from_plan: T.nilable(T::Boolean), trial_period_days: T.nilable(Integer), trial_settings: T.nilable(::Stripe::Subscription::CreateParams::TrialSettings)).void
|
1789
1851
|
}
|
1790
1852
|
def initialize(
|
1791
1853
|
add_invoice_items: nil,
|
@@ -1794,6 +1856,7 @@ module Stripe
|
|
1794
1856
|
backdate_start_date: nil,
|
1795
1857
|
billing_cycle_anchor: nil,
|
1796
1858
|
billing_cycle_anchor_config: nil,
|
1859
|
+
billing_thresholds: nil,
|
1797
1860
|
cancel_at: nil,
|
1798
1861
|
cancel_at_period_end: nil,
|
1799
1862
|
collection_method: nil,
|
@@ -1847,10 +1910,10 @@ module Stripe
|
|
1847
1910
|
# Specifies which fields in the response should be expanded.
|
1848
1911
|
sig { returns(T.nilable(T::Array[String])) }
|
1849
1912
|
attr_accessor :expand
|
1850
|
-
# Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations)
|
1913
|
+
# Determines how to handle [prorations](https://stripe.com/docs/billing/subscriptions/prorations) resulting from the `billing_cycle_anchor` being `unchanged`. When the `billing_cycle_anchor` is set to `now` (default value), no prorations are generated. If no value is passed, the default is `create_prorations`.
|
1851
1914
|
sig { returns(T.nilable(String)) }
|
1852
1915
|
attr_accessor :proration_behavior
|
1853
|
-
# If set,
|
1916
|
+
# If set, prorations will be calculated as though the subscription was resumed at the given time. This can be used to apply exactly the same prorations that were previewed with the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint.
|
1854
1917
|
sig { returns(T.nilable(Integer)) }
|
1855
1918
|
attr_accessor :proration_date
|
1856
1919
|
sig {
|
@@ -1863,9 +1926,9 @@ module Stripe
|
|
1863
1926
|
proration_date: nil
|
1864
1927
|
); end
|
1865
1928
|
end
|
1866
|
-
# Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata).
|
1929
|
+
# Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://docs.stripe.com/metadata).
|
1867
1930
|
#
|
1868
|
-
# Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/
|
1931
|
+
# Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://docs.stripe.com/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed if invoice_now and prorate are both set to true.
|
1869
1932
|
#
|
1870
1933
|
# By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
|
1871
1934
|
sig {
|
@@ -1873,9 +1936,9 @@ module Stripe
|
|
1873
1936
|
}
|
1874
1937
|
def cancel(params = {}, opts = {}); end
|
1875
1938
|
|
1876
|
-
# Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata).
|
1939
|
+
# Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://docs.stripe.com/metadata).
|
1877
1940
|
#
|
1878
|
-
# Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/
|
1941
|
+
# Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://docs.stripe.com/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed if invoice_now and prorate are both set to true.
|
1879
1942
|
#
|
1880
1943
|
# By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
|
1881
1944
|
sig {
|
@@ -1888,7 +1951,7 @@ module Stripe
|
|
1888
1951
|
# When you create a subscription with collection_method=charge_automatically, the first invoice is finalized as part of the request.
|
1889
1952
|
# The payment_behavior parameter determines the exact behavior of the initial payment.
|
1890
1953
|
#
|
1891
|
-
# To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
|
1954
|
+
# To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://docs.stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
|
1892
1955
|
# Schedules provide the flexibility to model more complex billing configurations that change over time.
|
1893
1956
|
sig {
|
1894
1957
|
params(params: T.any(::Stripe::Subscription::CreateParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(Stripe::Subscription)
|
@@ -1937,7 +2000,7 @@ module Stripe
|
|
1937
2000
|
|
1938
2001
|
# Updates an existing subscription to match the specified parameters.
|
1939
2002
|
# When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes.
|
1940
|
-
# To preview how the proration is calculated, use the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint.
|
2003
|
+
# To preview how the proration is calculated, use the [create preview](https://docs.stripe.com/docs/api/invoices/create_preview) endpoint.
|
1941
2004
|
#
|
1942
2005
|
# By default, we prorate subscription changes. For example, if a customer signs up on May 1 for a 100 price, they'll be billed 100 immediately. If on May 15 they switch to a 200 price, then on June 1 they'll be billed 250 (200 for a renewal of her subscription, plus a 50 prorating adjustment for half of the previous month's 100 difference). Similarly, a downgrade generates a credit that is applied to the next invoice. We also prorate when you make quantity changes.
|
1943
2006
|
#
|
@@ -1949,13 +2012,13 @@ module Stripe
|
|
1949
2012
|
# A trial starts or ends.
|
1950
2013
|
#
|
1951
2014
|
#
|
1952
|
-
# In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment).
|
2015
|
+
# In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://docs.stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment).
|
1953
2016
|
#
|
1954
|
-
# If you want to charge for an upgrade immediately, pass proration_behavior as always_invoice to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you pass create_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription's renewal date, you need to manually [invoice the customer](https://stripe.com/docs/api/invoices/create).
|
2017
|
+
# If you want to charge for an upgrade immediately, pass proration_behavior as always_invoice to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you pass create_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription's renewal date, you need to manually [invoice the customer](https://docs.stripe.com/docs/api/invoices/create).
|
1955
2018
|
#
|
1956
2019
|
# If you don't want to prorate, set the proration_behavior option to none. With this option, the customer is billed 100 on May 1 and 200 on June 1. Similarly, if you set proration_behavior to none when switching between different billing intervals (for example, from monthly to yearly), we don't generate any credits for the old subscription's unused time. We still reset the billing date and bill immediately for the new subscription.
|
1957
2020
|
#
|
1958
|
-
# Updating the quantity on a subscription many times in an hour may result in [rate limiting. If you need to bill for a frequently changing quantity, consider integrating <a href="/docs/billing/subscriptions/usage-based">usage-based billing](https://stripe.com/docs/rate-limits) instead.
|
2021
|
+
# Updating the quantity on a subscription many times in an hour may result in [rate limiting. If you need to bill for a frequently changing quantity, consider integrating <a href="/docs/billing/subscriptions/usage-based">usage-based billing](https://docs.stripe.com/docs/rate-limits) instead.
|
1959
2022
|
sig {
|
1960
2023
|
params(subscription_exposed_id: String, params: T.any(::Stripe::Subscription::UpdateParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(Stripe::Subscription)
|
1961
2024
|
}
|
@@ -6,6 +6,14 @@ module Stripe
|
|
6
6
|
# Subscription items allow you to create customer subscriptions with more than
|
7
7
|
# one plan, making it easy to represent complex billing relationships.
|
8
8
|
class SubscriptionItem < APIResource
|
9
|
+
class BillingThresholds < Stripe::StripeObject
|
10
|
+
# Usage threshold that triggers the subscription to create an invoice
|
11
|
+
sig { returns(T.nilable(Integer)) }
|
12
|
+
attr_reader :usage_gte
|
13
|
+
end
|
14
|
+
# Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period
|
15
|
+
sig { returns(T.nilable(BillingThresholds)) }
|
16
|
+
attr_reader :billing_thresholds
|
9
17
|
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
10
18
|
sig { returns(Integer) }
|
11
19
|
attr_reader :created
|
@@ -73,6 +81,13 @@ module Stripe
|
|
73
81
|
def initialize(clear_usage: nil, proration_behavior: nil, proration_date: nil); end
|
74
82
|
end
|
75
83
|
class UpdateParams < Stripe::RequestParams
|
84
|
+
class BillingThresholds < Stripe::RequestParams
|
85
|
+
# 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))
|
86
|
+
sig { returns(Integer) }
|
87
|
+
attr_accessor :usage_gte
|
88
|
+
sig { params(usage_gte: Integer).void }
|
89
|
+
def initialize(usage_gte: nil); end
|
90
|
+
end
|
76
91
|
class Discount < Stripe::RequestParams
|
77
92
|
# ID of the coupon to create a new discount for.
|
78
93
|
sig { returns(T.nilable(String)) }
|
@@ -129,6 +144,11 @@ module Stripe
|
|
129
144
|
unit_amount_decimal: nil
|
130
145
|
); end
|
131
146
|
end
|
147
|
+
# 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.
|
148
|
+
sig {
|
149
|
+
returns(T.nilable(T.nilable(T.any(String, ::Stripe::SubscriptionItem::UpdateParams::BillingThresholds))))
|
150
|
+
}
|
151
|
+
attr_accessor :billing_thresholds
|
132
152
|
# The coupons to redeem into discounts for the subscription item.
|
133
153
|
sig {
|
134
154
|
returns(T.nilable(T.nilable(T.any(String, T::Array[::Stripe::SubscriptionItem::UpdateParams::Discount]))))
|
@@ -174,9 +194,10 @@ module Stripe
|
|
174
194
|
sig { returns(T.nilable(T.nilable(T.any(String, T::Array[String])))) }
|
175
195
|
attr_accessor :tax_rates
|
176
196
|
sig {
|
177
|
-
params(discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::SubscriptionItem::UpdateParams::Discount]))), expand: T.nilable(T::Array[String]), metadata: T.nilable(T.nilable(T.any(String, T::Hash[String, String]))), off_session: T.nilable(T::Boolean), payment_behavior: T.nilable(String), plan: T.nilable(String), price: T.nilable(String), price_data: T.nilable(::Stripe::SubscriptionItem::UpdateParams::PriceData), proration_behavior: T.nilable(String), proration_date: T.nilable(Integer), quantity: T.nilable(Integer), tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String])))).void
|
197
|
+
params(billing_thresholds: T.nilable(T.nilable(T.any(String, ::Stripe::SubscriptionItem::UpdateParams::BillingThresholds))), discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::SubscriptionItem::UpdateParams::Discount]))), expand: T.nilable(T::Array[String]), metadata: T.nilable(T.nilable(T.any(String, T::Hash[String, String]))), off_session: T.nilable(T::Boolean), payment_behavior: T.nilable(String), plan: T.nilable(String), price: T.nilable(String), price_data: T.nilable(::Stripe::SubscriptionItem::UpdateParams::PriceData), proration_behavior: T.nilable(String), proration_date: T.nilable(Integer), quantity: T.nilable(Integer), tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String])))).void
|
178
198
|
}
|
179
199
|
def initialize(
|
200
|
+
billing_thresholds: nil,
|
180
201
|
discounts: nil,
|
181
202
|
expand: nil,
|
182
203
|
metadata: nil,
|
@@ -219,6 +240,13 @@ module Stripe
|
|
219
240
|
); end
|
220
241
|
end
|
221
242
|
class CreateParams < Stripe::RequestParams
|
243
|
+
class BillingThresholds < Stripe::RequestParams
|
244
|
+
# 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))
|
245
|
+
sig { returns(Integer) }
|
246
|
+
attr_accessor :usage_gte
|
247
|
+
sig { params(usage_gte: Integer).void }
|
248
|
+
def initialize(usage_gte: nil); end
|
249
|
+
end
|
222
250
|
class Discount < Stripe::RequestParams
|
223
251
|
# ID of the coupon to create a new discount for.
|
224
252
|
sig { returns(T.nilable(String)) }
|
@@ -275,6 +303,11 @@ module Stripe
|
|
275
303
|
unit_amount_decimal: nil
|
276
304
|
); end
|
277
305
|
end
|
306
|
+
# 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.
|
307
|
+
sig {
|
308
|
+
returns(T.nilable(T.nilable(T.any(String, ::Stripe::SubscriptionItem::CreateParams::BillingThresholds))))
|
309
|
+
}
|
310
|
+
attr_accessor :billing_thresholds
|
278
311
|
# The coupons to redeem into discounts for the subscription item.
|
279
312
|
sig {
|
280
313
|
returns(T.nilable(T.nilable(T.any(String, T::Array[::Stripe::SubscriptionItem::CreateParams::Discount]))))
|
@@ -320,9 +353,10 @@ module Stripe
|
|
320
353
|
sig { returns(T.nilable(T.nilable(T.any(String, T::Array[String])))) }
|
321
354
|
attr_accessor :tax_rates
|
322
355
|
sig {
|
323
|
-
params(discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::SubscriptionItem::CreateParams::Discount]))), expand: T.nilable(T::Array[String]), metadata: T.nilable(T::Hash[String, String]), payment_behavior: T.nilable(String), plan: T.nilable(String), price: T.nilable(String), price_data: T.nilable(::Stripe::SubscriptionItem::CreateParams::PriceData), proration_behavior: T.nilable(String), proration_date: T.nilable(Integer), quantity: T.nilable(Integer), subscription: String, tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String])))).void
|
356
|
+
params(billing_thresholds: T.nilable(T.nilable(T.any(String, ::Stripe::SubscriptionItem::CreateParams::BillingThresholds))), discounts: T.nilable(T.nilable(T.any(String, T::Array[::Stripe::SubscriptionItem::CreateParams::Discount]))), expand: T.nilable(T::Array[String]), metadata: T.nilable(T::Hash[String, String]), payment_behavior: T.nilable(String), plan: T.nilable(String), price: T.nilable(String), price_data: T.nilable(::Stripe::SubscriptionItem::CreateParams::PriceData), proration_behavior: T.nilable(String), proration_date: T.nilable(Integer), quantity: T.nilable(Integer), subscription: String, tax_rates: T.nilable(T.nilable(T.any(String, T::Array[String])))).void
|
324
357
|
}
|
325
358
|
def initialize(
|
359
|
+
billing_thresholds: nil,
|
326
360
|
discounts: nil,
|
327
361
|
expand: nil,
|
328
362
|
metadata: nil,
|