amazon-payments-magento-2-plugin icon indicating copy to clipboard operation
amazon-payments-magento-2-plugin copied to clipboard

Order "Processing" without payment

Open darektw opened this issue 9 months ago • 13 comments

What I expected

I expect orders with a processing status that have invoices created after payment.

What happened instead

There are orders that have a processing status, no invoice, even though the payment has been cancelled.

What actual results you or customer got

Dispatched orders that have not been paid for.

Reproduction path

Unfortunately, I do not yet know the exact steps to repeat this error. It only occurs with some orders.

In the previous version 5.16.1 everything worked correctly.

We observe the following errors in the logs:

var/log/paywithamazon.log-[2024-04-25T22:04:45.899437+00:00] amazonClientLogger.ERROR: 
Exception: Warning: Undefined variable $order in 
/var/www/magento/releases/20240424T160438/vendor/amzn/amazon-pay-magento-2-module/Model/CheckoutSessionManagement.php on line 781 
in /var/www/magento/releases/20240424T160438/vendor/magento/framework/App/ErrorHandler.php:62

Your setup

  • Magento version: 2.4.6-p5
  • Amazon Pay Extension Version: 5.17.0
  • Magento Edition: Enterprise

darektw avatar Apr 29 '24 14:04 darektw

Hi @darektw

I also have the problem. I have just proposed an MR, hoping that it is quickly validated :rocket:

dimitriBouteille avatar Apr 29 '24 15:04 dimitriBouteille

Hello @darektw and @dimitriBouteille, I was wondering if you both also had the issue where these specific orders can't be canceled ?

I have the exact same issue that you describe where an order is placed, no invoice is created but the order is in the "processing" state. The order status message is something like "Authorization of X Euros, Transaction ID YYY". The thing is, the Transaction ID can't be found in Amazon Seller Central, and when trying to cancel the Order, I have the following error :

[2024-05-02T15:02:09.025721+00:00] amazonClientLogger.DEBUG: closeChargePermission <-  ["1","<some_id_here>","MerchantClosed",true] []
[2024-05-02T15:02:09.026458+00:00] amazonClientLogger.ERROR: closeChargePermission ->  {"reasonCode":"ResourceNotFound","message":"Resource you are trying to access is not available. Requested path '/live/v2/chargePermissions/<some_id_here>/close'","status":404} []

Is it in any way related to your issue ?

I have tried changing the Authorization Mode to "Automatic". It seems to fix the issues of Orders without payment being in the "Processing" state. Can't really confirm anything yet.

markfischmann avatar May 03 '24 10:05 markfischmann

@markfischmann We are also seeing this issue which is a major problem since "processing" should indicate that an order payment is correctly received and can be dispatched.

Debugging so far has revealed that the updateCheckoutSession REST API endpoint and subsequent placeOrder controller endpoint is hit (hence the order being placed) but the subsequent completeSession controller is not in instances where the payment does not actually complete. This leads to no "errors" being shown in the logs but the Amazon Pay session close/payment capture does not actually complete as intended.

We have seen instances whereby orders are marked as processing even if the Auth has subsequently been declined etc.

Order status should be Pending Payment (or similar) until the Auth and subsequent Capture have been 100% confirmed.

Ref: https://github.com/amzn/amazon-payments-magento-2-plugin/issues/1186 - As mentioned in a recent comment. We too had no issues when using 5.16.1 This appears to be a new issue introduced in 5.17.0

jonesio avatar May 03 '24 15:05 jonesio

It seems that with the new 5.17.0 update, orders are being placed when there is a potential error with the payment transaction. If you change the "Authorization Mode" to "Automatic", you will have an order placed with the "Payment Review" status, and a pending invoice that you can either cancel or capture manually.

markfischmann avatar May 06 '24 08:05 markfischmann

@darektw @dimitriBouteille @markfischmann Thank you all for your investigation, and the feedback. We are working to get this fixed. Please let us know if you've come across any other helpful details.

dallin-beargroup avatar May 06 '24 16:05 dallin-beargroup

Hi @dallin-beargroup To avoid this kind of problem in the future, it might be good to use code quality tools (phpstan, PHPMD Mess Detector, ...) ❤️

dimitriBouteille avatar May 06 '24 22:05 dimitriBouteille

We are working to roll out the next minor version addressing these issues. In the meantime you can use this patch to stop orders moving into a processing state before authorization. github-issue-1236_initial_order_state.txt source

@dimitriBouteille Thank you for your suggested fix. I was unable to recreate the symptoms with undefined variables, but I did test it alone, and along side the above patch, and everything appeared to function normally. We will keep it under review and likely will roll it into the next minor release.

dallin-beargroup avatar May 14 '24 20:05 dallin-beargroup

Hi @dallin-beargroup , do you have an ETA for next release with this issue fixed, as we disabled the extension for now. As we have high order volume, causing issues to ship orders without payments.

Thank you

faisal2010 avatar Jun 06 '24 13:06 faisal2010

Hello @faisal2010 ,

We're trying to wrap up testing for the 5.17.1 release, which will include these fixes plus a few other minor patches. Hopefully this could go live next week.

Thanks, Spencer

sgabhart22 avatar Jun 07 '24 15:06 sgabhart22

Hi everyone,

I'm happy to finally announce that version 5.17.1 is live on the Marketplace! We'll close this issue shortly, but of course, please don't hesitate to reach out with future problems. We appreciate all your contributions!

Thanks, Spencer

sgabhart22 avatar Jun 19 '24 15:06 sgabhart22

Experiencing this issue after updating to 5.17.1. Starting the debug

kestraly avatar Jun 21 '24 09:06 kestraly

My issue is the plugin now uses type MIXED and is no longer PHP7.4 compatible

kestraly avatar Jun 25 '24 10:06 kestraly

Hi @kestraly , you've probably addressed this on your own at this point, but for anyone else who may come across this, I'll drop a patch here for PHP 7.4 compatibility despite it having been EOL for quite some time now. We can remove the mixed references in the function signatures in the next patch version.

php74-compat.patch.txt

Thanks, Spencer

sgabhart22 avatar Jul 08 '24 17:07 sgabhart22