When displaying the single card element on my web application, a Zip code is required
instead of postcode. The location is set to a UK location from the sandbox and the local is set ‘en-GB’. It is not just a question of the label, it validates as a ZIP code and removes letters if you set the postalCode in the CardOptions (Eg ‘L22 8QL’ is displayed as ‘28’). Can this be fixed and if not, what is the alternative to the single card element?
PaymentPromise :
payments = window.Square.payments(appId, locationId);
payments.setLocale(‘en-GB’);
Card Options :
return {
“style”: cardStyle,
“postalCode”: “L22 8QL”,
};
Is this with the Web Payments SDK or the beta deprecated single card element?
If it’s with the Web Payments SDK the Card payment method automatically infers whether to display the postal code and copy (ZIP code, postal code, or postcode) based on the issuing country of the buyer’s credit card. Depending on the card that’s used, the SDK automatically removes the postal code if the card’s issuing country does not require the postal code for the payment. If you’re using a sandbox test value they are US based postal codes. If you enter a card number from a different region then the form will infer the changes.
I am using the the Web Payments SDK and your solution worked. Thanks for your assistance.
Glad to hear it’s working as expected.