UNPROCESSABLE_ENTITY The requested action could not be performed - woocommerce

We installed the Woocommerce Paypal Payments plugin on our website. We're switching to a different Paypal account (US instead of Canada), which necessitated us to install the new app.
Immediately after switching payments to the new app, about half our customers reported that they were unable to purchase.
This is the error that we're seeing in the backend:
Failed to process the payment. Please try again or contact the shop admin. [UNPROCESSABLE_ENTITY] The requested action could not be performed, semantically incorrect, or failed business validation. https://developer.paypal.com/docs/api/orders/v2/#error-PAYMENT_DENIED ************************* [UNPROCESSABLE_ENTITY] The requested action could not be performed, semantically incorrect, or failed business validation. https://developer.paypal.com/docs/api/orders/v2/#error-PAYMENT_DENIED ********************* Order status changed from Pending payment to Failed.
We have switched back to our old payments setup for now, but we'd like to get this fixed.
I spoke to the Woocommerce Paypal Payments plugin developer. His feedback was:
'The “PAYMENT_DENIED” issue is most likely caused by a bank or PayPal denying the transaction and needs to be investigated by PayPal Merchant Technical Support.
We have no access to the backend logging of PayPal, so we cannot see why this transaction was denied. Please contact PayPal Merchant Technical Support to get this investigated.'
When I submitted a ticket to Paypal, they told me that the cards were declined 'based on risk', which is fairly obviously not the case. We've had customers' cards declined by Paypal due to risk in the past. It looks nothing like this.
It seems that there is probably an issue with this new Paypal account. Does anyone know what might be going on?
WooCommerce 7.0.1
WooCommerce PayPal Payments 1.9.5

When I submitted a ticket to Paypal, they told me that the cards were declined 'based on risk', which is fairly obviously not the case.
It is the case, the PayPal API returns PAYMENT_DENIED when PayPal has rejected the transaction, generally due to it being detected as involving potential fraud or other compliance/risk issues.
For the live environment, since it's a business rather than technical issue, the account's owner can contact PayPal's general customer support via https://www.paypal.com/smarthelp/contact-us and inquire about the declines. It helps to have the details of specific payer examples, including their exact amounts, date+times, and any other identifiers

Related

How to fix TRANSACTION_REFUSED error in WooCommerce PayPal Payments plugin

Am using WooCommerce with WooCommerce PayPal Payments plugin, on checking out (live environment) am getting the error below;
[UNPROCESSABLE_ENTITY] The requested action could not be performed, semantically incorrect, or failed business validation. https://developer.paypal.com/docs/api/orders/v2/#error-TRANSACTION_REFUSED
To add on, sandbox works without any issue.
I will be grateful for any assistance.
TRANSACTION_REFUSED is not a technical problem, and so cannot be fixed. It is a decline by PayPal.
Have the customer use a different payment method, or contact PayPal for information about why the payment might have been declined.
Note that payments to your own production account are not permitted. If the payer information is at all connected to the receiving account, this is why it was declined.

Recurring and non-recurring items in single PayPal checkout flow

I'm currently migrating a website from WooCommerce to Shopware 6, which needs to support recurring payments for a membership subscription.
WooCommerce is still using PayPal Standard, which allows you to mix non-recurring line items with a recurring subscription, in a single checkout flow.
Shopware 6 uses the REST API, which doesn't appear to support this ability and the only solution appears to be using the Javascript SDK:
User clicks Pay with PayPal.
Subscription is created via actions.subscription.create
Dialog is displayed requesting approval.
Customer approves.
Submit original checkout.
Redirect to PayPal.
Complete payment.
Redirect back to website with confirmation.
A potential solution I'm looking into now is changing the return URL of the initial order creation to redirect to a billing agreement approval URL and have the return URL's of that redirect back to the original return url.
Overly complicated and the worse UX I've ever seen.
Before I tear what's left of my hair out, does anyone have any suggestions?
UPDATE
Although it isn't the solution I was hoping for, I ended up removing the Shopware 6 PayPal plugin and implementing my own payment method using the NVP API.
From the user perspective, there is only one approval process. In the backend, once the user has approved the transaction (that has been marked as needing a billing agreement) the transaction is verified and then a recurring profile is created.
There's no way to combine Subscriptions and one-time payments in a single checkout. Such items even require different parameters on the PayPal SDK line, if using the PayPal buttons to show an in-context experience.
The in-context experience is best, since it involves no redirects away from your site to PayPal and back. Here is the flow for one-time payments:
Make two routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. These routes should return only JSON data (no HTML or text). The latter one should (on success) store the payment details in your database before it does the return (particularly purchase_units[0].payments.captures[0].id, the PayPal transaction ID)
Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
A similar (separate) flow can be used for PayPal Subscriptions. Only one subscription can be approved at a time.

