I get this error because the unit_amount
in CheckoutSdk.php
has 6 decimals instead of 2.
{"name":"UNPROCESSABLE_ENTITY","details":[@"field":"/purchase_units/@reference_id=='default'item/0/unit_amount/value","value":"49.903333","issue":"DECIMAL_PRECISION","description":"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":"a420329cadd78","links":[@"href":"https://developer.paypal.com/docs/api/orders/v2/#error-DECIMAL_PRECISION","rel":"information_link","method":"GET"]}
Is this related to this issue? https://www.drupal.org/project/commerce_paypal/issues/2846568
Comment | File | Size | Author |
---|---|---|---|
#3 | 3283973-3.patch | 948 bytes | mathiasgmeiner |
Comments
Comment #2
mathiasgmeiner CreditAttribution: mathiasgmeiner commentedThis is my first take on this bug.
Comment #3
mathiasgmeiner CreditAttribution: mathiasgmeiner commentedI've copied the calculation to the wrong line. Sorry for that inconvenience.
This should be the working patch.
Comment #4
jsacksick CreditAttribution: jsacksick at Centarro commentedwhy do you have a unit price with 6 decimals?
Comment #5
AnybodyThat's a valid question. Is the amount calculated dynamically or perhaps the result of a VAT calculation?
Of course this shouldn't fail, but instead be rounded to the expected number of decimals before.
Comment #6
mathiasgmeiner CreditAttribution: mathiasgmeiner commentedThe amount is the result of a VAT calculation.
Does that help?