-
Notifications
You must be signed in to change notification settings - Fork 210
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
Idempotency key for deferred intent UPE #3912
Conversation
508e56f
to
0dc10b7
Compare
ae4a44f
to
16105ac
Compare
c6f0fcb
to
40f4b70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing this @annemirasol.
✅ Checkout with a valid card.
✅ Checkout with 3DS card.
✅ Checkout with Google Pay.
✅ Checkout with IDeal, Multibanco, Sepa, Klarna.
✅ Checkout with a failed card, then a valid card.
✅ Checkout with a failed card, then iDeal.
✅ Subscription purchase.
✅ Subscription purchase with a failed card, then a valid card.
✅ Renew a old subscription.
✅ Refund.
Changes proposed in this Pull Request:
We use idempotency keys when creating charges for legacy checkout, i.e. sending
POST
requests to thecharges
endpoint. This is to avoid creating multiple charges for the same request, from retries or poor network conditions.We want that same behavior for the new checkout. This PR adds idempotency keys to deferred intent requests, which uses the
payment_intents
endpoint.Background
We've been receiving several reports of multiple charges for a single order. While hard to reproduce, these patterns emerge:
For Pattern 1, we have recently pushed code that checks if the order already has an existing payment intent before attempting to request a new one.
For Patterns 2 and 3, I believe these are caused by network-related retries, and using an idempotency key should help with these.
https://docs.stripe.com/api/idempotent_requests
https://docs.stripe.com/payments/payment-intents#best-practices
Original PR for idempotency: #503
Testing instructions
4000000000000002
.Post merge