Skip to content
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

[CORE-942] [stripe] 3 payment intents created for 2 providers when updating cart totals #2736

Closed
chemicalkosek opened this issue Dec 7, 2022 · 11 comments

Comments

@chemicalkosek
Copy link
Contributor

chemicalkosek commented Dec 7, 2022

Bug report

Describe the bug

If there are two providers available (ie. stripe and stripe-przelewy24) and the customer is a new email, then if you update the cart totals, we end up with 3 payment intents: 2 with new totals, 1 with initial totals.
This doesn't happen when the customer already existed in stripe before starting the checkout.

System information

Medusa version (including plugins): 1.6.4, medusa-payment-stripe: 1.1.48

Steps to reproduce the behavior

  1. Have two stripe providers enabled (in example stripe and stripe-przelewy24)
  2. Add one item to cart.
  3. Go to checkout
  4. Fill in customer email. Important: must be a new stripe customer email.
  5. Create payment sessions on cart
  6. See two payment intents in stripe dashboard
  7. Add something new to cart (new item or add shipping)
  8. See three payment intents in stripe dashboard. 2 intents with new totals. 1 intent with the initial totals.

Expected behavior

2 payment intents for 2 providers with correct totals.

Screenshots

image

Additional context

This PR (which is included in 1.1.48) states that it should be fixed, but that's unfortunately not the case: #2603

CORE-942

@olivermrbl
Copy link
Contributor

Thanks for reporting this one @chemicalkosek.

@adrien2p Would you be up for digging a bit into this one?

@adrien2p
Copy link
Member

adrien2p commented Dec 7, 2022

Yes sure 💪

@chemicalkosek
Copy link
Contributor Author

chemicalkosek commented Dec 7, 2022

I have also noticed that sometimes the number of customers in that situation is doubled (same email)
1 payment intent = 2 customers
3 payment intents = 6 customers

@adrien2p
Copy link
Member

adrien2p commented Dec 8, 2022

@olivermrbl, in the cart, set payment sessions, if the total > 0 and if there is only one provider and no payment session, then we create a new session. Could it be the issue? So we update one and create a new one? could it be it? I ll test just to be sure

@olivermrbl
Copy link
Contributor

@adrien2p This is solved in the latest Stripe version right? As part of #2743

@chemicalkosek
Copy link
Contributor Author

chemicalkosek commented Jan 2, 2023

Just tested and looks like it's still happening. Even worse.
I have something in cart. I have multiple intents created initially, but should be just two. Then after adding more stuff to cart, some more are created. Two of them have correct price.

image

@olivermrbl
Copy link
Contributor

Thanks for sharing @chemicalkosek. We'll attend to this one.

@olivermrbl olivermrbl changed the title [stripe] 3 payment intents created for 2 providers when updating cart totals [CORE-942] [stripe] 3 payment intents created for 2 providers when updating cart totals Jan 2, 2023
@adrien2p
Copy link
Member

adrien2p commented Jan 2, 2023

@chemicalkosek can you share us the packages versions you are using please?

@chemicalkosek
Copy link
Contributor Author

"medusa-payment-stripe": "^1.1.50",
"@medusajs/medusa": "^1.7.2",

@adrien2p
Copy link
Member

adrien2p commented Jan 2, 2023

@chemicalkosek I found the issue, I ll release a snapshot that you will be able to test very soon, thanks again for reporting

reference: #2921

@adrien2p
Copy link
Member

adrien2p commented Jan 2, 2023

Screenshot 2023-01-02 at 12 55 41

We can see here, that with the fix, I get the customer created, the intent created and then the same intent is updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants