0

I am having a problem getting 3DSecure to work on my site. I get the following error. The JSON request I am getting back a 422 error from api.braintree.com

{
   "error":{
      "message":"Amount can be any number of digits optionally followed by a decimal point `.` and up to two decimal places following the decimal point. Commas `,` are not allowed."
   },
   "threeDSecureInfo":{
      "liabilityShifted":false,
      "liabilityShiftPossible":false
   }
}

This is the request data

{
   "_meta":{
      "integration":"custom",
      "integrationType":"custom",
      "merchantAppId":"xxxx.com",
      "platform":"web",
      "sdkVersion":"3.48.0",
      "sessionId":"3df9a6aa-46d1-494b-bff3-7a850a6ff13d",
      "source":"client"
   },
   "additionalInfo":{
      "billingCity":"xxxx",
      "billingCountryCode":"xx",
      "billingGivenName":"xxx",
      "billingLine1":"xxxxx Road",
      "billingPhoneNumber":"xxx-xxx-xxxx",
      "billingPostalCode":"xxxx",
      "billingState":"xx",
      "billingSurname":"xxxx",
      "shippingCity":"xxxx",
      "shippingCountryCode":"xx",
      "shippingGivenName":"xxxx",
      "shippingLine1":"xxx Road",
      "shippingPhone":"xxx-xxx",
      "shippingPostalCode":"xxxx",
      "shippingState":"xxx",
      "shippingSurname":"xxxx"
   },
   "**amount":12.0499**,
   "authorizationFingerprint":"eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiIsImtpZCI6IjIwMTgwNDI2MTYtcHJvZHVjdGlvbiIsImlzcyI6Imh0dHBzOi8vYXBpLmJyYWludHJlZWdhdGV3YXkuY29tIn0.eyJleHAiOjE1OTYyMTA2NDQsImp0aSI6IjcxNTQxYzA0LTZkNDItNDlhZi1iODc2LTBmZjA1ZWEwNDRhMSIsInN1YiI6ImJqcXY3cGpqbXJrajc4cHIiLCJpc3MiOiJodHRwczovL2FwaS5icmFpbnRyZWVnYXRld2F5LmNvbSIsIm1lcmNoYW50Ijp7InB1YmxpY19pZCI6ImJqcXY3cGpqbXJrajc4cHIiLCJ2ZXJpZnlfY2FyZF9ieV9kZWZhdWx0IjpmYWxzZX0sInJpZ2h0cyI6WyJtYW5hZ2VfdmF1bHQiXSwic2NvcGUiOlsiQnJhaW50cmVlOlZhdWx0Il0sIm9wdGlvbnMiOnsibWVyY2hhbnRfYWNjb3VudF9pZCI6ImxlZHJvcGVsaWdodHNDQUQifX0.naHfA02qt5clJXYGGg7xxTfKKdaJOMFR0NZCfDbTxUR_f6vk1skBe8BH0afOYpwXsEf4Iz8YGDy1an7vLN33sg",
   "braintreeLibraryVersion":"braintree/web/3.48.0",
   "clientMetadata":{
      "cardinalDeviceDataCollectionTimeElapsed":3,
      "requestedThreeDSecureVersion":"2",
      "sdkVersion":"web/3.48.0"
   },
   "dfReferenceId":"0_3767710b-425b-4ba7-83a1-6d72a4619ff4"
}

The problem is that Magento is passing amount":12.0499 which has 4 decimal places. The Braintree API is expecting only 2. My system is displaying the correct number of decimal places as 2 on the frontend. I am not sure how to force Magento to send only 2 decimal places?

Thank you for your help.

Request

Reponse

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.