Testing

Testing Square APIs with Postman

Learn how to use our Postman collection to test Square APIs.

What is Postman?

Postman is an app for easy RESTful API exploration. You can use Postman to test API calls multiple times without having to write code or install our SDKs. And you can save multiple sets of credentials so you can quickly and easily test API calls in sandbox and production.

Step 1: Get the Postman collection

  1. If you have not already, visit https://www.getpostman.com/ and install the preferred version for your system.
  2. Click the Run in Postman button below to open Postman and import the Square Connect API Postman collection.

Run in Postman

Step 2: Create your Postman environment

Our collection makes use of Postman's environment variables to easily manage your API credentials. Start by creating a sandbox environment.

  1. Open the "Environment options" panel by clicking on the gear icon, then click Manage Environments. To create a new environment, click Add.
  2. Name your environment something that indicates it is using sandbox credentials, for example "Square Sandbox".
  3. Add a key/value pair with "access_token" as the key and your sandbox access token as the value.
  4. Add a key/value pair with "location_id" as the key and a sandbox location ID as the value.
  5. When you are finished adding key/value pairs, click Add. Now, any test calls you make using this environment will automatically fill in the access_token and location_id with your sandbox credentials.

You can also create production environments that use your production credentials and locations instead of sandbox assets.

Step 3: Make a call to the Charge endpoint

Make a call to the Charge endpoint using your sandbox environment.

  1. Click the dropdown menu next to the gear icon and choose your sandbox environment from the menu.
  2. Open the Transaction folder, then click Charge.
  3. Click Send. Postman will use your sandbox credentials to make the call.

The Square Connect API collection includes folders for each Square Connect v2 API with pre-configured calls you can use to test each endpoint. Read Getting Started with Postman on the Square Corner blog for a step-by-step walkthrough demonstrating how to create a customer profile and reference it in a sandbox transaction.

Prev
< Sandbox Support
Next
Running Local Web Servers >

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