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.

Link to section

Create a payment

After you create an account (as described in Create an Account and Application), the Developer Dashboard opens and displays the following blue banner:

An image of the "create your first test payment" banner.

  1. Choose the Open API Explorer link on the banner. This opens API Explorer and populates all the fields that are required to send a CreatePayment request to the Payments API.

    Note

    If you don't see the banner, use this API Explorer link to open the prepopulated view directly.

  2. Choose Run Request.

  3. 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 Payment object with the status field set to COMPLETED.

An image of API Explorer populated with CreatePayment values.

The 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're 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.