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 Console 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
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.
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
Payment
object with thestatus
field set toCOMPLETED
.
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.