Make your First API Call
Now that you have a Square account and application, you can make your first API call using API Explorer.
In API Explorer, create a payment using the Square Sandbox environment. Calls in the Sandbox use the
connect.squareupsandbox.com domain as the base URL.
After you create an account (as described in Create an Account and Application), the Developer Dashboard opens and displays the following blue banner:
Choose the Open API Explorer link on the banner. This opens API Explorer and populates all the fields that are required to send a
CreatePaymentrequest to the Payments API.
If you do not see the banner, use this API Explorer link to open the prepopulated view directly.
Choose Run Request.
Review the Request and Response panes:
The Request pane shows the request that was sent. You can change the default cURL view to see the request in another programming language.
The Response pane shows the response from Square. If the payment is successful, Square returns a
Paymentobject with the
statusfield set to
source_id in the request is a Sandbox payment token
that represents a credit card. In production, payment tokens are generated by the Web Payments SDK or In-App Payments SDK. For more information, see Take Payments.
Did you know?
For this Get Started exercise, API Explorer prefilled the Access token field for you. When you are using API Explorer in the future, choose the Change button and select your application. When selected, the Access token field is filled with your application token.
PreviousCreate an Account and App
NextView the API Logs
If you need more assistance, contact Developer Support or ask for help in the Developer Forums.