Payment Form: Cookbook

Remove the Postal Code Requirement from the Square Payment Form

Remove the postal code field for users in regions where a postalcode is not required to process payments.

Payment Form

Before you start

  • You have integrated the payment form into your web application.
  • Your web application can get the location country of the merchant who is using the application.
    • If you look up the merchant's location by using the Locations API, You will need an access token. If you are using OAuth, you will need the MERCHANT_PROFILE_READ permission.

Step 1: Get the location country of the merchant

  1. Follow the steps in the Search for Locations recipe to find the appropriate location. To accept card payments, a location must have ACTIVE status and be enabled for CREDIT_CARD_PROCESSING.
  2. Parse the response to find the location you are interested in.
  3. Confirm the location.country field of the location IS NOT: US, CA, or GB.
## Step 2: Remove the postal code requirement
  1. Update your SqPaymentForm initializing logic to set postalCode to false:
// Create and initialize a payment form object
var paymentForm = new SqPaymentForm({

...

  postalCode: false,

  // SqPaymentForm callback functions
  callbacks: {
      ...
  }
});

Contact Developer Support, join our Slack channel, or ask for help on Stack Overflow