Forum Replies Created

Viewing 1 replies (of 1 total)
  • 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.

Viewing 1 replies (of 1 total)