Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 19.5.0 - 2026-08-10
* [#1932](https://github.com/stripe/stripe-ruby/pull/1932) Handle break in auto-paging blocks
- Rescues `LocalJumpError` to prevent crash when calling `break` inside an `auto_paging_each`
* [#1927](https://github.com/stripe/stripe-ruby/pull/1927) Surface `object` property on `EventNotification`
* [#1918](https://github.com/stripe/stripe-ruby/pull/1918) add/adjust event parsing helpers

- Added methods that return their respective `Event`/`EventNotification` class instances without verifying authenticity. Use them when you've previously verified an event (e.g. you verified, put the event in a queue, and are now processing). Supports events from [AWS EventBridge](https://docs.stripe.com/event-destinations/eventbridge) and [Azure Event Grid](https://docs.stripe.com/event-destinations/eventgrid) natively.
- `Webhook#construct_event_without_verification(payload)`
- `StripeClient#parse_event_notification_without_verification(payload)`
* [#1924](https://github.com/stripe/stripe-ruby/pull/1924) Discard the connection when a request is interrupted
- Fix connection reuse after a request is interrupted by a non-StandardError exception (e.g. from rack-timeout), which could cause subsequent requests to receive a previous request's response

## 19.5.0-alpha.2 - 2026-08-05
* [#1920](https://github.com/stripe/stripe-ruby/pull/1920) Update generated code for private-preview
* Add support for new resource `Billing::FeedbackOptions`
Expand Down
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
85839f80afcaccd622aa30bf53a414cdffbd57bc
1e95a9c21695d1f28bf9bf64ed7c83a05749b1e8
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2369
v2396
1 change: 1 addition & 0 deletions lib/stripe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
require "stripe/object_types"
require "stripe/event_types"
require "stripe/request_options"
require "stripe/v2_type_coercion"
require "stripe/request_params"
require "stripe/stripe_context"
require "stripe/util"
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/api_requestor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,8 @@ def self.maybe_gc_connection_managers
FinancialAccountNotOpenError.new(error_data[:message], **opts)
when "fx_quote_expired"
FxQuoteExpiredError.new(error_data[:message], **opts)
when "fx_quote_needs_refresh"
FxQuoteNeedsRefreshError.new(error_data[:message], **opts)
when "insufficient_funds"
InsufficientFundsError.new(error_data[:message], **opts)
when "invalid_payment_method"
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/api_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Stripe
module ApiVersion
CURRENT = "2026-07-29.preview"
CURRENT = "2026-08-12.preview"
CURRENT_MAJOR = ""
end
end
3 changes: 3 additions & 0 deletions lib/stripe/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ class FinancialAccountNotOpenError < StripeError
class FxQuoteExpiredError < StripeError
end

class FxQuoteNeedsRefreshError < StripeError
end

class InsufficientFundsError < StripeError
end

Expand Down
49 changes: 49 additions & 0 deletions lib/stripe/event_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,19 @@ def self.v2_event_types_to_classes
Events::V1ApplicationFeeRefundUpdatedEvent,
Events::V1ApplicationFeeRefundedEvent.lookup_type => Events::V1ApplicationFeeRefundedEvent,
Events::V1BalanceAvailableEvent.lookup_type => Events::V1BalanceAvailableEvent,
Events::V1BalanceSettingsUpdatedEvent.lookup_type => Events::V1BalanceSettingsUpdatedEvent,
Events::V1BillingAlertTriggeredEvent.lookup_type => Events::V1BillingAlertTriggeredEvent,
Events::V1BillingCreditBalanceTransactionCreatedEvent.lookup_type =>
Events::V1BillingCreditBalanceTransactionCreatedEvent,
Events::V1BillingCreditGrantCreatedEvent.lookup_type => Events::V1BillingCreditGrantCreatedEvent,
Events::V1BillingCreditGrantUpdatedEvent.lookup_type => Events::V1BillingCreditGrantUpdatedEvent,
Events::V1BillingMeterCreatedEvent.lookup_type => Events::V1BillingMeterCreatedEvent,
Events::V1BillingMeterDeactivatedEvent.lookup_type => Events::V1BillingMeterDeactivatedEvent,
Events::V1BillingMeterErrorReportTriggeredEvent.lookup_type =>
Events::V1BillingMeterErrorReportTriggeredEvent,
Events::V1BillingMeterNoMeterFoundEvent.lookup_type => Events::V1BillingMeterNoMeterFoundEvent,
Events::V1BillingMeterReactivatedEvent.lookup_type => Events::V1BillingMeterReactivatedEvent,
Events::V1BillingMeterUpdatedEvent.lookup_type => Events::V1BillingMeterUpdatedEvent,
Events::V1BillingPortalConfigurationCreatedEvent.lookup_type =>
Events::V1BillingPortalConfigurationCreatedEvent,
Events::V1BillingPortalConfigurationUpdatedEvent.lookup_type =>
Expand Down Expand Up @@ -97,12 +106,16 @@ def self.v2_event_types_to_classes
Events::V1EntitlementsActiveEntitlementSummaryUpdatedEvent.lookup_type =>
Events::V1EntitlementsActiveEntitlementSummaryUpdatedEvent,
Events::V1FileCreatedEvent.lookup_type => Events::V1FileCreatedEvent,
Events::V1FinancialConnectionsAccountAccountNumbersUpdatedEvent.lookup_type =>
Events::V1FinancialConnectionsAccountAccountNumbersUpdatedEvent,
Events::V1FinancialConnectionsAccountCreatedEvent.lookup_type =>
Events::V1FinancialConnectionsAccountCreatedEvent,
Events::V1FinancialConnectionsAccountDeactivatedEvent.lookup_type =>
Events::V1FinancialConnectionsAccountDeactivatedEvent,
Events::V1FinancialConnectionsAccountDisconnectedEvent.lookup_type =>
Events::V1FinancialConnectionsAccountDisconnectedEvent,
Events::V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent.lookup_type =>
Events::V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEvent,
Events::V1FinancialConnectionsAccountReactivatedEvent.lookup_type =>
Events::V1FinancialConnectionsAccountReactivatedEvent,
Events::V1FinancialConnectionsAccountRefreshedBalanceEvent.lookup_type =>
Expand All @@ -111,6 +124,12 @@ def self.v2_event_types_to_classes
Events::V1FinancialConnectionsAccountRefreshedOwnershipEvent,
Events::V1FinancialConnectionsAccountRefreshedTransactionsEvent.lookup_type =>
Events::V1FinancialConnectionsAccountRefreshedTransactionsEvent,
Events::V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent.lookup_type =>
Events::V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEvent,
Events::V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent.lookup_type =>
Events::V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEvent,
Events::V1FinancialConnectionsAccountUpcomingDeactivationEvent.lookup_type =>
Events::V1FinancialConnectionsAccountUpcomingDeactivationEvent,
Events::V1IdentityVerificationSessionCanceledEvent.lookup_type =>
Events::V1IdentityVerificationSessionCanceledEvent,
Events::V1IdentityVerificationSessionCreatedEvent.lookup_type =>
Expand All @@ -133,6 +152,8 @@ def self.v2_event_types_to_classes
Events::V1InvoicePaidEvent.lookup_type => Events::V1InvoicePaidEvent,
Events::V1InvoicePaymentActionRequiredEvent.lookup_type =>
Events::V1InvoicePaymentActionRequiredEvent,
Events::V1InvoicePaymentAttemptRequiredEvent.lookup_type =>
Events::V1InvoicePaymentAttemptRequiredEvent,
Events::V1InvoicePaymentFailedEvent.lookup_type => Events::V1InvoicePaymentFailedEvent,
Events::V1InvoicePaymentPaidEvent.lookup_type => Events::V1InvoicePaymentPaidEvent,
Events::V1InvoicePaymentSucceededEvent.lookup_type => Events::V1InvoicePaymentSucceededEvent,
Expand Down Expand Up @@ -703,12 +724,28 @@ def self.event_notification_types_to_classes
Events::V1ApplicationFeeRefundedEventNotification,
Events::V1BalanceAvailableEventNotification.lookup_type =>
Events::V1BalanceAvailableEventNotification,
Events::V1BalanceSettingsUpdatedEventNotification.lookup_type =>
Events::V1BalanceSettingsUpdatedEventNotification,
Events::V1BillingAlertTriggeredEventNotification.lookup_type =>
Events::V1BillingAlertTriggeredEventNotification,
Events::V1BillingCreditBalanceTransactionCreatedEventNotification.lookup_type =>
Events::V1BillingCreditBalanceTransactionCreatedEventNotification,
Events::V1BillingCreditGrantCreatedEventNotification.lookup_type =>
Events::V1BillingCreditGrantCreatedEventNotification,
Events::V1BillingCreditGrantUpdatedEventNotification.lookup_type =>
Events::V1BillingCreditGrantUpdatedEventNotification,
Events::V1BillingMeterCreatedEventNotification.lookup_type =>
Events::V1BillingMeterCreatedEventNotification,
Events::V1BillingMeterDeactivatedEventNotification.lookup_type =>
Events::V1BillingMeterDeactivatedEventNotification,
Events::V1BillingMeterErrorReportTriggeredEventNotification.lookup_type =>
Events::V1BillingMeterErrorReportTriggeredEventNotification,
Events::V1BillingMeterNoMeterFoundEventNotification.lookup_type =>
Events::V1BillingMeterNoMeterFoundEventNotification,
Events::V1BillingMeterReactivatedEventNotification.lookup_type =>
Events::V1BillingMeterReactivatedEventNotification,
Events::V1BillingMeterUpdatedEventNotification.lookup_type =>
Events::V1BillingMeterUpdatedEventNotification,
Events::V1BillingPortalConfigurationCreatedEventNotification.lookup_type =>
Events::V1BillingPortalConfigurationCreatedEventNotification,
Events::V1BillingPortalConfigurationUpdatedEventNotification.lookup_type =>
Expand Down Expand Up @@ -803,12 +840,16 @@ def self.event_notification_types_to_classes
Events::V1EntitlementsActiveEntitlementSummaryUpdatedEventNotification.lookup_type =>
Events::V1EntitlementsActiveEntitlementSummaryUpdatedEventNotification,
Events::V1FileCreatedEventNotification.lookup_type => Events::V1FileCreatedEventNotification,
Events::V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountAccountNumbersUpdatedEventNotification,
Events::V1FinancialConnectionsAccountCreatedEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountCreatedEventNotification,
Events::V1FinancialConnectionsAccountDeactivatedEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountDeactivatedEventNotification,
Events::V1FinancialConnectionsAccountDisconnectedEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountDisconnectedEventNotification,
Events::V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountExpectedDeactivationDateUpdatedEventNotification,
Events::V1FinancialConnectionsAccountReactivatedEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountReactivatedEventNotification,
Events::V1FinancialConnectionsAccountRefreshedBalanceEventNotification.lookup_type =>
Expand All @@ -817,6 +858,12 @@ def self.event_notification_types_to_classes
Events::V1FinancialConnectionsAccountRefreshedOwnershipEventNotification,
Events::V1FinancialConnectionsAccountRefreshedTransactionsEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountRefreshedTransactionsEventNotification,
Events::V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountSupportedPaymentMethodTypesUpdatedEventNotification,
Events::V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountUpcomingAccountNumberExpiryEventNotification,
Events::V1FinancialConnectionsAccountUpcomingDeactivationEventNotification.lookup_type =>
Events::V1FinancialConnectionsAccountUpcomingDeactivationEventNotification,
Events::V1IdentityVerificationSessionCanceledEventNotification.lookup_type =>
Events::V1IdentityVerificationSessionCanceledEventNotification,
Events::V1IdentityVerificationSessionCreatedEventNotification.lookup_type =>
Expand All @@ -843,6 +890,8 @@ def self.event_notification_types_to_classes
Events::V1InvoicePaidEventNotification.lookup_type => Events::V1InvoicePaidEventNotification,
Events::V1InvoicePaymentActionRequiredEventNotification.lookup_type =>
Events::V1InvoicePaymentActionRequiredEventNotification,
Events::V1InvoicePaymentAttemptRequiredEventNotification.lookup_type =>
Events::V1InvoicePaymentAttemptRequiredEventNotification,
Events::V1InvoicePaymentFailedEventNotification.lookup_type =>
Events::V1InvoicePaymentFailedEventNotification,
Events::V1InvoicePaymentPaidEventNotification.lookup_type =>
Expand Down
44 changes: 44 additions & 0 deletions lib/stripe/events/v1_balance_settings_updated_event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Events
# Occurs whenever a balance settings status or property has changed.
class V1BalanceSettingsUpdatedEvent < Stripe::V2::Core::Event
def self.lookup_type
"v1.balance_settings.updated"
end

# Retrieves the related object from the API. Makes an API request on every call.
def fetch_related_object
_request(
method: :get,
path: related_object.url,
base_address: :api,
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
)
end
attr_reader :related_object
end

# Occurs whenever a balance settings status or property has changed.
class V1BalanceSettingsUpdatedEventNotification < Stripe::V2::Core::EventNotification
def self.lookup_type
"v1.balance_settings.updated"
end

attr_reader :related_object

# Retrieves the BalanceSettings related to this EventNotification from the Stripe API. Makes an API request on every call.
def fetch_related_object
resp = @client.raw_request(
:get,
related_object.url,
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
usage: ["fetch_related_object"]
)
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Events
# Occurs when a credit balance transaction is created.
class V1BillingCreditBalanceTransactionCreatedEvent < Stripe::V2::Core::Event
def self.lookup_type
"v1.billing.credit_balance_transaction.created"
end

# Retrieves the related object from the API. Makes an API request on every call.
def fetch_related_object
_request(
method: :get,
path: related_object.url,
base_address: :api,
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
)
end
attr_reader :related_object
end

# Occurs when a credit balance transaction is created.
class V1BillingCreditBalanceTransactionCreatedEventNotification < Stripe::V2::Core::EventNotification
def self.lookup_type
"v1.billing.credit_balance_transaction.created"
end

attr_reader :related_object

# Retrieves the CreditBalanceTransaction related to this EventNotification from the Stripe API. Makes an API request on every call.
def fetch_related_object
resp = @client.raw_request(
:get,
related_object.url,
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
usage: ["fetch_related_object"]
)
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
end
end
end
end
44 changes: 44 additions & 0 deletions lib/stripe/events/v1_billing_credit_grant_created_event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Events
# Occurs when a credit grant is created.
class V1BillingCreditGrantCreatedEvent < Stripe::V2::Core::Event
def self.lookup_type
"v1.billing.credit_grant.created"
end

# Retrieves the related object from the API. Makes an API request on every call.
def fetch_related_object
_request(
method: :get,
path: related_object.url,
base_address: :api,
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
)
end
attr_reader :related_object
end

# Occurs when a credit grant is created.
class V1BillingCreditGrantCreatedEventNotification < Stripe::V2::Core::EventNotification
def self.lookup_type
"v1.billing.credit_grant.created"
end

attr_reader :related_object

# Retrieves the CreditGrant related to this EventNotification from the Stripe API. Makes an API request on every call.
def fetch_related_object
resp = @client.raw_request(
:get,
related_object.url,
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
usage: ["fetch_related_object"]
)
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
end
end
end
end
44 changes: 44 additions & 0 deletions lib/stripe/events/v1_billing_credit_grant_updated_event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Events
# Occurs when a credit grant is updated.
class V1BillingCreditGrantUpdatedEvent < Stripe::V2::Core::Event
def self.lookup_type
"v1.billing.credit_grant.updated"
end

# Retrieves the related object from the API. Makes an API request on every call.
def fetch_related_object
_request(
method: :get,
path: related_object.url,
base_address: :api,
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
)
end
attr_reader :related_object
end

# Occurs when a credit grant is updated.
class V1BillingCreditGrantUpdatedEventNotification < Stripe::V2::Core::EventNotification
def self.lookup_type
"v1.billing.credit_grant.updated"
end

attr_reader :related_object

# Retrieves the CreditGrant related to this EventNotification from the Stripe API. Makes an API request on every call.
def fetch_related_object
resp = @client.raw_request(
:get,
related_object.url,
opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
usage: ["fetch_related_object"]
)
@client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
end
end
end
end
Loading
Loading