Woocommerce Stocking Issue

I got an issue with the Woocommerce stocking system. The issue arises when a product stock is reduced to 1, after that every time a customer buys that particular product, the stock does not turn to 0 and hence makes it 'out of stock'.
We've been trying to fix this but never succeeded.
For the payment system we are using Paypal, Bank Transfer (manual), and our local Indonesian payment gateway called Midtrans.
We have tried contacting Paypal which we suspected as the problem, as we keep getting IPN error notifications. I am not too sure yet if Paypal is related to this stocking issue.
Some of WooCommerce's PayPal payment methods do use IPN to mark orders as successfully paid, so that could be related. You should work on ensuring your IPN listener is functioning properly and able to receive messages from PayPal without error.
Alternatively, there are various alternate PayPal plugins for WooCommerce that you can try, and some do not depend on the legacy IPN service.

Problems with PayPal in WooCommerce

I have correctly configured payments with PayPal in WooCommerce, sometimes I get orders and pay for PayPal and everything is fine, but sometimes some customers pay and WooCommerce does not change the status of the order to "Paid", and for that reason customers contact me to tell me that they already paid and yes.
Does anyone feel the same?
PS: This error is occasional, I do not know what it could be.
You could always just log in to your PayPal account and see if the transactions that show an incorrect status in WooCommerce do actually exist in your PayPal transaction log with the correct status. If so, then you should contact WooCommerce support for them to explain why those same transactions do not show up with the correct status in their portal. If WooCommerce tells you that it's an issue with PayPal (and thus, there is nothing to be corrected at their side), then open a case with PayPal support and they can look into the logs being sent from WooCommerce's API calls into PayPal to confirm whether or not they are doing it properly.
PayPal Standard that comes with WooCommerce uses IPN to update the order status. Unfortunately, their IPN integration is not great, and it often fails.
If you use my PayPal for WooCommerce instead, and setup Express Checkout, this problem will not happen. Also, you'll have a lot more features and functionality.

Payment gateway possible issues

I have implemented 2 payment gateways in my app (paypal and datatrans). In both gateways payment happens on gateway site i.e. user is redirected to payment gateway site where he pays and then redirected back to our site.
I have identified some scenarios where there is some issue in entire payment flow. E.g.
lost internet connection after payment and so order is not placed but money got debited from user's account
PayPal sent response but application got exception and so user did not get confirmation
Double payment due to hitting refresh button when transaction was in progress
I would like to know what are standard exceptions should be handled in payment gateway integration.
Any example with paypal would help me lot, I use asp.net mvc 3. thanks.
Double payment.
To avoid them you need to create a unique ID for every order, after the user move from your site to the paypal or other site, this ID must be read-only, and if the user return to your site after fail or other reason, and ask to re-order the same cart, you must create a new cart, and a new order ID.
For every order id, paypal and other sites allow only one payment (or one fail).
Lost the internet connections, or not get confirmations
Paypal have 3 ways that contact with your.
IPN
PDT
emails.
The one is that you get information from the return of the user after the payment, the other method is that paypal communicate with you and send you the payment informations, and final you get email.
In the rare case that all fails, user will inform you after some days that he did not get his order.
Practical they never fail all of them. Actually they never fail any of them.
Exceptions and bugs
Well some times you can not avoid bugs, so monitor your payments and log any possible errors to fix it. After 7 years of payments with paypal I still monitor them for problems, fraud, issues, new thinks etc, and still make some small adjustments time to time.

Resources