Testing Square APIs with Postman
Use the Connect Postman collection to test Square APIs.
On this page
The API call example in this article creates a new sandbox charge. To make the call, you must have a valid payment nonce. You can use the sandbox test nonce (
cnon:card-nonce-ok) or get a nonce from the Square Payment Form with credit card sandbox test values.
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.
If you have not already, visit the Postman website and install the preferred version for your system.
Click the Run in Postman button below to open Postman and import the Square Connect API Postman collection.
Our collection makes use of Postman environment variables. Start by creating a sandbox environment.
Open the "Environment options" panel by clicking on the gear icon, then click Manage Environments. To create a new environment, click Add.
Name your environment something that indicates it is using sandbox credentials, for example "Square Sandbox".
Add a key/value pair with "access_token" as the key and your sandbox access token as the value.
Add a key/value pair with "location_id" as the key and a sandbox location ID as the value.
Add a key/value pair with "host" as the key and
connect.squareupsandbox.comas the value.
When you are finished adding key/value pairs, click Add. Now, any test calls you make using this environment will automatically fill in the
location_idwith 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.
Make a call to the CreatePayment endpoint using your sandbox environment:
Click the dropdown menu next to the gear icon and choose your sandbox environment from the menu.
Open the Payments folder, then click CreatePayment.
Click the Body tab to see the body of the create payment request.
Update line 22 of the JSON body to:
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 payment.