Authorizing Square API in Astera Centerprise¶
Square API is an HTTP-based API that follows REST standards. It allows you to manage the resources of your Square account by making requests to URLs representing those resources. You can configure Square API for use in Astera Centerprise by providing its swagger definition using the Import API option in the REST API Browser.
1. After you have created the application in Square, go to Manage Properties.
2. Now go to OAuth properties in Production tab. Here, you have to provide the Redirect URL for the authorization callback.
Note: Save Applicant ID and secret to use it later for Centerprise authentication.
Reference Link: https://developer.squareup.com/docs/oauth-api/overview
3. Now create an integration project in Centerprise by following the instructions provided in this article. Also, import the following swagger definition in REST API Browser:
Base Url: https://raw.githubusercontent.com/square/connect-api-specification/master/api.json
4. Go to the Square’s shared action file’s (.sact) properties to authenticate it in Centerprise. Click here to learn more about how to work with APIs that require authentication.
You can authorize Square API by using Security Type OAuth 2 or Bearer Token. In this example, we will be authorizing using OAuth 2.
5. Set its Security Type as ‘OAuth 2’ and Grant Type as ‘Authentication Code’. Provide the application ID and secret that you had saved in step 2.
Click on Request Token to get the access token to Square API.
Auth Url: https://connect//squareup.com/oauth2/authorize
Access Token Url: https://connect.squareup.com/oauth2/token
Additional Info: You can modify your authorization by mentioning names of only those permissions that you want to access from your Square account in Centerprise. In case you want to access all of them, leave the settings at default.
6. Once you get the access token, save the Shared Action file and you are ready to use Square API in Centerprise.
This concludes authenticating the Square API in Astera Centerprise.