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

[BUG] Order gets created even if paypal redirect fails #346

Open
kaysond opened this issue Oct 2, 2023 · 4 comments
Open

[BUG] Order gets created even if paypal redirect fails #346

kaysond opened this issue Oct 2, 2023 · 4 comments
Assignees

Comments

@kaysond
Copy link
Contributor

kaysond commented Oct 2, 2023

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Use incorrect paypal api keys
  2. Complete an order using paypal

Expected behavior
Order should not get added to db

Screenshots
If applicable, add screenshots to help explain your problem.

Background (please complete the following information):

  • NodeJS Version - 20.7.0
  • Postgres Version - 15.4
  • EverShop Version - rc7
  • OS: [e.g. Window, Ubuntu, Mac-OS] - Debian
  • Browser [e.g. Chrome, Safari] - FF

Additional context
This is problematic because it creates pending orders that reduce stock but can never be paid for

@treoden
Copy link
Collaborator

treoden commented Oct 2, 2023

Hi @kaysond ,

The way the checkout works is an order will be created with the "pending" payment status first, and then buyer will be taking care of the payment later
If the payment was successful, the payment status will be updated to "Paid". This is to avoid the race condition like someone can place an order with same product and make it out of stock in the same time the previous guy working on the payment.

I understand this approach can generate pending payment orders and hold stock. Normally we solve this problem by having a job to check and cancel the order has pending payment for so long and release the stock. Since this process depends on the business, we do not make it as a part of the core.

Let me know if you have any question.
Thanks

@kaysond
Copy link
Contributor Author

kaysond commented Oct 2, 2023

@treoden - I figured it was race condition related. Still, I think it might be worth making sure the initial request to the payment processor is successful before creating the db entry. For CoD, the "request" will always go through.

Also, it would help if in the admin panel we could delete orders with pending payments to release the stock manually.

@ultimate-tester
Copy link
Contributor

I support the feature to delete orders, but don't support to only create the order later in the database. I want to see failed orders too, I could contact the customer and have them pay in an alternative way so that the order can go through. Creating order later will miss potential sales.

@kaysond
Copy link
Contributor Author

kaysond commented Oct 27, 2023

This is still an issue. If someone fails the zip code check on stripe, they're unable to actually complete the order, but the stock is still removed. Definitely need to be able to delete orders at a minimum. Maybe #345 will help with the stripe issue?

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

No branches or pull requests

3 participants