Square

Connecting to Square

Set the LocationId property to specify a default business location. Or, set the LocationId in the search criteria of your query.

To retrieve the Id, query the Locations table after you authenticate.

Authenticating to Square

You can use a personal access token to authenticate to Square or use the OAuth standard. Use a personal token to access your own data or to test through the sandbox. Use OAuth to allow other users to access their own data.

Personal Access Token

Set the OAuthAccessToken connection property to your personal token, which can be obtained by following the steps below:

  1. Navigate to the Developer Dashboard and Create an OAuth App as explained below.

  2. Once the app is created, the token is listed on the Credentials tab.

Square Sandbox

Version 2 of the Connect API allows you to test in a sandbox environment. Transactions created in the sandbox are not sent through to card networks, and cards are never charged.

To connect to the sandbox, set OAuthAccessToken to the sandbox access token, which is available alongside your standard personal access token:

  1. Navigate to the Developer Dashboard and Create an OAuth App as explained below.

  2. Once the app is created, the sandbox token is listed on the Credentials tab.

In addition to OAuthAccessToken, set Schema to "V2", UseSandbox to "True".

OAuth

OAuth requires the authenticating user to interact with Square using the browser. See Connecting to Square below. You can connect without setting any connection properties for your user credentials. After setting InitiateOAuth to GETANDREFRESH, you are ready to connect. When you connect the provider opens the Square OAuth endpoint in your default browser. Log in and grant permissions to the provider. The provider then completes the OAuth process.

  1. Extracts the access token from the CallbackURL and authenticates requests.

  2. Refreshes the access token when it expires.

  3. Saves OAuth values in OAuthSettingsLocation to be persisted across connections.

Note: The provider is already registered with Square as an OAuth application and will automatically use its embedded OAuthClientId and OAuthClientSecret to connect. If you want to use your own custom OAuth app, see Create an OAuth App to obtain these connection properties. In this OAuth flow, you can authenticate without setting any connection properties for your user credentials. Click Connect and the provider opens the Square OAuth endpoint. Log in and grant permissions to the provider. The provider then completes the OAuth process.

Connecting to Square

You can use a personal access token to authenticate to Square or use the OAuth standard. Use a personal token to access your own data or to test through the sandbox. Use OAuth to enable other users to access their own data.

Using a Personal Access Token

Set the OAuthAccessToken connection property to your personal token, which can be obtained by following the steps below:

  1. Navigate to the Developer Dashboard and see Create an OAuth App below.

  2. Once the app is created, the token is listed on the Credentials tab.

Using the Square Sandbox

Version 2 of the Connect API allows you to test in a sandbox environment. Transactions created in the sandbox are not sent through to card networks, and cards are never charged.

To connect to the sandbox, set OAuthAccessToken to the sandbox access token, which is available alongside your standard personal access token:

  1. Navigate to the Developer Dashboard and see Create an OAuth App below.

  2. Once the app is created, the sandbox token is listed on the Credentials tab.

Using OAuth

OAuth requires the authenticating user to interact with Square using the browser. The provider facilitates this in various ways as described below.

Authenticate to Square from

You can connect without setting any connection properties for your user credentials. After setting InitiateOAuth to GETANDREFRESH, you are ready to connect. You can use the GETANDREFRESH configuration to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.

When you connect, the provider opens the OAuth endpoint in your default browser. Log in and grant permissions to the application. The provider then completes the OAuth process.

  1. Extracts the access token from the callback URL and authenticates requests.

  2. Obtains a new access token when the old one expires.

  3. Saves OAuth values in OAuthSettingsLocation to be persisted across connections.

Note: The provider is already registered with Square as an OAuth application and will automatically use its embedded OAuthClientId and OAuthClientSecret to connect. If you want to use your own custom OAuth app, see Create an OAuth App below to obtain these connection properties.

Create an OAuth App

You can follow the procedure below to register a custom OAuth app and obtain the OAuth client credentials, the Application Id and Application Secret. You will need to sign up for a Square account before starting this procedure.

  1. Navigate to the Developer Dashboard and create an app.

  2. Enter a name to be displayed to users when they log in to grant permissions to your app.

  3. Click Create App. Set the Redirect URL on the OAuth tab to http://localhost:33333 or a different port number of your choice. If you are making a desktop application, set the Redirect URL, on the OAuth tab, to http://localhost:33333 or a different port number of your choice.

    If you are making a Web application, set the Redirect URL, on the OAuth tab, to a page on your Web app you would like the user to be returned to after they have authorized your application. Set CallbackURL to be equal to the value of the Redirect URL.

Set OAuthClientId to be equal with the Application Id on the Credentials page and set OAuthClientSecret to be equal to the Application Secret on the OAuth tab.

Last updated