<script type="text/javascript" src="https://app-wallee.com/assets/js/i18n/address-handler.js"></script>
<script type="text/javascript">
var address = {
"givenName": "Marc",
"familyName": "Stiffer",
"street": "Some Street Name including street number etc.",
"postcode": "The post code of the address. e.g. 8000",
"country": "US",
"postalState": "CA",
"city": "Some City Name"
};
AddressHandler.validateAddress(address).then(function(){
// You may want to continue processing here.
console.log("The address is valid.");
}, function(invalidFields){
console.log(invalidFields);
for(var i = 0; i < invalidFields.length; i++){
var fieldName = invalidFields[i].field;
var errorMessage = invalidFields[i].message;
// Here you may want to implement the user feedback about the invalid address field.
console.log("The field " + fieldName + " is invalid. Error: " + errorMessage);
}
});
</script>