No Billing Postal Code? No Problem!
How To Remove the Postal Code Field (Square Payment Form)
Heads up, we’ve moved! If you’d like to continue keeping up with the latest technical content from Square please visit us at our new home https://developer.squareup.com/blog
As Square’s eCommerce platform expands outside the United States and Canada, we’ve heard feedback from developers in other countries (e.g. Japan & Australia), where requesting billing postal codes is uncommon, that they’d like to remove the postal code field in their eCommerce Payment Form.
Good news! Effective today, to remove the postal code field, all you need to do is change one line of code.
When you load the eCommerce Payment Form — replace:
postalCode: {
elementId: 'sq-postal-code'
}
With the following:
postalCode: false
Once this is done, the payment form will load without the postal code field!
Warning: the postal code field is still required to process payment online for merchants based in the United States, Canada, and United Kingdom. Removing the field will result in these transactions being declined. With the following error message:
{
"errors": [
{
"category": "INVALID_REQUEST_ERROR",
"code": "INVALID_VALUE",
"detail": "Postal code is required for nonces used by merchants in `US`"
}
]
}
Additional Reading
If you are interested in learning more about how to style the payment form, you can read about it here.