Postman Overview

Use the Connect Postman collection to test Square APIs.

Link to section

Before you start

The API call example in this topic creates a new Sandbox charge. To make the call, you must have a valid payment token. You can use the Sandbox test payment token (cnon:card-nonce-ok) or get a payment token from the Square Web Payments SDK with credit card Sandbox test values.

Link to section

What is Postman?

Postman is an application for easy RESTful API exploration. You can use Postman to test API calls multiple times without having to write code or install Square SDKs. You can save multiple sets of credentials to quickly test API calls in the Sandbox and in production.

Link to section

Step 1: Get the Postman collection

  1. If you haven't already installed Postman, visit the Postman website and install the preferred version for your system.

  2. Choose the following Run in Postman button to open Postman and import the Square Connect API Postman collection.

    A graphic showing the Run in Postman button.

Link to section

Step 2: Create your Postman environment

The Square collection makes use of Postman environment variables. Start by creating a Sandbox environment.

  1. Choose the gear icon to open the Environment options panel, and then choose Manage Environments.
  2. To create a new environment, choose Add.
  3. Name your environment with a descriptive title that indicates it's using Sandbox credentials (for example, Square Sandbox).
  4. Add a key/value pair with access_token as the key and your Sandbox access token as the value.
  5. Add a key/value pair with location_id as the key and a Sandbox location ID as the value.
  6. Add a key/value pair with host as the key and connect.squareupsandbox.com as the value.
  7. When you're finished adding key/value pairs, choose Save.

Now, any test calls you make using this environment automatically fill the access_token and location_id with your Sandbox credentials. You can also create production environments that use your production credentials, locations, and the host set to connect.squareup.com instead of your Sandbox assets.

Link to section

Step 3: Call the CreatePayment endpoint

Make a call to the CreatePayment endpoint using your sandbox environment:

  1. On the drop-down menu next to the gear icon, choose your Sandbox environment.
  2. Open the Payments folder, and then choose CreatePayment.
  3. Choose the Body tab to see the body of the CreatePayment request.
  4. Update line 8 of the JSON body to: "source_id": "cnon:card-nonce-ok",.
  5. Choose Send.

Postman now uses your Sandbox credentials to make the call.

The Square API collection includes folders for each Square API with preconfigured 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 payment.