CANNOT_BE_NEGATIVE Error When Paying with Paypal2021-09-01T21:03:06+05:30

Home Forums Core CANNOT_BE_NEGATIVE Error When Paying with Paypal

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • johnbautista
    Participant
    Post count: 4

    Hi Team,

    Has anyone experienced a UNPROCESSABLE_ENTITY CANNOT_BE_NEGATIVE error when checking out with Paypal? Our site has been using TeraWallet with WooCommerce PayPal Payments and before the latter’s update last week, all has been working as expeted.

    Now it seems to us that there’s incompatibility between the two plugins. We’re in limbo because we can’t seem to figure out which author should we contact to get some help. It’s worth noting that whatever’s the balance of the wallet, is the same negative value that PayPal is complaining about.

    Finally, our PayPal contact told us that the developer of the plugin should amend their code to add a new discount property to indicate the discount from the wallet (and perhaps for any discounts a coupon might apply). Here’s the sample payload – notice the discount property.

    purchase_units: [
     {
             description: "Coffee Things",
             amount: {
           currency_code: "USD",
           value: "13.00",
             breakdown: {
                item_total: {
                                       currency_code: "USD",
                                       value: "15.00"
                },
                shipping: {
                                       currency_code: "USD",
                                       value: "2.00"
                },
                              tax_total: {
                                       currency_code: "USD",
                                       value: "1.00"
                 },  
                              discount: {
                                       currency_code: "USD",
                                       value: "5.00"
                              }
                     }
          },
    Subrata Mal
    Keymaster
    Post count: 162

    Hi,

    Please deactivate our plugin and check. If the issue solves then please let us know. As per your payment request arguments, there is no wallet entry. So we think this might be because of any other plugin.

    johnbautista
    Participant
    Post count: 4

    Hi Subrata, thanks for your reply. Apologies for the confusion, the payload above was the pattern suggested by PayPal engineers to follow.

    The payload below is the actual payload that PayPal has identified as a call that came from the merchant (our website).

    “items”: [

    {

    “category”: “PHYSICAL_GOODS”,

    “description”: “”,

    “name”: “Via wallet”,

    “quantity”: 1,

    “sku”: “”,

    “tax”: {

    “currency_code”: “USD”,

    “value”: “0.00”

    },

    “unit_amount”: {

    “currency_code”: “USD”,

    “value”: “-11.79”

    }

    }

    ],

    The -11.79 was the value of the wallet during checkout for this specific user. Hope that helps clarify.

    Meanwhile, there’s no issue with users that has no wallet balance during checkout. This can simulate to some degree the disabling of the plugin because no wallet-related amount is passed to PayPal.

    Aooreciate your response, Subrata.

    • This reply was modified 3 months, 1 week ago by johnbautista.
    • This reply was modified 3 months, 1 week ago by johnbautista.
    Subrata Mal
    Keymaster
    Post count: 162

    Please share the full order payload details.

    Subrata Mal
    Keymaster
    Post count: 162

    Also please check if this error is happening with the default WooCommerce coupon or not.

    johnbautista
    Participant
    Post count: 4

    Hi Subrata, can you share more information on how I can capture the full order payload details? I tried capturing the payload submitted to PayPal through my Chrome Dev Tools but the purchase_unit property seems empty.

    {"nonce":"9a51a0dc5c","purchase_units":[],"bn_code":"Woo_PPCP","payer":{"email_address":"myemail@gmail.com","name":{"surname":"Super","given_name":"Super"},"address":{"country_code":"US","address_line_1":"124124 asdfasdf","address_line_2":"","admin_area_1":"ALB","admin_area_2":"asdfadfadf","postal_code":"23523"},"phone":{"phone_type":"HOME","phone_number":{"national_number":"35235"}}},"context":"cart"}

    Is there a better way to catch the payload?

    Re: the coupon, yes, the error shows up every time a cart is submitted through PayPal and the user has a balance greater than zero. All regardless if a default WooCommerce coupon is applied or not. On the other hand, if I don’t select PayPal as my payment method, it proceeds to the checkout page as expected.

    Subrata Mal
    Keymaster
    Post count: 162

    Okay, the PayPal Payments plugin is new and we believe that the plugin is not fully compatible with WooCommerce but not sure. Could you please try with deactivate our plugin and using the WooCommerce default coupon? As we are using the default WooCommerce negative fee for partial payment.

    Also, you can disable partial payment using code

    add_filter('woo_wallet_disable_partial_payment', '__return_true');

    johnbautista
    Participant
    Post count: 4

    I’ll try that and will get back to you. Also appreciate your candor when it comes to the new PayPal plugin’s possibly incompatibility. We’re also considering that but was truly in the fence on who we should contact: your team or theirs.

    Just looking at the most recent reviews of their new plugin, I have reasons to believe that the issue resides on their end.

    Still, I appreciate your time Subrata for going above and beyond. I’ll get back to you on your suggestion.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.