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

Webhook receives payment info but no order was created #523

Open
JamesFX2 opened this issue Jul 26, 2023 · 4 comments
Open

Webhook receives payment info but no order was created #523

JamesFX2 opened this issue Jul 26, 2023 · 4 comments

Comments

@JamesFX2
Copy link

We've updated to 5.2 but we're having an issue where we are receiving payment authorisations and payment captures where no order exists. A quote exists, but no order. I have looked at the access logs for their IP, they definitely clicked the placeorder URL - actually, they clicked it multiple times.

@JamesFX2
Copy link
Author

Wow. You take payment now before the order is created. Are you unfamiliar with the concept of order validation when the quote is submitted. Why would you do this? An item can be out of stock. A product could be disabled. You can't assume that the order will be created.

@JamesFX2
Copy link
Author

JamesFX2 commented Jul 26, 2023

@JuliosDnd you need to fix this please.

We upgraded from 4.0.0

image

To 5.2.0

image

Why on Earth would you presume to create an order before the quote is validated?

When you submit a quote, Magento submits it to its Quote Validator

image

This eventually calls the QuoteValidationComposite

For example, https://github.com/magento/magento2/tree/2.4-develop/app/code/Magento/Quote/Model/ValidationRules

  • Minimum Order Amount
  • Billing + Shipping Address Validation
  • Payment Method Validation
  • Shipping Method Validation
  • Allowed Country Validation

It's also extensible, see

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Quote/etc/di.xml#L110-L120

If you're going to do something like this

  • clone the quote
  • pass it into \Magento\Quote\Model\SubmitQuoteValidator

The result? We have a load of users who paid us money and have no order.

@JamesFX2
Copy link
Author

JamesFX2 commented Aug 2, 2023

I sorted this out with a plugin on the checkout webhook.

Some validation is put on sales_order_place_before event so I needed to (1) create the order (2) prevent the order being created by the original process (3) prevent the payment request from having a new increment id (4) close any orders for failed payments. If any other end users want this, gimme a shout.

@stephen-gilbert-cko
Copy link

v5.3.0 introduced a Payment Processing option under plugin Global Settings which will allow you to set "Order First" in line with Adobe Commerce native behaviour.

https://github.com/checkout/checkout-magento2-plugin/releases/tag/5.3.0

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

No branches or pull requests

2 participants