craftcms / commerce-paypal-checkout

PayPal Checkout gateway for Craft Commerce.
https://plugins.craftcms.com/commerce-paypal-checkout
MIT License
5 stars 10 forks source link

Decimal precision error on refund #33

Closed adamtsai1 closed 3 years ago

adamtsai1 commented 3 years ago

Description Paypal rejects my refund request with the error response below. It appears the value being submitted is not being rounded properly.

"message": "{ \"name\":\"UNPROCESSABLE_ENTITY\", \"message\":\"The requested action could not be performed, semantically incorrect, or failed business validation.\", \"debug_id\":\"9c4d19e33f51b\", \"details\":[{ \"issue\":\"DECIMAL_PRECISION\", \"field\":\"/amount/value\", \"value\":\"24.89999999999999857891452847979962825775146484375\", \"description\":\"The value of the field should not be more than two decimal places.\", \"location\":\"body\" }], \"links\":[{ \"href\":\"https://developer.paypal.com/docs/api/payments/v2/#error-DECIMAL_PRECISION\", \"rel\":\"information_link\" }] }"

To Reproduce Issue a refund from the "Transactions" tab of an order entry.

Expected behavior For PayPal to accept the refund.

Additional info

nfourtythree commented 3 years ago

Hi @adamtsai1

Could you send a dump of your DB to support@craftcms.com so we can take a look.

If you are unable to send the whole DB a screenshot or text file of the transaction rows data for this order would be good.

Thanks!

nfourtythree commented 3 years ago

Hi @adamtsai1

I believe this may have been caused by a bug in Commerce itself.

We have just released version 3.3.1 of Commerce which has a bug fix in for a rounding issue related to transaction amounts.

Please update to this version. I am going to close this ticket for now, please post a reply if you are still having issues after updating.

Thanks!