We have a public website using Apple Pay with the JS Library. We use Adyen as payment gateway and Avalara to calculate taxes. We've recently discovered a lot of errors in regards of ApplePay token amount-mismatch errorType error. This mean the amount authorized by ApplePay does not match the amount sent to Adyen for authorization. Here's the root cause:
Applepay only reports full address including address line 1 after user authorizes the transaction with ApplePay using the session.onshippingcontactselected event. At this point we only have the following - City, Region, Country, Zip
So, the total order value is based on what Avalara reports the tax is using these fields. For an example order using this zip code 94534, the tax is calculated as $1.84 at this point.
After we receive the authorization from Applepay, we also receive the full address. This address is then sent to the backend to recalculate the cart (including tax). This is just before calling Adyen API
For this specific cart, since now the Address has AddressLine1, the zip code (94534) along with address line 1 results in a different tax from Avalara ($2.09)
This could easily be solved if we can make Apple Pay to return the AddressLine1 from the initial callback to session.onshippingcontactselected, this would solve our problems. Is there a way to force the call to session.onshippingcontactselected to return the AddressLine1 field as part of the response?
Is there any work around for this?
Thanks and Regards