Page 1 of 1

Paypal integration throws error 500 after purchase

Posted: Fri Jul 05, 2024 6:02 am
by scubanarc
I added the Paypal integration and connected it to my Paypal account. I can see in the extension that it is configured with a valid Merchant ID, Client ID, Secret, Webhook ID, and Environment is set to "production". I also have Debug Logging set to "On".

When I look at a product and click "Buy it now" the Paypal window pops up and I can see that the details have passed to Paypal correctly.

When I complete the transaction at Paypal, the popup windows exits ok, and I see the "Confirm Order" screen. When I click the "Confirm" button opencart throws a 500 error. I get an invoice from Paypal that the transaction was completed correctly and my payment is processed.

According to my access_log, the last page accessed before the error is: paypal.completeOrder

The purchase does not show up in my purchase history on opencart.

I see the following in error.log:
PHP Warning: Trying to access array offset on value of type null in .../catalog/controller/mail/order.php on line 151

In the paypal.log file I can see the "Create Order", "Capture Order", and "Webhook". Also, when I refund the order from Paypal's dash I can see the webhook hit for that as well.

Re: Paypal integration throws error 500 after purchase

Posted: Fri Jul 05, 2024 4:31 pm
by softmonke
What's the OpenCart version you are using?

Anyway, it's probably because of this issue: https://github.com/opencart/opencart/issues/12695. The fix can be found in commit referenced in the GitHub issue.

Re: Paypal integration throws error 500 after purchase

Posted: Fri Jul 05, 2024 4:35 pm
by ADD Creative
You need to check your server or PHP error logs for the error 500, not the OpenCart one.

Re: Paypal integration throws error 500 after purchase

Posted: Fri Jul 05, 2024 11:15 pm
by scubanarc
softmonke wrote:
Fri Jul 05, 2024 4:31 pm
Anyway, it's probably because of this issue: https://github.com/opencart/opencart/issues/12695. The fix can be found in commit referenced in the GitHub issue.
That fixed it! Thanks.

Re: Paypal integration throws error 500 after purchase

Posted: Wed Jul 10, 2024 10:37 am
by softmonke
scubanarc wrote:
Fri Jul 05, 2024 11:15 pm
softmonke wrote:
Fri Jul 05, 2024 4:31 pm
Anyway, it's probably because of this issue: https://github.com/opencart/opencart/issues/12695. The fix can be found in commit referenced in the GitHub issue.
That fixed it! Thanks.
Great! Do add [SOLVED] to the your post title :)