Skip to content

fix(payments): Prevent returning non-persisted payment in stripe service #3916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025

Conversation

floganz
Copy link
Contributor

@floganz floganz commented Jul 4, 2025

Context

Currently PaymentRequests::Payments::StripeService in certain conditions might return result with non-persisted payment on it. That creates issues in other services because they assume that payment is persisted if returned.
Particularly, this PaymentProviders::Stripe::Webhooks::PaymentIntentSucceededService service tries to enqueue job with not saved record causing ActiveJob::SerializationError: exception.

Description

Adjust service to avoid returning non-persisted payments

@floganz floganz self-assigned this Jul 4, 2025
Copy link
Collaborator

@vincent-pochet vincent-pochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@floganz floganz merged commit 72d2da3 into main Jul 4, 2025
14 checks passed
@floganz floganz deleted the fix-stripe-payment-requests-flow branch July 4, 2025 08:23
diegocharles pushed a commit that referenced this pull request Jul 11, 2025
…ice (#3916)

## Context

Currently `PaymentRequests::Payments::StripeService` in certain
conditions might return result with non-persisted payment on it. That
creates issues in other services because they assume that payment is
persisted if returned.
Particularly, this
[PaymentProviders::Stripe::Webhooks::PaymentIntentSucceededService](https://github.com/getlago/lago-api/blob/b643cac6e33e0106f40423fb02917107de802d94/app/services/payment_providers/stripe/webhooks/payment_intent_succeeded_service.rb#L6)
service tries to enqueue job with not saved record causing
`ActiveJob::SerializationError:` exception.

## Description

Adjust service to avoid returning non-persisted payments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants