Deploy the Application

Applies to: Web Payments SDK | Payments API

Learn how to deploy the application with the Web Payments SDK quickstart project.

Link to section

Overview

Deploy your application in your production environment with the following tasks:

  • Replace your Sandbox access token and application ID with production values.
  • Update your code to make API calls to Square production endpoints.

Important

Your account must be activated to accept payments. Be sure to activate your account before continuing with this quickstart. If the Developer Console Credentials page indicates that your account isn't activated, follow the steps to activate it.

Link to section

Deployment tasks

Deployment tasks include the following:

  1. Get production application credentials - In the Get application credentials section, you obtained Sandbox credentials. Follow the steps to open the Developer Console, but this time choose Production mode and copy the production application ID and access token.
  2. Update script references - In the Attach the Card payment method to the pay elements section, you added script references in index.html. Update the domain string in the JavaScript reference from sandbox.web.squarecdn.com/v1/square.js to web.squarecdn.com/v1/square.js.
  3. Provide your production application ID - The Web Payments SDK requires a valid application ID to return a payment token. In the Get application credentials section, you provided a Sandbox application ID. Update the code by providing your production application ID.
  4. Configure your backend server to use a production access token - In the Configure the quickstart access token section, you provided a Sandbox access token in the env.sandbox file. Replace it with the production access token.

If you want to test the application in a production environment (squareup.com), you must use an actual payment card. Note that Square actually charges payment cards in production. Therefore, if you must test in production, charge minimum amounts.

Did you know?

Note the following for future application Sandbox tests or application deployments:

  • If you have a Sandbox access token, use the sandbox.web.squarecdn.com/v1/square.js Sandbox URL for Sandbox tests.
  • If you have a production access token, use the web.squarecdn.com/v1/square.js production URL for deployments.

After you declare the access token and URL, the Web Payments SDK initializes the square.js script each time you run the application. As a result, Square takes care of the payment processing tasks according to the access token and URL you specified.

Link to section

Next steps

Now that you're taking payments with credit and debit cards, you can add additional payment methods or customize the appearance of the Card payment method.

With card information and SCA, you can also save and charge card information on file with additional code for your application. For more information, see:

The Web Payments SDK API Reference also provides a complete reference about supported payment methods, objects, enums, errors, and code examples.