After you create an account and application, you can use API Explorer to call Square APIs. This exercise creates a payment in the Square Sandbox.
In the Developer Console, your application 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
Don't see the banner? Use this API Explorer link to open the prepopulated view.
In API Explorer, 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
. If the request failed, Square returns an error.
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.