CANNOT BE NEGATIVE [UNPROCESSABLE ENTITY|
-
I have installed and have been running the new WooCommerce PayPal Payments Plug in.
I believed all was working okay. however in the last couple of weeks i have now had several customers contact us because of an error. It is always the same error. It works fine for most transactions, it appears that if a basket has a discount applied this error appears. I contacted PayPal and they said the error is because a payment can not be negative, they looked at the last transaction at the time-
Subtotal: £18, Discount: -£2, Total: £16. The log showed that the plug in was trying to process a payment for the Discount -£2.
PayPal said they can not help me and i would need to contact the plugin developer. I contacted them last week but have not heard anything back.
I now don’t know what to do, previously i was using PayPal Standard, but now i have installed the new plug in it will not let me switch back.this is the error message customers get –
[UNPROCESSABLE_ENTITY] The
requested action could not be
performed, semantically incorrect,
or failed business validation.
https://developer.paypal.com/docs/
api/orders/v2/#error-
CANNOT BE NEGATIVE
[UNPROCESSABLE ENTITY| The
requested action could not be
performed, semantically incorrect,
or failed business validation.
https://developer.paypal.com/docs/
api/orders/v2/#error-
CANNOT BE_ NEGATIVE
[UNPROCESSABLE_ENTITY] The
requested action could not be
-
Hi @cantraig,
Are you using any plugins to add fees or discounts?
There shouldn’t be any issues with the regular WooCommerce coupons, but there are cases where it could fail with third-party plugins under certain circumstances.
So we are looking into improving better compatibility with setups that cause negative order lines.Kind regards,
NiklasYes we use Woo Discount Rules. Today we have found every order with an automatic discount has generated this error. All orders without this specific discount have worked successfully. I actually came across an email reply which found its way into my junk folder,
The email said-
I have spoken with our developers and this issue will likely be addressed shortly after 1.7.0 update that is currently getting finished and will be tested in the next 2 weeks.
we currently do not have the fix available for you when using this plugin. I will link the bug that we have open to this ticket, so you will be made aware once it is available for you.As Woo Discount Rule’s is a commonly used plug in on my site (i have several offers relating to qty discounts) i have had to deactivate this plug in. in the meantime I have now been able to re-activate the old plug in PayPal Standard.
Hi @cantraig,
There have been some other reports about this error with certain discount setups or plugins like Woo Discount Rules but so far we had a hard time reproducing it ourselves.
It would be interesting to know if the issue persists for you with only WooCommerce, PayPal Payments, and Woo Discount Rules active.
As mentioned in the email though, we are aware of the problem and are investigating the best possible solution. It doesn’t happen for everyone though, so there must be some other configuration beyond the discount itself leading to this resulting behavior.
We expect to have a new version for testing available in early March, but I can’t provide too many details yet. It’s one of the priorities to resolve for update 1.7.1 and we will try to keep you in the loop when a proper fix is available.Kind regards,
NiklasI also have MyRewards Plugin, which adds a rewards based discount to the basket at the customers wish. This to my knowledge has not caused the same error, the only orders to my knowledge with the error contain a multibuy deal using this Woo Discount Rules.
I have another website which I am currently setting up. I do not have any discount add on purely the WooCommerce coupons. This second website is yet to launch.
I’m thinking this second website may be the easiest and best place to test this.
I have done 3 consecutive transactions with WooCommerce and PayPal Payments.
Shall I install the Woo Discount rules on this second website to see if the same error comes up? This is the current site info for this second site:### wp-core ### version: 5.9.1 site_language: en_GB user_language: en_GB timezone: UTC permalink: /%postname%/ https_status: true multisite: false user_registration: 1 blog_public: 1 default_comment_status: open environment_type: production user_count: 2 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /homepages/24/d4296231672/htdocs/wordpress wordpress_size: loading... uploads_path: /homepages/24/d4296231672/htdocs/wordpress/wp-content/uploads uploads_size: loading... themes_path: /homepages/24/d4296231672/htdocs/wordpress/wp-content/themes themes_size: loading... plugins_path: /homepages/24/d4296231672/htdocs/wordpress/wp-content/plugins plugins_size: loading... database_size: loading... total_size: loading... ### wp-active-theme ### name: Storefront (storefront) version: 3.9.1 author: Automattic author_website: https://woocommerce.com/ parent_theme: none theme_features: core-block-patterns, widgets-block-editor, post-thumbnails, automatic-feed-links, custom-logo, menus, html5, custom-background, custom-header, site-logo, title-tag, customize-selective-refresh-widgets, wp-block-styles, align-wide, editor-styles, editor-font-sizes, editor-style, responsive-embeds, woocommerce, wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider, starter-content, widgets, infinite-scroll theme_path: /homepages/24/d4296231672/htdocs/wordpress/wp-content/themes/storefront auto_update: Enabled ### wp-themes-inactive (3) ### Twenty Twenty: version: 1.9, author: the WordPress team, Auto-updates enabled Twenty Twenty-One: version: 1.5, author: the WordPress team, Auto-updates enabled Twenty Twenty-Two: version: 1.0, author: the WordPress team, Auto-updates enabled ### wp-plugins-active (15) ### Clearpay Gateway for WooCommerce: version: 3.4.0, author: Clearpay, Auto-updates enabled Fasthosts Assistant: version: 7.3.0, author: Fasthosts, Auto-updates enabled Google Listings and Ads: version: 1.11.1, author: WooCommerce, Auto-updates enabled Jetpack: version: 10.6, author: Automattic, Auto-updates enabled MailPoet 3 (New): version: 3.82.0, author: MailPoet, Auto-updates enabled MailPoet 3 Premium (New): version: 3.82.0, author: MailPoet, Auto-updates enabled myStickymenu: version: 2.5.8, author: Premio, Auto-updates enabled One Time Login: version: 0.3.1, author: Daniel Bachhuber, Auto-updates enabled StoreCustomizer: version: 2.3.7, author: Kaira, Auto-updates enabled Visual Term Description Editor: version: 1.8.1, author: Shea Bunge, Auto-updates enabled Website Open/Closed Toggle: version: 0.3.7, author: RS, Auto-updates enabled WooCommerce: version: 6.2.1, author: Automattic, Auto-updates enabled WooCommerce Blocks: version: 7.0.0, author: Automattic, Auto-updates enabled WooCommerce PayPal Payments: version: 1.6.5, author: WooCommerce, Auto-updates enabled WooCommerce Weight Based Shipping: version: 5.3.19, author: weightbasedshipping.com, Auto-updates enabled ### wp-media ### image_editor: WP_Image_Editor_GD imagick_module_version: Not available imagemagick_version: Not available imagick_version: Not available file_uploads: File uploads is turned off post_max_size: 64M upload_max_filesize: 64M max_effective_size: 64 MB max_file_uploads: 20 gd_version: 2.2.5 gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM ghostscript_version: 9.27 ### wp-server ### server_architecture: Linux 4.4.299-icpu-082 x86_64 httpd_software: Apache php_version: 7.4.25 64bit php_sapi: cgi-fcgi max_input_variables: 5000 time_limit: 50000 memory_limit: -1 max_input_time: -1 upload_max_filesize: 64M php_post_max_size: 64M curl_version: 7.64.0 OpenSSL/1.1.1d suhosin: false imagick_availability: false pretty_permalinks: true htaccess_extra_rules: true ### wp-database ### extension: mysqli server_version: 10.5.10-MariaDB-1:10.5.10+maria~buster-log client_version: mysqlnd 7.4.25 max_allowed_packet: 67108864 max_connections: 3000 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /homepages/24/d4296231672/htdocs/wordpress/wp-content WP_PLUGIN_DIR: /homepages/24/d4296231672/htdocs/wordpress/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: -1 WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: Undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable ### jetpack ### site_id: 202517603 ssl_cert: No time_diff: undefined version_option: 10.6:1644070276 old_version: 10.6:1644070276 public: Public master_user: #1 cantraig_candles current_user: #1 cantraig_candles tokens_set: Blog User blog_token: T4pLRewHUmSVdFYRzdgTLz5C%F!MW*q8 user_token: qG3K!YdJ(eg@MkDC)XTQBs9&1@xd1d($ version: 10.6 jp_plugin_dir: /homepages/24/d4296231672/htdocs/wordpress/wp-content/plugins/jetpack/ plan: free protect_header: {"trusted_header":"REMOTE_ADDR","segments":1,"reverse":false} full_sync: {"started":"Sat, 05 Feb 2022 14:12:51 +0000","finished":"Sat, 05 Feb 2022 14:12:55 +0000","progress":{"options":{"finished":true},"functions":{"finished":true},"constants":{"finished":true},"users":{"total":"1","sent":1,"finished":true,"last_sent":"1"},"network_options":{"finished":true}},"config":{"options":true,"functions":true,"constants":true,"users":[1],"network_options":true}} sync_size: undefined sync_lag: 0 seconds full_sync_size: undefined full_sync_lag: 0 seconds idc_urls: {"home":"https:\/\/mayburys.uk","siteurl":"https:\/\/mayburys.uk","WP_HOME":"","WP_SITEURL":""} idc_error_option: false idc_optin: true cxn_tests: All Pass.
Any other things I can do to help?
Thanks for sharing the site report.
Testing this in a separate environment with the same discount rule would be the first best thing to try.
We imported discount rules which caused the error in one site, but they worked fine in our own environments, suggesting an involvement of additional factors. So it would be good to know what the differences are if your resulting behavior is similar.
Otherwise, we’d be interested in a copy of the export file from your discount rule.
Thanks!Kind regards,
NiklasHello Niklas,
I have an update for you….
So I went ahead and played around on my other website, there are no other plugins. The same error started happening.
I then played around with different settings in the Woo Discount Rule plugin. I believe I have a solution to this issue!
I have tried this solution on both of my websites an I am delighted to confirm…. ALL IS WORKING AS EXPECTED!So what I have found-
In the Woo Discount Rule plug in when creating a discount you have two options, one is to display the discount as a coupon in the basket, or it can just change the product price.
If you have the checkbox ticked “Show discount in cart as coupon instead of changing the product price ?” – The PayPal plugin error occurs.If you ensure than all discounts created with this plugin are changing the product price and not showing in the basket as a coupon this error does not happen.
This may also explain your thoughts regarding this happening to some and not others, i believe all users who use this plug in will get this error if they have the box ticked to show as a coupon. You may be able to recreate this issue now too.
We’re also having this issue, with the Woo Discount Rule plugin. It throws the following error
[UNPROCESSABLE_ENTITY] The requested action could not be performed, semantically incorrect, or failed business validation. https://developer.paypal.com/docs/api/orders/v2/#error-CANNOT_BE_NEGATIVE
or
CANNOT_BE_NEGATIVE Must be greater than or equal to 0. If the currency supports decimals, only two decimal place precision is supported.
I’m assuming the discount value is being returned incorrectly
@flycart – might need to take a look into this issue.
Hi there,
Thanks for testing further. Considering the negative value sent to PayPal is usually the discount value, it could make sense for this setting to be relevant:
Show discount in cart as coupon instead of changing the product price ?
That being said though, we did a bunch of tests with it and so far we’re not able to reproduce the error.@cantraig With the minimum setup with only WooCommerce and PayPal Payments active, do you see the difference in behavior when enabling/disabling the mentioned checkbox? This setting alone doesn’t make a difference for us.
What does it look like for you @gazthink3? Does disabling the mentioned setting make a difference?We’d appreciate it if you could maybe share an export of your rule so we can be sure to test the same rule. We have done the same testing in the past though with no tangible results as we can usually only fix eventual issues we are able to reproduce or fully understand.
Kind regards,
NiklasI set up a new system to verify as this didn’t make too much sense and could actually reproduce it with the abovementioned setting then. We’ll need to look into it further also to understand what’s different in the first nevironment, but that should help already.
Thanks again for your input. I will provide a status update when I heard back from our developers.Kind regards,
Niklas@niklasinpsyde, there is a setting that seemed to work for us as a temporary fix.
Change Apply cart discount as from Fee to Coupon.
Reference – https://i.imgur.com/8VLV1i5.png
We have a similar issue with the plugin Worldz, that apply discount based on customer’s social media data.
We have no control whatsoever regarding how that plugin implement the discount. Should I roll back to the PayPal Standard payment method?
Hello,
I am facing a similar issue with another plugin that applies discounts by adding a negative fee item to the cart.
@niklasinpsyde on debugging a little on my own, I think the issue only occurs if discounts are applied as cart fees as a negative value.
Here are the logs I got with logging enabled,
DEBUG POST https://api.paypal.com/v2/checkout/orders Request Body: {"intent":"CAPTURE","purchase_units":[{"reference_id":"default","amount":{"currency_code":"USD","value":"89.91","breakdown":{"item_total":{"currency_code":"USD","value":"89.91"},"shipping":{"currency_code":"USD","value":"0.00"},"tax_total":{"currency_code":"USD","value":"0.00"}}},"description":"","items":[{"name":"My Product Name","unit_amount":{"currency_code":"USD","value":"9.99"},"quantity":10,"description":"My Product Description","sku":"","category":"DIGITAL_GOODS","tax":{"currency_code":"USD","value":"0.00"}},{"name":"Group Discount","unit_amount":{"currency_code":"USD","value":"-9.99"},"quantity":1,"description":"","sku":"","category":"PHYSICAL_GOODS","tax":{"currency_code":"USD","value":"0.00"}}],"payee":{"merchant_id":"MERCHANT_ID"}}],"application_context":{"user_action":"CONTINUE","shipping_preference":"GET_FROM_FILE","landing_page":"LOGIN","locale":"en-US","brand_name":"MY WEBSITE NAME","return_url":"https:\/\/www.my-site-url.com\/?wc-ajax=ppc-return-url","cancel_url":"https:\/\/www.my-site-url.com\/checkout\/"},"payer":{"name":{"given_name":"","surname":""},"email_address":"[email protected]","address":{"country_code":"US","admin_area_1":"CA"}},"payment_method":{"payee_preferred":"UNRESTRICTED","payer_selected":"PAYPAL"}} Response Debug ID: DEBUG_ID Response: Array ( [code] => 422 [message] => Unprocessable Entity ) Response Body: {"name":"UNPROCESSABLE_ENTITY","details":[{"field":"/purchase_units/@reference_id=='default'item/1/unit_amount/value","value":"-9.99","issue":"CANNOT_BE_NEGATIVE","description":"Must be greater than or equal to 0. If the currency supports decimals, only two decimal place precision is supported."}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"DEBUG_ID","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-CANNOT_BE_NEGATIVE","rel":"information_link","method":"GET"}]} WARNING Failed to create order. PayPal API response: [UNPROCESSABLE_ENTITY] The requested action could not be performed, semantically incorrect, or failed business validation. https://developer.paypal.com/docs/api/orders/v2/#error-CANNOT_BE_NEGATIVE ERROR Order creation failed: [UNPROCESSABLE_ENTITY] The requested action could not be performed, semantically incorrect, or failed business validation. https://developer.paypal.com/docs/api/orders/v2/#error-CANNOT_BE_NEGATIVE ERROR Order creation failed: [UNPROCESSABLE_ENTITY] The requested action could not be performed, semantically incorrect, or failed business validation. https://developer.paypal.com/docs/api/orders/v2/#error-CANNOT_BE_NEGATIVE
Hope this helps diagnose the exact issue source.
Apparently the issue is solved now.
Does any of you still face the issue?
Can somebody confirm that has been taken care of?
Thank youHi,
I still have the same issue with Woo Discount Rules if i use the option “Apply cart discount as Fee”.
If I set as a coupon no error.
I hope the coming version will fix this problem ??Regards,
Hi @niklasinpsyde,
I’m facing the same issue. Simply add a fee (negative value) to use as a discount. This is the preferred way since woocommerce doesn’t support any other discount methods except coupons.
This looks really bad that the plugin is not tested with such inputs.
The plugin is unable to work with that.
Can you please escalate this issue with severity to your team?
- The topic ‘CANNOT BE NEGATIVE [UNPROCESSABLE ENTITY|’ is closed to new replies.