Skip to content

Conversation

mariohd
Copy link
Contributor

@mariohd mariohd commented Jun 12, 2025

Whenever we have a setup_intent.succeeded with a payment method that has no customer attached to it.

Stripe does that when setting up payment methods that has some problems (we don't know exactly which problems are). The setup_intent.succeeded and payment_method.detached are fired almost at the same time.

Once payment_method.detached the payment method becomes unusable.

This raises on app/services/payment_providers/stripe/webhooks/setup_intent_succeeded_service.rb

Stripe::InvalidRequestError: The customer does not have a payment method with the ID <pm_ID>. The payment method must be attached to the customer.

@mariohd mariohd requested a review from ivannovosad June 12, 2025 19:22
@mariohd mariohd force-pushed the fix-stripe-set-int-succ-payment-method branch from 3caeeab to fda6854 Compare June 12, 2025 19:41
@mariohd mariohd force-pushed the fix-stripe-set-int-succ-payment-method branch from fda6854 to ce28e4b Compare June 12, 2025 19:46
@mariohd mariohd merged commit 72496ed into main Jun 20, 2025
14 checks passed
@mariohd mariohd deleted the fix-stripe-set-int-succ-payment-method branch June 20, 2025 13:38
diegocharles pushed a commit that referenced this pull request Jul 11, 2025
#3826)

Whenever we have a `setup_intent.succeeded` with a payment method that
has no customer attached to it.

Stripe does that when setting up payment methods that has some problems
(we don't know exactly which problems are). The `setup_intent.succeeded`
and `payment_method.detached` are fired almost at the same time.

[Once `payment_method.detached` the payment method becomes unusable. 
](https://docs.stripe.com/api/payment_methods/detach)

This raises on
`app/services/payment_providers/stripe/webhooks/setup_intent_succeeded_service.rb`
```
Stripe::InvalidRequestError: The customer does not have a payment method with the ID <pm_ID>. The payment method must be attached to the customer.
```
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