PayPal checkout return "We can't process Express Checkout approval." and payment got deducted and order not created for virtual product type but it is working well for other products.
I am also having this issue since Magento 2.4
Does anyone have any solutions?
Anything on this?!
Regular Checkout Error with PayPal: We can't process Express Checkout approval.
PayPal Express from Product Error: We can't place order
Magento 2.4.2
In my case it turns out it was a instore pickup extension that I installed.
To find out what it was, this is what I did.
Under stores > configuration > sales > payment method > PayPal configure > Advanced Settings
Set Debug mode to Yes
And just in case it helps
Under stores > configuration > sales > payment method > PayPal configure > PayPal Billing Agreement Settings
Set Debug mode to Yes
Check your system log in var > log
And payment.log is here if you want some info on the PayPal transaction
This is the error I got
main.CRITICAL: Exception message: Notice: Undefined index: in /public_html/app/code/FME/StorePickup/Observer/SavePickUpObserver.php
To test, I turned off all delivery methods except Flat rate and then I was able to process an order.
In our case WEB pods restarting helps.
Some process on random WEB pod kept files open and it was leading to error like:
main.CRITICAL: Exception message: The stream or file "/var/www/magento/var/log/payment.log" could not be opened in append mode: failed to open stream: Stale file handle
As a result we were getting error like "We can't process Express Checkout approval." which is fired in 2 places in "catch" block:
\Magento\Paypal\Controller\Express\AbstractExpress\ReturnAction::execute
\Magento\Paypal\Controller\Express\OnAuthorization::execute
Double-check that you have entered the correct API credentials for your payment provider. Ensure that you have both the API username and API password correctly entered in your integration. Check your payment provider account settings to ensure that you have the necessary permissions and configurations set up to process Express Checkout payments. If your payment provider offers a sandbox or test environment, try conducting a test transaction using the provided sandbox credentials. This can help determine if the issue is specific to your production environment or related to the integration setup. When encountering an issue with Express Checkout approval, review any error messages or error codes such as lesturf that are returned. These can provide insights into the specific problem and help guide your troubleshooting efforts.