Closed dwainm closed 3 years ago
Another way to reproduce this is making a small code change to throw the exception we're interested in debugging. Add the following just before the final line of set_order_reference_details
:
throw new Exception( __( 'You have not selected a payment method from your Amazon account. Please choose a payment method for this order.', 'woocommerce-gateway-amazon-payments-advanced' ) );
This will give the customer an error at checkout like this:
And the state of the order is as described in the issue description.
I'm pretty sure this is how other payment gateways behave when processing a payment fails. I think what isn't working well here is the failure to add the Amazon Pay specific meta data to the order (and perhaps not adding an order note telling the merchant what happened).
Thank you @dwainm, can you confirm that throwing this exception will still create the empty order? Would adding extra information to the order and a note be pretty straight forward?
On one of our merchant sites (www.walkinpets.com) they are receiving many cases where orders show up but without any customer info, no Amazon Pay order ID, or other details in the order view. Only way I was able to repro is to place a production order with an account that has no payment methods setup (I cannot do this in sandbox because all sandbox/test accounts come with credit cards). I see in the code that there is an exception thrown when PaymentPlanNotSet, but why is an order being added to WooCommerce orders?
Steps to reproduce the behavior:
Screenshots
Expected behavior The order should not go through and should not be added to the WooCommerce orders section.
Isolating the problem (mark completed items with an [x]):
WordPress Environment WP 5.3.2