diff --git a/API_VERSION b/API_VERSION index e2854d256..c0c856de5 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -7f436e73385732b1c5502f408a6fe37f7b6b0612 \ No newline at end of file +28b33d4a6cc796fd90ee77d1c5ea63206b25f727 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index dfdc750b8..cd40e690b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## 18.1.0-beta.1 - 2025-11-18 +This release changes the pinned API version to `2025-11-17.preview`. + +* [#1722](https://github.com/stripe/stripe-ruby/pull/1722) Update generated code for beta + * Add support for new resources `V2::Core::AccountPersonToken` and `V2::Core::AccountToken` + * Remove support for resource `V2::Payments::OffSessionPayment` + * Add support for `create` and `retrieve` methods on resources `V2::Core::AccountPersonToken` and `V2::Core::AccountToken` + * Remove support for `cancel`, `capture`, `create`, `list`, and `retrieve` methods on resource `V2::Payments::OffSessionPayment` + * Change `Tax::Association.tax_transaction_attempts` to be required + * Add support for `specified_commercial_transactions_act_url` on `Account::BusinessProfile`, `AccountCreateParams::BusinessProfile`, and `AccountUpdateParams::BusinessProfile` + * Add support for `paypay_payments` on `Account::Setting`, `AccountCreateParams::Setting`, and `AccountUpdateParams::Setting` + * Change type of `Billing::Analytics::MeterUsageRetrieveParams::Meter.dimension_filters` from `string` to `array(string)` + * Change type of `Billing::Analytics::MeterUsageRetrieveParams::Meter.tenant_filters` from `string` to `array(string)` + * Add support for `car_rental_data`, `flight_data`, and `lodging_data` on `ChargeCaptureParams::PaymentDetail`, `ChargeUpdateParams::PaymentDetail`, `PaymentIntentCaptureParams::PaymentDetail`, `PaymentIntentConfirmParams::PaymentDetail`, `PaymentIntentCreateParams::PaymentDetail`, and `PaymentIntentUpdateParams::PaymentDetail` + * Add support for `supplementary_purchase_data` on `OrderCreateParams::Payment::Setting::PaymentMethodOption::Klarna`, `OrderUpdateParams::Payment::Setting::PaymentMethodOption::Klarna`, `PaymentIntentConfirmParams::PaymentMethodOption::Klarna`, `PaymentIntentCreateParams::PaymentMethodOption::Klarna`, and `PaymentIntentUpdateParams::PaymentMethodOption::Klarna` + * Add support for `allow_redisplay` and `customer_account` on `PaymentMethodListParams` + * Add support for `future_requirements` on `V2::Core::Account` + * Add support for `konbini_payments` and `script_statement_descriptor` on `V2::Core::Account::Configuration::Merchant`, `V2::Core::AccountCreateParams::Configuration::Merchant`, and `V2::Core::AccountUpdateParams::Configuration::Merchant` + * Add support for `eur` on `V2::Core::Account::Configuration::Storer::Capability::HoldsCurrency`, `V2::Core::AccountCreateParams::Configuration::Storer::Capability::HoldsCurrency`, and `V2::Core::AccountUpdateParams::Configuration::Storer::Capability::HoldsCurrency` + * Add support for `requirements_collector` on `V2::Core::Account::Default::Responsibility` + * Remove support for `collector` on `V2::Core::Account::Requirement` + * Add support for `changes` on `V2::Core::Event` + * Add support for `account_token` on `V2::Core::AccountCreateParams` and `V2::Core::AccountUpdateParams` + * Add support for `person_token` on `V2::Core::AccountPersonCreateParams` and `V2::Core::AccountPersonUpdateParams` + * Add support for `changes` on `V2::Core::Event` + * Add support for thin event `V2CoreHealthEventGenerationFailureResolvedEvent` + * Remove support for thin events `V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent`, `V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent`, `V2PaymentsOffSessionPaymentCanceledEvent`, `V2PaymentsOffSessionPaymentCreatedEvent`, `V2PaymentsOffSessionPaymentFailedEvent`, `V2PaymentsOffSessionPaymentRequiresCaptureEvent`, and `V2PaymentsOffSessionPaymentSucceededEvent` with related object `V2::Payments::OffSessionPayment` + ## 18.1.0-alpha.2 - 2025-11-20 This release changes the pinned API version to `2025-11-17.preview`. @@ -128,33 +156,8 @@ This release changes the pinned API version to `2025-11-17.preview`. * Add support for `mb_way` and `twint` on `Refund::DestinationDetail` * Change type of `SubscriptionScheduleUpdateParams.billing_schedules` from `array(billing_schedules_update_params)` to `emptyable(array(billing_schedules_update_params))` -## 18.1.0-beta.1 - 2025-11-18 -This release changes the pinned API version to `2025-11-17.preview`. - -* [#1722](https://github.com/stripe/stripe-ruby/pull/1722) Update generated code for beta - * Add support for new resources `V2::Core::AccountPersonToken` and `V2::Core::AccountToken` - * Remove support for resource `V2::Payments::OffSessionPayment` - * Add support for `create` and `retrieve` methods on resources `V2::Core::AccountPersonToken` and `V2::Core::AccountToken` - * Remove support for `cancel`, `capture`, `create`, `list`, and `retrieve` methods on resource `V2::Payments::OffSessionPayment` - * Change `Tax::Association.tax_transaction_attempts` to be required - * Add support for `specified_commercial_transactions_act_url` on `Account::BusinessProfile`, `AccountCreateParams::BusinessProfile`, and `AccountUpdateParams::BusinessProfile` - * Add support for `paypay_payments` on `Account::Setting`, `AccountCreateParams::Setting`, and `AccountUpdateParams::Setting` - * Change type of `Billing::Analytics::MeterUsageRetrieveParams::Meter.dimension_filters` from `string` to `array(string)` - * Change type of `Billing::Analytics::MeterUsageRetrieveParams::Meter.tenant_filters` from `string` to `array(string)` - * Add support for `car_rental_data`, `flight_data`, and `lodging_data` on `ChargeCaptureParams::PaymentDetail`, `ChargeUpdateParams::PaymentDetail`, `PaymentIntentCaptureParams::PaymentDetail`, `PaymentIntentConfirmParams::PaymentDetail`, `PaymentIntentCreateParams::PaymentDetail`, and `PaymentIntentUpdateParams::PaymentDetail` - * Add support for `supplementary_purchase_data` on `OrderCreateParams::Payment::Setting::PaymentMethodOption::Klarna`, `OrderUpdateParams::Payment::Setting::PaymentMethodOption::Klarna`, `PaymentIntentConfirmParams::PaymentMethodOption::Klarna`, `PaymentIntentCreateParams::PaymentMethodOption::Klarna`, and `PaymentIntentUpdateParams::PaymentMethodOption::Klarna` - * Add support for `allow_redisplay` and `customer_account` on `PaymentMethodListParams` - * Add support for `future_requirements` on `V2::Core::Account` - * Add support for `konbini_payments` and `script_statement_descriptor` on `V2::Core::Account::Configuration::Merchant`, `V2::Core::AccountCreateParams::Configuration::Merchant`, and `V2::Core::AccountUpdateParams::Configuration::Merchant` - * Add support for `eur` on `V2::Core::Account::Configuration::Storer::Capability::HoldsCurrency`, `V2::Core::AccountCreateParams::Configuration::Storer::Capability::HoldsCurrency`, and `V2::Core::AccountUpdateParams::Configuration::Storer::Capability::HoldsCurrency` - * Add support for `requirements_collector` on `V2::Core::Account::Default::Responsibility` - * Remove support for `collector` on `V2::Core::Account::Requirement` - * Add support for `changes` on `V2::Core::Event` - * Add support for `account_token` on `V2::Core::AccountCreateParams` and `V2::Core::AccountUpdateParams` - * Add support for `person_token` on `V2::Core::AccountPersonCreateParams` and `V2::Core::AccountPersonUpdateParams` - * Add support for `changes` on `V2::Core::Event` - * Add support for thin event `V2CoreHealthEventGenerationFailureResolvedEvent` - * Remove support for thin events `V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEvent`, `V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEvent`, `V2PaymentsOffSessionPaymentCanceledEvent`, `V2PaymentsOffSessionPaymentCreatedEvent`, `V2PaymentsOffSessionPaymentFailedEvent`, `V2PaymentsOffSessionPaymentRequiresCaptureEvent`, and `V2PaymentsOffSessionPaymentSucceededEvent` with related object `V2::Payments::OffSessionPayment` +## 18.0.1 - 2025-11-21 +* [#1736](https://github.com/stripe/stripe-ruby/pull/1736) Throw a specific error when accessing `payment_intent` property on `Invoice` object to ease debugging. ## 18.0.0 - 2025-11-18 This release changes the pinned API version to `2025-11-17.clover`. diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 1d5ad796c..3809bd615 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2128 \ No newline at end of file +v2129 \ No newline at end of file diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index bd86be74f..e814ee45b 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -124,6 +124,7 @@ def self.object_names_to_classes Privacy::RedactionJob.object_name => Privacy::RedactionJob, Privacy::RedactionJobValidationError.object_name => Privacy::RedactionJobValidationError, Product.object_name => Product, + ProductCatalog::TrialOffer.object_name => ProductCatalog::TrialOffer, ProductFeature.object_name => ProductFeature, PromotionCode.object_name => PromotionCode, Quote.object_name => Quote, diff --git a/lib/stripe/params.rb b/lib/stripe/params.rb index 3d3e097e0..c6e7ed943 100644 --- a/lib/stripe/params.rb +++ b/lib/stripe/params.rb @@ -402,6 +402,7 @@ require "stripe/params/privacy/redaction_job_update_params" require "stripe/params/privacy/redaction_job_validate_params" require "stripe/params/privacy/redaction_job_validation_error_list_params" +require "stripe/params/product_catalog/trial_offer_create_params" require "stripe/params/product_create_params" require "stripe/params/product_delete_params" require "stripe/params/product_feature_create_params" diff --git a/lib/stripe/params/payment_intent_create_params.rb b/lib/stripe/params/payment_intent_create_params.rb index 01f8bf901..33524e668 100644 --- a/lib/stripe/params/payment_intent_create_params.rb +++ b/lib/stripe/params/payment_intent_create_params.rb @@ -5517,6 +5517,15 @@ def initialize( end end + class PaymentsOrchestration < ::Stripe::RequestParams + # Whether this feature is enabled. + attr_accessor :enabled + + def initialize(enabled: nil) + @enabled = enabled + end + end + class RadarOptions < ::Stripe::RequestParams # A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. attr_accessor :session @@ -5702,6 +5711,8 @@ def initialize(amount: nil, destination: nil) attr_accessor :transfer_group # Set to `true` when confirming server-side and using Stripe.js, iOS, or Android client-side SDKs to handle the next actions. attr_accessor :use_stripe_sdk + # When you enable this parameter, this PaymentIntent will route your payment to processors that you configure in the dashboard. + attr_accessor :payments_orchestration def initialize( allocated_funds: nil, @@ -5743,7 +5754,8 @@ def initialize( statement_descriptor_suffix: nil, transfer_data: nil, transfer_group: nil, - use_stripe_sdk: nil + use_stripe_sdk: nil, + payments_orchestration: nil ) @allocated_funds = allocated_funds @amount = amount @@ -5785,6 +5797,7 @@ def initialize( @transfer_data = transfer_data @transfer_group = transfer_group @use_stripe_sdk = use_stripe_sdk + @payments_orchestration = payments_orchestration end end end diff --git a/lib/stripe/params/product_catalog/trial_offer_create_params.rb b/lib/stripe/params/product_catalog/trial_offer_create_params.rb new file mode 100644 index 000000000..42c7450aa --- /dev/null +++ b/lib/stripe/params/product_catalog/trial_offer_create_params.rb @@ -0,0 +1,60 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module ProductCatalog + class TrialOfferCreateParams < ::Stripe::RequestParams + class Duration < ::Stripe::RequestParams + class Relative < ::Stripe::RequestParams + # The number of recurring price's interval to apply for the trial period. + attr_accessor :iterations + + def initialize(iterations: nil) + @iterations = iterations + end + end + # The relative duration of the trial period computed as the number of recurring price intervals. + attr_accessor :relative + # Specifies how the trial offer duration is determined. + attr_accessor :type + + def initialize(relative: nil, type: nil) + @relative = relative + @type = type + end + end + + class EndBehavior < ::Stripe::RequestParams + class Transition < ::Stripe::RequestParams + # The price to transition the recurring item to when the trial offer ends. + attr_accessor :price + + def initialize(price: nil) + @price = price + end + end + # The transition to apply when the trial offer ends. + attr_accessor :transition + + def initialize(transition: nil) + @transition = transition + end + end + # Duration of one service period of the trial. + attr_accessor :duration + # Define behavior that occurs at the end of the trial. + attr_accessor :end_behavior + # Specifies which fields in the response should be expanded. + attr_accessor :expand + # Price configuration during the trial period (amount, billing scheme, etc). + attr_accessor :price + + def initialize(duration: nil, end_behavior: nil, expand: nil, price: nil) + @duration = duration + @end_behavior = end_behavior + @expand = expand + @price = price + end + end + end +end diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index e947171ee..6a815cb21 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -112,6 +112,7 @@ require "stripe/resources/privacy/redaction_job" require "stripe/resources/privacy/redaction_job_validation_error" require "stripe/resources/product" +require "stripe/resources/product_catalog/trial_offer" require "stripe/resources/product_feature" require "stripe/resources/promotion_code" require "stripe/resources/quote" diff --git a/lib/stripe/resources/delegated_checkout/requested_session.rb b/lib/stripe/resources/delegated_checkout/requested_session.rb index c34322062..29c27b73f 100644 --- a/lib/stripe/resources/delegated_checkout/requested_session.rb +++ b/lib/stripe/resources/delegated_checkout/requested_session.rb @@ -157,14 +157,6 @@ class LineItemDetail < ::Stripe::StripeObject attr_reader :amount_discount # The total before any discounts or taxes are applied. attr_reader :amount_subtotal - # The total after discounts but before taxes are applied. - attr_reader :amount_subtotal_after_discount - # The total after discounts and taxes. - attr_reader :amount_total - # The per-unit amount of the item after discounts but before taxes are applied. - attr_reader :unit_amount_after_discount - # The per-unit discount amount. If no discount were applied, defaults to 0. - attr_reader :unit_discount def self.inner_class_types @inner_class_types = {} @@ -291,14 +283,14 @@ def self.field_remappings @field_remappings = {} end end - # The amount discount of the total details. - attr_reader :amount_discount # The amount fulfillment of the total details. attr_reader :amount_fulfillment # The amount tax of the total details. attr_reader :amount_tax - # Total of all items after discounts but before taxes are applied. - attr_reader :amount_subtotal_after_discount + # The amount of order-level discounts applied to the cart. The total discount amount for this session can be computed by summing the cart discount and the item discounts. + attr_reader :amount_cart_discount + # The amount of item-level discounts applied to the cart. The total discount amount for this session can be computed by summing the cart discount and the item discounts. + attr_reader :amount_items_discount # The applicable fees of the total details. attr_reader :applicable_fees diff --git a/lib/stripe/resources/payment_intent.rb b/lib/stripe/resources/payment_intent.rb index 31464cfbf..11ae802ef 100644 --- a/lib/stripe/resources/payment_intent.rb +++ b/lib/stripe/resources/payment_intent.rb @@ -3459,6 +3459,19 @@ def self.field_remappings @field_remappings = {} end end + + class PaymentsOrchestration < ::Stripe::StripeObject + # Whether this feature is enabled. + attr_reader :enabled + + def self.inner_class_types + @inner_class_types = {} + end + + def self.field_remappings + @field_remappings = {} + end + end # Allocated Funds configuration for this PaymentIntent. attr_reader :allocated_funds # Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). @@ -3573,6 +3586,8 @@ def self.field_remappings attr_reader :transfer_data # A string that identifies the resulting payment as part of a group. Learn more about the [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers). attr_reader :transfer_group + # When you enable this parameter, this PaymentIntent will route your payment to processors that you configure in the dashboard. + attr_reader :payments_orchestration # Manually reconcile the remaining amount for a customer_balance PaymentIntent. def apply_customer_balance(params = {}, opts = {}) @@ -3947,6 +3962,7 @@ def self.inner_class_types processing: Processing, shipping: Shipping, transfer_data: TransferData, + payments_orchestration: PaymentsOrchestration, } end diff --git a/lib/stripe/resources/product_catalog/trial_offer.rb b/lib/stripe/resources/product_catalog/trial_offer.rb new file mode 100644 index 000000000..d441257f2 --- /dev/null +++ b/lib/stripe/resources/product_catalog/trial_offer.rb @@ -0,0 +1,101 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module ProductCatalog + # Resource for the TrialOffer API, used to describe a subscription item's trial period settings. + # Renders a TrialOffer object that describes the price, duration, end_behavior of a trial offer. + class TrialOffer < APIResource + extend Stripe::APIOperations::Create + + OBJECT_NAME = "product_catalog.trial_offer" + def self.object_name + "product_catalog.trial_offer" + end + + class Duration < ::Stripe::StripeObject + class Relative < ::Stripe::StripeObject + # The number of iterations of the price's interval for this trial offer. + attr_reader :iterations + + def self.inner_class_types + @inner_class_types = {} + end + + def self.field_remappings + @field_remappings = {} + end + end + # Attribute for field relative + attr_reader :relative + # The type of trial offer duration. + attr_reader :type + + def self.inner_class_types + @inner_class_types = { relative: Relative } + end + + def self.field_remappings + @field_remappings = {} + end + end + + class EndBehavior < ::Stripe::StripeObject + class Transition < ::Stripe::StripeObject + # The new price to use at the end of the trial offer period. + attr_reader :price + + def self.inner_class_types + @inner_class_types = {} + end + + def self.field_remappings + @field_remappings = {} + end + end + # Attribute for field transition + attr_reader :transition + # The type of behavior when the trial offer ends. + attr_reader :type + + def self.inner_class_types + @inner_class_types = { transition: Transition } + end + + def self.field_remappings + @field_remappings = {} + end + end + # Attribute for field duration + attr_reader :duration + # Attribute for field end_behavior + attr_reader :end_behavior + # Unique identifier for the object. + attr_reader :id + # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + attr_reader :livemode + # String representing the object's type. Objects of the same type share the same value. + attr_reader :object + # The price during the trial offer. + attr_reader :price + + # Creates a trial offer. + def self.create(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: "/v1/product_catalog/trial_offers", + params: params, + opts: opts + ) + end + + def self.inner_class_types + @inner_class_types = { duration: Duration, end_behavior: EndBehavior } + end + + def self.field_remappings + @field_remappings = {} + end + end + end +end diff --git a/lib/stripe/services.rb b/lib/stripe/services.rb index 986c1171b..2ac64f855 100644 --- a/lib/stripe/services.rb +++ b/lib/stripe/services.rb @@ -122,6 +122,8 @@ require "stripe/services/privacy/redaction_job_service" require "stripe/services/privacy/redaction_job_validation_error_service" require "stripe/services/privacy_service" +require "stripe/services/product_catalog/trial_offer_service" +require "stripe/services/product_catalog_service" require "stripe/services/product_feature_service" require "stripe/services/product_service" require "stripe/services/promotion_code_service" diff --git a/lib/stripe/services/product_catalog/trial_offer_service.rb b/lib/stripe/services/product_catalog/trial_offer_service.rb new file mode 100644 index 000000000..8dfbb8b58 --- /dev/null +++ b/lib/stripe/services/product_catalog/trial_offer_service.rb @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module ProductCatalog + class TrialOfferService < StripeService + # Creates a trial offer. + def create(params = {}, opts = {}) + request( + method: :post, + path: "/v1/product_catalog/trial_offers", + params: params, + opts: opts, + base_address: :api + ) + end + end + end +end diff --git a/lib/stripe/services/product_catalog_service.rb b/lib/stripe/services/product_catalog_service.rb new file mode 100644 index 000000000..c9a00385b --- /dev/null +++ b/lib/stripe/services/product_catalog_service.rb @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + class ProductCatalogService < StripeService + attr_reader :trial_offers + + def initialize(requestor) + super + @trial_offers = Stripe::ProductCatalog::TrialOfferService.new(@requestor) + end + end +end diff --git a/lib/stripe/services/v1_services.rb b/lib/stripe/services/v1_services.rb index 189e0c225..8d76f92d0 100644 --- a/lib/stripe/services/v1_services.rb +++ b/lib/stripe/services/v1_services.rb @@ -4,7 +4,7 @@ module Stripe class V1Services < StripeService # v1 accessors: The beginning of the section generated from our OpenAPI spec attr_reader :accounts - attr_reader :account_links, :account_notices, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_settings, :balance_transactions, :balance_transfers, :billing, :billing_portal, :capital, :charges, :checkout, :climate, :confirmation_tokens, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :delegated_checkout, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :external_accounts, :files, :file_links, :financial_connections, :forwarding, :fx_quotes, :identity, :invoices, :invoice_items, :invoice_payments, :invoice_rendering_templates, :issuing, :mandates, :margins, :orders, :payment_attempt_records, :payment_intents, :payment_links, :payment_methods, :payment_method_configurations, :payment_method_domains, :payment_records, :payouts, :plans, :prices, :privacy, :products, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reviews, :setup_attempts, :setup_intents, :shipping_rates, :sigma, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :test_helpers, :tokens, :topups, :transfers, :treasury, :webhook_endpoints + attr_reader :account_links, :account_notices, :account_sessions, :apple_pay_domains, :application_fees, :apps, :balance, :balance_settings, :balance_transactions, :balance_transfers, :billing, :billing_portal, :capital, :charges, :checkout, :climate, :confirmation_tokens, :country_specs, :coupons, :credit_notes, :customers, :customer_sessions, :delegated_checkout, :disputes, :entitlements, :ephemeral_keys, :events, :exchange_rates, :external_accounts, :files, :file_links, :financial_connections, :forwarding, :fx_quotes, :identity, :invoices, :invoice_items, :invoice_payments, :invoice_rendering_templates, :issuing, :mandates, :margins, :orders, :payment_attempt_records, :payment_intents, :payment_links, :payment_methods, :payment_method_configurations, :payment_method_domains, :payment_records, :payouts, :plans, :prices, :privacy, :products, :product_catalog, :promotion_codes, :quotes, :radar, :refunds, :reporting, :reviews, :setup_attempts, :setup_intents, :shipping_rates, :sigma, :sources, :subscriptions, :subscription_items, :subscription_schedules, :tax, :tax_codes, :tax_ids, :tax_rates, :terminal, :test_helpers, :tokens, :topups, :transfers, :treasury, :webhook_endpoints # v1 accessors: The end of the section generated from our OpenAPI spec # OAuthService is manually maintained, as it has special behaviors @@ -69,6 +69,7 @@ def initialize(requestor) @prices = Stripe::PriceService.new(@requestor) @privacy = Stripe::PrivacyService.new(@requestor) @products = Stripe::ProductService.new(@requestor) + @product_catalog = Stripe::ProductCatalogService.new(@requestor) @promotion_codes = Stripe::PromotionCodeService.new(@requestor) @quotes = Stripe::QuoteService.new(@requestor) @radar = Stripe::RadarService.new(@requestor) diff --git a/lib/stripe/stripe_object.rb b/lib/stripe/stripe_object.rb index 7f8fa6175..9389e8800 100644 --- a/lib/stripe/stripe_object.rb +++ b/lib/stripe/stripe_object.rb @@ -171,7 +171,19 @@ def update_attributes(values, opts = {}, dirty: true) end def [](key) - @values[key.to_sym] + key_sym = key.to_sym + return @values[key_sym] if @values.key?(key_sym) + + # super specific one-off case to help users debug this property disappearing + # see also: https://go/j/DEVSDK-2835 + if is_a?(Invoice) && key_sym == :payment_intent + raise KeyError, + "The 'payment_intent' attribute is no longer available on Invoice objects. " \ + "See the docs for more details: https://docs.stripe.com/changelog/basil/2025-03-31/" \ + "add-support-for-multiple-partial-payments-on-invoices#why-is-this-a-breaking-change" + end + + nil end def []=(key, value) @@ -432,6 +444,15 @@ class << self; self; end begin super rescue NoMethodError => e + # super specific one-off case to help users debug this property disappearing + # see also: https://go/j/DEVSDK-2835 + if is_a?(Invoice) && name == :payment_intent + raise NoMethodError, + "The 'payment_intent' attribute is no longer available on Invoice objects. " \ + "See the docs for more details: https://docs.stripe.com/changelog/basil/2025-03-31/" \ + "add-support-for-multiple-partial-payments-on-invoices#why-is-this-a-breaking-change" + end + # If we notice the accessed name of our set of transient values we can # give the user a slightly more helpful error message. If not, just # raise right away. diff --git a/rbi/stripe.rbi b/rbi/stripe.rbi index 997fb08b1..8f56ebae3 100644 --- a/rbi/stripe.rbi +++ b/rbi/stripe.rbi @@ -18097,18 +18097,6 @@ module Stripe # The total before any discounts or taxes are applied. sig { returns(Integer) } def amount_subtotal; end - # The total after discounts but before taxes are applied. - sig { returns(Integer) } - def amount_subtotal_after_discount; end - # The total after discounts and taxes. - sig { returns(Integer) } - def amount_total; end - # The per-unit amount of the item after discounts but before taxes are applied. - sig { returns(Integer) } - def unit_amount_after_discount; end - # The per-unit discount amount. If no discount were applied, defaults to 0. - sig { returns(Integer) } - def unit_discount; end def self.inner_class_types @inner_class_types = {} end @@ -18236,18 +18224,18 @@ module Stripe @field_remappings = {} end end - # The amount discount of the total details. - sig { returns(T.nilable(Integer)) } - def amount_discount; end # The amount fulfillment of the total details. sig { returns(T.nilable(Integer)) } def amount_fulfillment; end # The amount tax of the total details. sig { returns(T.nilable(Integer)) } def amount_tax; end - # Total of all items after discounts but before taxes are applied. + # The amount of order-level discounts applied to the cart. The total discount amount for this session can be computed by summing the cart discount and the item discounts. + sig { returns(T.nilable(Integer)) } + def amount_cart_discount; end + # The amount of item-level discounts applied to the cart. The total discount amount for this session can be computed by summing the cart discount and the item discounts. sig { returns(T.nilable(Integer)) } - def amount_subtotal_after_discount; end + def amount_items_discount; end # The applicable fees of the total details. sig { returns(T.nilable(T::Array[ApplicableFee])) } def applicable_fees; end @@ -33347,6 +33335,17 @@ module Stripe @field_remappings = {} end end + class PaymentsOrchestration < ::Stripe::StripeObject + # Whether this feature is enabled. + sig { returns(T::Boolean) } + def enabled; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end # Allocated Funds configuration for this PaymentIntent. sig { returns(T.nilable(AllocatedFunds)) } def allocated_funds; end @@ -33510,6 +33509,9 @@ module Stripe # A string that identifies the resulting payment as part of a group. Learn more about the [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers). sig { returns(T.nilable(String)) } def transfer_group; end + # When you enable this parameter, this PaymentIntent will route your payment to processors that you configure in the dashboard. + sig { returns(T.nilable(PaymentsOrchestration)) } + def payments_orchestration; end # Manually reconcile the remaining amount for a customer_balance PaymentIntent. sig { params(params: T.any(::Stripe::PaymentIntentApplyCustomerBalanceParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::PaymentIntent) @@ -41885,6 +41887,88 @@ module Stripe end end # typed: true +module Stripe + module ProductCatalog + # Resource for the TrialOffer API, used to describe a subscription item's trial period settings. + # Renders a TrialOffer object that describes the price, duration, end_behavior of a trial offer. + class TrialOffer < APIResource + class Duration < ::Stripe::StripeObject + class Relative < ::Stripe::StripeObject + # The number of iterations of the price's interval for this trial offer. + sig { returns(Integer) } + def iterations; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # Attribute for field relative + sig { returns(Relative) } + def relative; end + # The type of trial offer duration. + sig { returns(String) } + def type; end + def self.inner_class_types + @inner_class_types = {relative: Relative} + end + def self.field_remappings + @field_remappings = {} + end + end + class EndBehavior < ::Stripe::StripeObject + class Transition < ::Stripe::StripeObject + # The new price to use at the end of the trial offer period. + sig { returns(String) } + def price; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # Attribute for field transition + sig { returns(Transition) } + def transition; end + # The type of behavior when the trial offer ends. + sig { returns(String) } + def type; end + def self.inner_class_types + @inner_class_types = {transition: Transition} + end + def self.field_remappings + @field_remappings = {} + end + end + # Attribute for field duration + sig { returns(Duration) } + def duration; end + # Attribute for field end_behavior + sig { returns(EndBehavior) } + def end_behavior; end + # Unique identifier for the object. + sig { returns(String) } + def id; end + # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + sig { returns(T::Boolean) } + def livemode; end + # String representing the object's type. Objects of the same type share the same value. + sig { returns(String) } + def object; end + # The price during the trial offer. + sig { returns(T.any(String, ::Stripe::Price)) } + def price; end + # Creates a trial offer. + sig { + params(params: T.any(::Stripe::ProductCatalog::TrialOfferCreateParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::ProductCatalog::TrialOffer) + } + def self.create(params = {}, opts = {}); end + end + end +end +# typed: true module Stripe # Products describe the specific goods or services you offer to your customers. # For example, you might offer a Standard and Premium version of your goods or service; each version would be a separate Product. @@ -72070,6 +72154,7 @@ module Stripe attr_reader :prices attr_reader :privacy attr_reader :products + attr_reader :product_catalog attr_reader :promotion_codes attr_reader :quotes attr_reader :radar @@ -75388,6 +75473,24 @@ module Stripe end end # typed: true +module Stripe + class ProductCatalogService < StripeService + attr_reader :trial_offers + end +end +# typed: true +module Stripe + module ProductCatalog + class TrialOfferService < StripeService + # Creates a trial offer. + sig { + params(params: T.any(::Stripe::ProductCatalog::TrialOfferCreateParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::ProductCatalog::TrialOffer) + } + def create(params = {}, opts = {}); end + end + end +end +# typed: true module Stripe class PromotionCodeService < StripeService # A promotion code points to an underlying promotion. You can optionally restrict the code to a specific customer, redemption limit, and expiration date. @@ -137383,6 +137486,15 @@ module Stripe zip: nil ); end end + class PaymentsOrchestration < ::Stripe::RequestParams + # Whether this feature is enabled. + sig { returns(T::Boolean) } + def enabled; end + sig { params(_enabled: T::Boolean).returns(T::Boolean) } + def enabled=(_enabled); end + sig { params(enabled: T::Boolean).void } + def initialize(enabled: nil); end + end class RadarOptions < ::Stripe::RequestParams # A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. sig { returns(T.nilable(String)) } @@ -137746,8 +137858,15 @@ module Stripe def use_stripe_sdk; end sig { params(_use_stripe_sdk: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } def use_stripe_sdk=(_use_stripe_sdk); end + # When you enable this parameter, this PaymentIntent will route your payment to processors that you configure in the dashboard. + sig { returns(T.nilable(PaymentIntentCreateParams::PaymentsOrchestration)) } + def payments_orchestration; end sig { - params(allocated_funds: T.nilable(PaymentIntentCreateParams::AllocatedFunds), amount: Integer, amount_details: T.nilable(PaymentIntentCreateParams::AmountDetails), application_fee_amount: T.nilable(Integer), automatic_payment_methods: T.nilable(PaymentIntentCreateParams::AutomaticPaymentMethods), capture_method: T.nilable(String), confirm: T.nilable(T::Boolean), confirmation_method: T.nilable(String), confirmation_token: T.nilable(String), currency: String, customer: T.nilable(String), customer_account: T.nilable(String), description: T.nilable(String), error_on_requires_action: T.nilable(T::Boolean), excluded_payment_method_types: T.nilable(T::Array[String]), expand: T.nilable(T::Array[String]), fx_quote: T.nilable(String), hooks: T.nilable(PaymentIntentCreateParams::Hooks), mandate: T.nilable(String), mandate_data: T.nilable(T.any(String, PaymentIntentCreateParams::MandateData)), metadata: T.nilable(T::Hash[String, String]), off_session: T.nilable(T.any(T::Boolean, String)), on_behalf_of: T.nilable(String), payment_details: T.nilable(PaymentIntentCreateParams::PaymentDetails), payment_method: T.nilable(String), payment_method_configuration: T.nilable(String), payment_method_data: T.nilable(PaymentIntentCreateParams::PaymentMethodData), payment_method_options: T.nilable(PaymentIntentCreateParams::PaymentMethodOptions), payment_method_types: T.nilable(T::Array[String]), radar_options: T.nilable(PaymentIntentCreateParams::RadarOptions), receipt_email: T.nilable(String), return_url: T.nilable(String), secret_key_confirmation: T.nilable(String), setup_future_usage: T.nilable(String), shipping: T.nilable(PaymentIntentCreateParams::Shipping), statement_descriptor: T.nilable(String), statement_descriptor_suffix: T.nilable(String), transfer_data: T.nilable(PaymentIntentCreateParams::TransferData), transfer_group: T.nilable(String), use_stripe_sdk: T.nilable(T::Boolean)).void + params(_payments_orchestration: T.nilable(PaymentIntentCreateParams::PaymentsOrchestration)).returns(T.nilable(PaymentIntentCreateParams::PaymentsOrchestration)) + } + def payments_orchestration=(_payments_orchestration); end + sig { + params(allocated_funds: T.nilable(PaymentIntentCreateParams::AllocatedFunds), amount: Integer, amount_details: T.nilable(PaymentIntentCreateParams::AmountDetails), application_fee_amount: T.nilable(Integer), automatic_payment_methods: T.nilable(PaymentIntentCreateParams::AutomaticPaymentMethods), capture_method: T.nilable(String), confirm: T.nilable(T::Boolean), confirmation_method: T.nilable(String), confirmation_token: T.nilable(String), currency: String, customer: T.nilable(String), customer_account: T.nilable(String), description: T.nilable(String), error_on_requires_action: T.nilable(T::Boolean), excluded_payment_method_types: T.nilable(T::Array[String]), expand: T.nilable(T::Array[String]), fx_quote: T.nilable(String), hooks: T.nilable(PaymentIntentCreateParams::Hooks), mandate: T.nilable(String), mandate_data: T.nilable(T.any(String, PaymentIntentCreateParams::MandateData)), metadata: T.nilable(T::Hash[String, String]), off_session: T.nilable(T.any(T::Boolean, String)), on_behalf_of: T.nilable(String), payment_details: T.nilable(PaymentIntentCreateParams::PaymentDetails), payment_method: T.nilable(String), payment_method_configuration: T.nilable(String), payment_method_data: T.nilable(PaymentIntentCreateParams::PaymentMethodData), payment_method_options: T.nilable(PaymentIntentCreateParams::PaymentMethodOptions), payment_method_types: T.nilable(T::Array[String]), radar_options: T.nilable(PaymentIntentCreateParams::RadarOptions), receipt_email: T.nilable(String), return_url: T.nilable(String), secret_key_confirmation: T.nilable(String), setup_future_usage: T.nilable(String), shipping: T.nilable(PaymentIntentCreateParams::Shipping), statement_descriptor: T.nilable(String), statement_descriptor_suffix: T.nilable(String), transfer_data: T.nilable(PaymentIntentCreateParams::TransferData), transfer_group: T.nilable(String), use_stripe_sdk: T.nilable(T::Boolean), payments_orchestration: T.nilable(PaymentIntentCreateParams::PaymentsOrchestration)).void } def initialize( allocated_funds: nil, @@ -137789,7 +137908,8 @@ module Stripe statement_descriptor_suffix: nil, transfer_data: nil, transfer_group: nil, - use_stripe_sdk: nil + use_stripe_sdk: nil, + payments_orchestration: nil ); end end end @@ -168642,6 +168762,90 @@ module Stripe end end # typed: true +module Stripe + module ProductCatalog + class TrialOfferCreateParams < ::Stripe::RequestParams + class Duration < ::Stripe::RequestParams + class Relative < ::Stripe::RequestParams + # The number of recurring price's interval to apply for the trial period. + sig { returns(Integer) } + def iterations; end + sig { params(_iterations: Integer).returns(Integer) } + def iterations=(_iterations); end + sig { params(iterations: Integer).void } + def initialize(iterations: nil); end + end + # The relative duration of the trial period computed as the number of recurring price intervals. + sig { returns(T.nilable(ProductCatalog::TrialOfferCreateParams::Duration::Relative)) } + def relative; end + sig { + params(_relative: T.nilable(ProductCatalog::TrialOfferCreateParams::Duration::Relative)).returns(T.nilable(ProductCatalog::TrialOfferCreateParams::Duration::Relative)) + } + def relative=(_relative); end + # Specifies how the trial offer duration is determined. + sig { returns(String) } + def type; end + sig { params(_type: String).returns(String) } + def type=(_type); end + sig { + params(relative: T.nilable(ProductCatalog::TrialOfferCreateParams::Duration::Relative), type: String).void + } + def initialize(relative: nil, type: nil); end + end + class EndBehavior < ::Stripe::RequestParams + class Transition < ::Stripe::RequestParams + # The price to transition the recurring item to when the trial offer ends. + sig { returns(String) } + def price; end + sig { params(_price: String).returns(String) } + def price=(_price); end + sig { params(price: String).void } + def initialize(price: nil); end + end + # The transition to apply when the trial offer ends. + sig { returns(ProductCatalog::TrialOfferCreateParams::EndBehavior::Transition) } + def transition; end + sig { + params(_transition: ProductCatalog::TrialOfferCreateParams::EndBehavior::Transition).returns(ProductCatalog::TrialOfferCreateParams::EndBehavior::Transition) + } + def transition=(_transition); end + sig { + params(transition: ProductCatalog::TrialOfferCreateParams::EndBehavior::Transition).void + } + def initialize(transition: nil); end + end + # Duration of one service period of the trial. + sig { returns(ProductCatalog::TrialOfferCreateParams::Duration) } + def duration; end + sig { + params(_duration: ProductCatalog::TrialOfferCreateParams::Duration).returns(ProductCatalog::TrialOfferCreateParams::Duration) + } + def duration=(_duration); end + # Define behavior that occurs at the end of the trial. + sig { returns(ProductCatalog::TrialOfferCreateParams::EndBehavior) } + def end_behavior; end + sig { + params(_end_behavior: ProductCatalog::TrialOfferCreateParams::EndBehavior).returns(ProductCatalog::TrialOfferCreateParams::EndBehavior) + } + def end_behavior=(_end_behavior); end + # Specifies which fields in the response should be expanded. + sig { returns(T.nilable(T::Array[String])) } + def expand; end + sig { params(_expand: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def expand=(_expand); end + # Price configuration during the trial period (amount, billing scheme, etc). + sig { returns(String) } + def price; end + sig { params(_price: String).returns(String) } + def price=(_price); end + sig { + params(duration: ProductCatalog::TrialOfferCreateParams::Duration, end_behavior: ProductCatalog::TrialOfferCreateParams::EndBehavior, expand: T.nilable(T::Array[String]), price: String).void + } + def initialize(duration: nil, end_behavior: nil, expand: nil, price: nil); end + end + end +end +# typed: true module Stripe class ProductDeleteParams < ::Stripe::RequestParams; end end diff --git a/rbi/stripe/params/payment_intent_create_params.rbi b/rbi/stripe/params/payment_intent_create_params.rbi index 07b00424e..db235a5e3 100644 --- a/rbi/stripe/params/payment_intent_create_params.rbi +++ b/rbi/stripe/params/payment_intent_create_params.rbi @@ -8339,6 +8339,15 @@ module Stripe zip: nil ); end end + class PaymentsOrchestration < ::Stripe::RequestParams + # Whether this feature is enabled. + sig { returns(T::Boolean) } + def enabled; end + sig { params(_enabled: T::Boolean).returns(T::Boolean) } + def enabled=(_enabled); end + sig { params(enabled: T::Boolean).void } + def initialize(enabled: nil); end + end class RadarOptions < ::Stripe::RequestParams # A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. sig { returns(T.nilable(String)) } @@ -8702,8 +8711,15 @@ module Stripe def use_stripe_sdk; end sig { params(_use_stripe_sdk: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } def use_stripe_sdk=(_use_stripe_sdk); end + # When you enable this parameter, this PaymentIntent will route your payment to processors that you configure in the dashboard. + sig { returns(T.nilable(PaymentIntentCreateParams::PaymentsOrchestration)) } + def payments_orchestration; end + sig { + params(_payments_orchestration: T.nilable(PaymentIntentCreateParams::PaymentsOrchestration)).returns(T.nilable(PaymentIntentCreateParams::PaymentsOrchestration)) + } + def payments_orchestration=(_payments_orchestration); end sig { - params(allocated_funds: T.nilable(PaymentIntentCreateParams::AllocatedFunds), amount: Integer, amount_details: T.nilable(PaymentIntentCreateParams::AmountDetails), application_fee_amount: T.nilable(Integer), automatic_payment_methods: T.nilable(PaymentIntentCreateParams::AutomaticPaymentMethods), capture_method: T.nilable(String), confirm: T.nilable(T::Boolean), confirmation_method: T.nilable(String), confirmation_token: T.nilable(String), currency: String, customer: T.nilable(String), customer_account: T.nilable(String), description: T.nilable(String), error_on_requires_action: T.nilable(T::Boolean), excluded_payment_method_types: T.nilable(T::Array[String]), expand: T.nilable(T::Array[String]), fx_quote: T.nilable(String), hooks: T.nilable(PaymentIntentCreateParams::Hooks), mandate: T.nilable(String), mandate_data: T.nilable(T.any(String, PaymentIntentCreateParams::MandateData)), metadata: T.nilable(T::Hash[String, String]), off_session: T.nilable(T.any(T::Boolean, String)), on_behalf_of: T.nilable(String), payment_details: T.nilable(PaymentIntentCreateParams::PaymentDetails), payment_method: T.nilable(String), payment_method_configuration: T.nilable(String), payment_method_data: T.nilable(PaymentIntentCreateParams::PaymentMethodData), payment_method_options: T.nilable(PaymentIntentCreateParams::PaymentMethodOptions), payment_method_types: T.nilable(T::Array[String]), radar_options: T.nilable(PaymentIntentCreateParams::RadarOptions), receipt_email: T.nilable(String), return_url: T.nilable(String), secret_key_confirmation: T.nilable(String), setup_future_usage: T.nilable(String), shipping: T.nilable(PaymentIntentCreateParams::Shipping), statement_descriptor: T.nilable(String), statement_descriptor_suffix: T.nilable(String), transfer_data: T.nilable(PaymentIntentCreateParams::TransferData), transfer_group: T.nilable(String), use_stripe_sdk: T.nilable(T::Boolean)).void + params(allocated_funds: T.nilable(PaymentIntentCreateParams::AllocatedFunds), amount: Integer, amount_details: T.nilable(PaymentIntentCreateParams::AmountDetails), application_fee_amount: T.nilable(Integer), automatic_payment_methods: T.nilable(PaymentIntentCreateParams::AutomaticPaymentMethods), capture_method: T.nilable(String), confirm: T.nilable(T::Boolean), confirmation_method: T.nilable(String), confirmation_token: T.nilable(String), currency: String, customer: T.nilable(String), customer_account: T.nilable(String), description: T.nilable(String), error_on_requires_action: T.nilable(T::Boolean), excluded_payment_method_types: T.nilable(T::Array[String]), expand: T.nilable(T::Array[String]), fx_quote: T.nilable(String), hooks: T.nilable(PaymentIntentCreateParams::Hooks), mandate: T.nilable(String), mandate_data: T.nilable(T.any(String, PaymentIntentCreateParams::MandateData)), metadata: T.nilable(T::Hash[String, String]), off_session: T.nilable(T.any(T::Boolean, String)), on_behalf_of: T.nilable(String), payment_details: T.nilable(PaymentIntentCreateParams::PaymentDetails), payment_method: T.nilable(String), payment_method_configuration: T.nilable(String), payment_method_data: T.nilable(PaymentIntentCreateParams::PaymentMethodData), payment_method_options: T.nilable(PaymentIntentCreateParams::PaymentMethodOptions), payment_method_types: T.nilable(T::Array[String]), radar_options: T.nilable(PaymentIntentCreateParams::RadarOptions), receipt_email: T.nilable(String), return_url: T.nilable(String), secret_key_confirmation: T.nilable(String), setup_future_usage: T.nilable(String), shipping: T.nilable(PaymentIntentCreateParams::Shipping), statement_descriptor: T.nilable(String), statement_descriptor_suffix: T.nilable(String), transfer_data: T.nilable(PaymentIntentCreateParams::TransferData), transfer_group: T.nilable(String), use_stripe_sdk: T.nilable(T::Boolean), payments_orchestration: T.nilable(PaymentIntentCreateParams::PaymentsOrchestration)).void } def initialize( allocated_funds: nil, @@ -8745,7 +8761,8 @@ module Stripe statement_descriptor_suffix: nil, transfer_data: nil, transfer_group: nil, - use_stripe_sdk: nil + use_stripe_sdk: nil, + payments_orchestration: nil ); end end end \ No newline at end of file diff --git a/rbi/stripe/params/product_catalog/trial_offer_create_params.rbi b/rbi/stripe/params/product_catalog/trial_offer_create_params.rbi new file mode 100644 index 000000000..bbc660816 --- /dev/null +++ b/rbi/stripe/params/product_catalog/trial_offer_create_params.rbi @@ -0,0 +1,87 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module ProductCatalog + class TrialOfferCreateParams < ::Stripe::RequestParams + class Duration < ::Stripe::RequestParams + class Relative < ::Stripe::RequestParams + # The number of recurring price's interval to apply for the trial period. + sig { returns(Integer) } + def iterations; end + sig { params(_iterations: Integer).returns(Integer) } + def iterations=(_iterations); end + sig { params(iterations: Integer).void } + def initialize(iterations: nil); end + end + # The relative duration of the trial period computed as the number of recurring price intervals. + sig { returns(T.nilable(ProductCatalog::TrialOfferCreateParams::Duration::Relative)) } + def relative; end + sig { + params(_relative: T.nilable(ProductCatalog::TrialOfferCreateParams::Duration::Relative)).returns(T.nilable(ProductCatalog::TrialOfferCreateParams::Duration::Relative)) + } + def relative=(_relative); end + # Specifies how the trial offer duration is determined. + sig { returns(String) } + def type; end + sig { params(_type: String).returns(String) } + def type=(_type); end + sig { + params(relative: T.nilable(ProductCatalog::TrialOfferCreateParams::Duration::Relative), type: String).void + } + def initialize(relative: nil, type: nil); end + end + class EndBehavior < ::Stripe::RequestParams + class Transition < ::Stripe::RequestParams + # The price to transition the recurring item to when the trial offer ends. + sig { returns(String) } + def price; end + sig { params(_price: String).returns(String) } + def price=(_price); end + sig { params(price: String).void } + def initialize(price: nil); end + end + # The transition to apply when the trial offer ends. + sig { returns(ProductCatalog::TrialOfferCreateParams::EndBehavior::Transition) } + def transition; end + sig { + params(_transition: ProductCatalog::TrialOfferCreateParams::EndBehavior::Transition).returns(ProductCatalog::TrialOfferCreateParams::EndBehavior::Transition) + } + def transition=(_transition); end + sig { + params(transition: ProductCatalog::TrialOfferCreateParams::EndBehavior::Transition).void + } + def initialize(transition: nil); end + end + # Duration of one service period of the trial. + sig { returns(ProductCatalog::TrialOfferCreateParams::Duration) } + def duration; end + sig { + params(_duration: ProductCatalog::TrialOfferCreateParams::Duration).returns(ProductCatalog::TrialOfferCreateParams::Duration) + } + def duration=(_duration); end + # Define behavior that occurs at the end of the trial. + sig { returns(ProductCatalog::TrialOfferCreateParams::EndBehavior) } + def end_behavior; end + sig { + params(_end_behavior: ProductCatalog::TrialOfferCreateParams::EndBehavior).returns(ProductCatalog::TrialOfferCreateParams::EndBehavior) + } + def end_behavior=(_end_behavior); end + # Specifies which fields in the response should be expanded. + sig { returns(T.nilable(T::Array[String])) } + def expand; end + sig { params(_expand: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def expand=(_expand); end + # Price configuration during the trial period (amount, billing scheme, etc). + sig { returns(String) } + def price; end + sig { params(_price: String).returns(String) } + def price=(_price); end + sig { + params(duration: ProductCatalog::TrialOfferCreateParams::Duration, end_behavior: ProductCatalog::TrialOfferCreateParams::EndBehavior, expand: T.nilable(T::Array[String]), price: String).void + } + def initialize(duration: nil, end_behavior: nil, expand: nil, price: nil); end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/resources/delegated_checkout/requested_session.rbi b/rbi/stripe/resources/delegated_checkout/requested_session.rbi index d42a1721e..40dac9b9a 100644 --- a/rbi/stripe/resources/delegated_checkout/requested_session.rbi +++ b/rbi/stripe/resources/delegated_checkout/requested_session.rbi @@ -166,18 +166,6 @@ module Stripe # The total before any discounts or taxes are applied. sig { returns(Integer) } def amount_subtotal; end - # The total after discounts but before taxes are applied. - sig { returns(Integer) } - def amount_subtotal_after_discount; end - # The total after discounts and taxes. - sig { returns(Integer) } - def amount_total; end - # The per-unit amount of the item after discounts but before taxes are applied. - sig { returns(Integer) } - def unit_amount_after_discount; end - # The per-unit discount amount. If no discount were applied, defaults to 0. - sig { returns(Integer) } - def unit_discount; end def self.inner_class_types @inner_class_types = {} end @@ -305,18 +293,18 @@ module Stripe @field_remappings = {} end end - # The amount discount of the total details. - sig { returns(T.nilable(Integer)) } - def amount_discount; end # The amount fulfillment of the total details. sig { returns(T.nilable(Integer)) } def amount_fulfillment; end # The amount tax of the total details. sig { returns(T.nilable(Integer)) } def amount_tax; end - # Total of all items after discounts but before taxes are applied. + # The amount of order-level discounts applied to the cart. The total discount amount for this session can be computed by summing the cart discount and the item discounts. + sig { returns(T.nilable(Integer)) } + def amount_cart_discount; end + # The amount of item-level discounts applied to the cart. The total discount amount for this session can be computed by summing the cart discount and the item discounts. sig { returns(T.nilable(Integer)) } - def amount_subtotal_after_discount; end + def amount_items_discount; end # The applicable fees of the total details. sig { returns(T.nilable(T::Array[ApplicableFee])) } def applicable_fees; end diff --git a/rbi/stripe/resources/payment_intent.rbi b/rbi/stripe/resources/payment_intent.rbi index 24bf3267e..439dc744d 100644 --- a/rbi/stripe/resources/payment_intent.rbi +++ b/rbi/stripe/resources/payment_intent.rbi @@ -3629,6 +3629,17 @@ module Stripe @field_remappings = {} end end + class PaymentsOrchestration < ::Stripe::StripeObject + # Whether this feature is enabled. + sig { returns(T::Boolean) } + def enabled; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end # Allocated Funds configuration for this PaymentIntent. sig { returns(T.nilable(AllocatedFunds)) } def allocated_funds; end @@ -3792,6 +3803,9 @@ module Stripe # A string that identifies the resulting payment as part of a group. Learn more about the [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers). sig { returns(T.nilable(String)) } def transfer_group; end + # When you enable this parameter, this PaymentIntent will route your payment to processors that you configure in the dashboard. + sig { returns(T.nilable(PaymentsOrchestration)) } + def payments_orchestration; end # Manually reconcile the remaining amount for a customer_balance PaymentIntent. sig { params(params: T.any(::Stripe::PaymentIntentApplyCustomerBalanceParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::PaymentIntent) diff --git a/rbi/stripe/resources/product_catalog/trial_offer.rbi b/rbi/stripe/resources/product_catalog/trial_offer.rbi new file mode 100644 index 000000000..707bbefd8 --- /dev/null +++ b/rbi/stripe/resources/product_catalog/trial_offer.rbi @@ -0,0 +1,85 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module ProductCatalog + # Resource for the TrialOffer API, used to describe a subscription item's trial period settings. + # Renders a TrialOffer object that describes the price, duration, end_behavior of a trial offer. + class TrialOffer < APIResource + class Duration < ::Stripe::StripeObject + class Relative < ::Stripe::StripeObject + # The number of iterations of the price's interval for this trial offer. + sig { returns(Integer) } + def iterations; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # Attribute for field relative + sig { returns(Relative) } + def relative; end + # The type of trial offer duration. + sig { returns(String) } + def type; end + def self.inner_class_types + @inner_class_types = {relative: Relative} + end + def self.field_remappings + @field_remappings = {} + end + end + class EndBehavior < ::Stripe::StripeObject + class Transition < ::Stripe::StripeObject + # The new price to use at the end of the trial offer period. + sig { returns(String) } + def price; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # Attribute for field transition + sig { returns(Transition) } + def transition; end + # The type of behavior when the trial offer ends. + sig { returns(String) } + def type; end + def self.inner_class_types + @inner_class_types = {transition: Transition} + end + def self.field_remappings + @field_remappings = {} + end + end + # Attribute for field duration + sig { returns(Duration) } + def duration; end + # Attribute for field end_behavior + sig { returns(EndBehavior) } + def end_behavior; end + # Unique identifier for the object. + sig { returns(String) } + def id; end + # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + sig { returns(T::Boolean) } + def livemode; end + # String representing the object's type. Objects of the same type share the same value. + sig { returns(String) } + def object; end + # The price during the trial offer. + sig { returns(T.any(String, ::Stripe::Price)) } + def price; end + # Creates a trial offer. + sig { + params(params: T.any(::Stripe::ProductCatalog::TrialOfferCreateParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::ProductCatalog::TrialOffer) + } + def self.create(params = {}, opts = {}); end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/services/product_catalog/trial_offer_service.rbi b/rbi/stripe/services/product_catalog/trial_offer_service.rbi new file mode 100644 index 000000000..098310815 --- /dev/null +++ b/rbi/stripe/services/product_catalog/trial_offer_service.rbi @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module ProductCatalog + class TrialOfferService < StripeService + # Creates a trial offer. + sig { + params(params: T.any(::Stripe::ProductCatalog::TrialOfferCreateParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::ProductCatalog::TrialOffer) + } + def create(params = {}, opts = {}); end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/services/product_catalog_service.rbi b/rbi/stripe/services/product_catalog_service.rbi new file mode 100644 index 000000000..32a812b39 --- /dev/null +++ b/rbi/stripe/services/product_catalog_service.rbi @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + class ProductCatalogService < StripeService + attr_reader :trial_offers + end +end \ No newline at end of file diff --git a/rbi/stripe/services/v1_services.rbi b/rbi/stripe/services/v1_services.rbi index f47095c73..5f600ac76 100644 --- a/rbi/stripe/services/v1_services.rbi +++ b/rbi/stripe/services/v1_services.rbi @@ -60,6 +60,7 @@ module Stripe attr_reader :prices attr_reader :privacy attr_reader :products + attr_reader :product_catalog attr_reader :promotion_codes attr_reader :quotes attr_reader :radar diff --git a/test/stripe/stripe_object_test.rb b/test/stripe/stripe_object_test.rb index 7a5b8d548..2b192fa09 100644 --- a/test/stripe/stripe_object_test.rb +++ b/test/stripe/stripe_object_test.rb @@ -785,5 +785,44 @@ class WithAdditiveObjectParam < Stripe::StripeObject # rubocop:todo Lint/Constan assert account.company.is_a?(Stripe::Account::Company) if account.respond_to?(:company) && account.company end end + + should "raise special error for Invoice.payment_intent" do + is_good_error = lambda do |e| + e.message.include?("multiple-partial-payments-on-invoices") + end + + i = Stripe::Invoice.construct_from({}) + + # Test attribute access + e = assert_raises(NoMethodError) do + i.payment_intent + end + assert is_good_error.call(e) + + # Test hash access + e = assert_raises(KeyError) do + i[:payment_intent] + end + assert is_good_error.call(e) + + # Only that property gets the special error + e = assert_raises(NoMethodError) do + i.blah + end + assert !is_good_error.call(e) + + # Other properties don't get the special error with hash access + assert_nil i[:blah] + + # Other classes don't have that special error + so = Stripe::StripeObject.construct_from({}) + e = assert_raises(NoMethodError) do + so.payment_intent + end + assert !is_good_error.call(e) + + # Hash access on non-Invoice objects returns nil + assert_nil so[:payment_intent] + end end end