Hi,
How to reproduce the issue:
- add some products to the cart
- continue on the Checkout page
- select PayPal as the payment method
- leave the Checkout page opened and open the Cart in a new tab/page
- remove a product (or more) from the Cart
- come back to the already opened Checkout page
- press the Continue button to pay
What happens:
- the amount sent to PayPal is the correct and it's the one corresponding to the updated cart. Also, the list of the purchased products sent to PayPal is correct.
- the order saved to OpenCart contains the products displayed on the last step of the Checkout process, before paying, when in fact it should've contained the products from the updated cart (even if the cart was updated on a different tab..)
This is a serious problem and it was reported by one customer. We don't know exactly how many times this happened, but we're loosing money because we're using the orders from OpenCart to send the products to our customers, so in fact we sent more products than the customers paid!!
Is there a fix for this?
OpenCart version 2.3.0.2
Thanks!
How to reproduce the issue:
- add some products to the cart
- continue on the Checkout page
- select PayPal as the payment method
- leave the Checkout page opened and open the Cart in a new tab/page
- remove a product (or more) from the Cart
- come back to the already opened Checkout page
- press the Continue button to pay
What happens:
- the amount sent to PayPal is the correct and it's the one corresponding to the updated cart. Also, the list of the purchased products sent to PayPal is correct.
- the order saved to OpenCart contains the products displayed on the last step of the Checkout process, before paying, when in fact it should've contained the products from the updated cart (even if the cart was updated on a different tab..)
This is a serious problem and it was reported by one customer. We don't know exactly how many times this happened, but we're loosing money because we're using the orders from OpenCart to send the products to our customers, so in fact we sent more products than the customers paid!!
Is there a fix for this?
OpenCart version 2.3.0.2
Thanks!
Last edited by andxres on Fri Sep 10, 2021 2:57 pm, edited 2 times in total.
We're using PayPal Express Checkout, but there's no issue with the amount payed, or with the products sent to PayPal, the issue is that the orders saved in OpenCart don't contain the products from the cart (which is and can be updated in a different tab).
Thanks!
Thanks!
I see what you mean. I was able to recreate your issue.
It's a flaw in the PayPal Express module. After the order has been added to the database it still uses the cart data to calculate the amounts send to PayPal, not the finalised order info. I wonder how many other payment modules work the same way.
The 3.x branch looks exactly the same so there doesn't look like there is any fix. You could look at using another PayPal module.
Or as a really, really rough workaround you could try. In catalog/controller/extension/payment/pp_express.php after the following on line 1341.
Add.
It's a flaw in the PayPal Express module. After the order has been added to the database it still uses the cart data to calculate the amounts send to PayPal, not the finalised order info. I wonder how many other payment modules work the same way.
The 3.x branch looks exactly the same so there doesn't look like there is any fix. You could look at using another PayPal module.
Or as a really, really rough workaround you could try. In catalog/controller/extension/payment/pp_express.php after the following on line 1341.
Code: Select all
$data = array_merge($data, $this->model_extension_payment_pp_express->paymentRequestInfo());
Code: Select all
$total = round($this->currency->format($order_info['total'], $this->session->data['currency'], false, false), 1);
if ($total !== round($data['PAYMENTREQUEST_0_AMT'], 1)) {
$this->response->redirect($this->url->link('checkout/checkout', '', true));
}
Code: Select all
$this->response->redirect($this->url->link('checkout/checkout', '', true));
Code: Select all
$this->response->redirect($this->url->link('checkout/failure'));
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thank you so much for checking and offering a solution!!ADD Creative wrote: ↑Tue Sep 07, 2021 11:48 pmI see what you mean. I was able to recreate your issue.
Your fix on ADD Creative's solution worked great! Thank you!!!!straightlight wrote: ↑Tue Sep 07, 2021 11:57 pmfor:Code: Select all
$this->response->redirect($this->url->link('checkout/checkout', '', true));
Code: Select all
$this->response->redirect($this->url->link('checkout/failure'));
No problem. Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.andxres wrote: ↑Fri Sep 10, 2021 4:32 amThank you so much for checking and offering a solution!!ADD Creative wrote: ↑Tue Sep 07, 2021 11:48 pmI see what you mean. I was able to recreate your issue.
Your fix on ADD Creative's solution worked great! Thank you!!!!straightlight wrote: ↑Tue Sep 07, 2021 11:57 pmfor:Code: Select all
$this->response->redirect($this->url->link('checkout/checkout', '', true));
Code: Select all
$this->response->redirect($this->url->link('checkout/failure'));
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
This works really well for me, thank you! Facing same issue here. Help is appreciated.ADD Creative wrote: ↑Tue Sep 07, 2021 11:48 pmI see what you mean. I was able to recreate your issue.
It's a flaw in the PayPal Express module. After the order has been added to the database it still uses the cart data to calculate the amounts send to PayPal, not the finalised order info. I wonder how many other payment modules work the same way.
The 3.x branch looks exactly the same so there doesn't look like there is any fix. You could look at using another PayPal module.
Or as a really, really rough workaround you could try. In catalog/controller/extension/payment/pp_express.php after the following on line 1341.Add.Code: Select all
$data = array_merge($data, $this->model_extension_payment_pp_express->paymentRequestInfo());
Code: Select all
$total = round($this->currency->format($order_info['total'], $this->session->data['currency'], false, false), 1); if ($total !== round($data['PAYMENTREQUEST_0_AMT'], 1)) { $this->response->redirect($this->url->link('checkout/checkout', '', true)); }
Thanks for sharing. I found a lot of interesting information here.ADD Creative wrote: ↑Tue Sep 07, 2021 11:48 pmI see what you mean. I was able to recreate your issue.
It's a flaw in the PayPal Express module. After the order has been added to the database it still uses the cart data to calculate the amounts send to PayPal, not the finalised order info. I wonder how many other payment modules work the same way.
The 3.x branch looks exactly the same so there doesn't look like there is any fix. You could look at using another PayPal module indigocard.
Or as a really, really rough workaround you could try. In catalog/controller/extension/payment/pp_express.php after the following on line 1341.Add.Code: Select all
$data = array_merge($data, $this->model_extension_payment_pp_express->paymentRequestInfo());
Code: Select all
$total = round($this->currency->format($order_info['total'], $this->session->data['currency'], false, false), 1); if ($total !== round($data['PAYMENTREQUEST_0_AMT'], 1)) { $this->response->redirect($this->url->link('checkout/checkout', '', true)); }
Who is online
Users browsing this forum: No registered users and 75 guests