Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coupon causes TAX_TOTAL_MISMATCH (333) #372

Closed
AlexP11223 opened this issue Nov 18, 2021 · 2 comments · Fixed by #373
Closed

Coupon causes TAX_TOTAL_MISMATCH (333) #372

AlexP11223 opened this issue Nov 18, 2021 · 2 comments · Fixed by #373
Labels
bug Something isn't working
Milestone

Comments

@AlexP11223
Copy link
Contributor

AlexP11223 commented Nov 18, 2021

In some cases when a coupon is being used, the customer get error, TAX_TOTAL_MISMATCH.

POST https://api.paypal.com/v2/checkout/orders
Request Body: {"intent":"CAPTURE","purchase_units":[{"reference_id":"default","amount":{"currency_code":"USD","value":"80.16","breakdown":{"item_total":{"currency_code":"USD","value":"95.00"},"shipping":{"currency_code":"USD","value":"0.00"},"tax_total":{"currency_code":"USD","value":"6.54"},"discount":{"currency_code":"USD","value":"21.38"}}},"description":"","items":[{"name":"prod2","unit_amount":{"currency_code":"USD","value":"95.00"},"quantity":1,"description":"","sku":"","category":"PHYSICAL_GOODS","tax":{"currency_code":"USD","value":"6.53"}}],"payee":{"merchant_id":"9LJB9AXR9TPMU"},"shipping":{"name":{"full_name":"John Doe"},"address":{"country_code":"US","address_line_1":"1 Main St","address_line_2":"1","admin_area_1":"MN","admin_area_2":"ny","postal_code":"99501"}}}],"application_context":{"user_action":"CONTINUE","shipping_preference":"GET_FROM_FILE","landing_page":"LOGIN","locale":"en-US","brand_name":"\"WooCommerce PayPal Payments\"","return_url":"http:\/\/wc-pp.myhost\/?wc-ajax=ppc-return-url","cancel_url":"http:\/\/wc-pp.myhost\/checkout\/"},"payer":{"name":{"given_name":"John","surname":"Doe"},"email_address":"[email protected]","address":{"country_code":"US","address_line_1":"1 Main St","address_line_2":"1","admin_area_1":"MN","admin_area_2":"ny","postal_code":"99501"},"phone":{"phone_type":"HOME","phone_number":{"national_number":"4088381528"}}},"payment_method":{"payee_preferred":"UNRESTRICTED","payer_selected":"PAYPAL"}}
Response Debug ID: e999372fa047d
Response: Array
(
    [code] => 422
    [message] => Unprocessable Entity
)

Response Body: {"name":"UNPROCESSABLE_ENTITY","details":[{"field":"/purchase_units/@reference_id=='default'/amount/breakdown/tax_total/value","value":"6.54","issue":"TAX_TOTAL_MISMATCH","description":"Should equal sum of (tax * quantity) across all items for a given purchase_unit"}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"e999372fa047d","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-TAX_TOTAL_MISMATCH","rel":"information_link","method":"GET"}]}

Steps to reproduce

It seems like it is reproduced only in some environments.

I reproduced it in the docker env with WC 5.8, PHP 7.1.

Add a product with price $95, add tax 6.8750%, and $20 coupon.

image

image

image

Go to checkout, enter the coupon, pay, and this error will appear:

image

@Dinamiko Dinamiko added the bug Something isn't working label Nov 23, 2021
@Dinamiko Dinamiko added this to the Next version milestone Nov 23, 2021
@ajakeward
Copy link

Hi, is there any workarounds on this? We have an issue with our Black Friday sale now.

@Dinamiko
Copy link
Contributor

Hello @ajakeward,

The fix (#373) is tested and merged into trunk so it will be included in the next release (1.6.3), in the meantime I´m attaching the plugin package from trunk in case you want to use it:
woocommerce-paypal-payments.zip

@Dinamiko Dinamiko mentioned this issue Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants