Configure the Orders API sample application with your developer credentials.
Order-Ahead Sample Application

Step 2: Configure the Order-Ahead Sample Application

Download the order-ahead sample application from GitHub and complete the following steps to configure the sample application for your environment.

To configure the order-ahead sample application:

  1. Download the order-ahead sample application from GitHub.

  2. In the root directory of the sample, create a copy of the .env.example file and name the new file .env.

  3. In the .env file, replace the placeholder SQUARE_SANDBOX_ACCESS_TOKEN and SQUARE_SANDBOX_APPLICATION_ID values with the Sandbox credentials that you copied in Step 1: Get Developer Credentials.

    For example:

    You can optionally set your production credentials; however, you work in the Square Sandbox for the rest of this tutorial.


    You should use your own credentials only for testing the sample application. If you plan to make a version of this sample application available for your own purposes, use the OAuth API to securely obtain and manage access to Square accounts.

When you have finished setting your credentials, you can test the order-ahead sample application to confirm that you have authorized your application.

To test the order-ahead sample application:

  1. Run the following command in the root directory of the order-ahead sample application:

  2. Open localhost:3000 in your browser. If your sample application is set, you should see a gray screen with your business location name at the top.

    Did you know?

    Do not worry if you see the following error message: "Cannot read property ‘image_data’ of undefined." You work on importing catalog items in Step 3: Generate Test Catalog Items.

We've made improvements to our docs.
Prefer the old format?