Advanced Settings
Establishing a Connection
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.
Using a Personal Access Token
Set the OAuthAccessToken connection property to your personal token, which can be obtained by following the steps below:
- Log into the Application Dashboard and create an app.
- Click the app. 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:
- Log into the Application Dashboard and create an app.
- Click the app. The sandbox token is listed on the Credentials tab.
In addition to OAuthAccessToken, set Schema to "V2" and UseSandbox to "True".
Using OAuth
OAuth requires the authenticating user to interact with Square using the browser.
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.
Using a Personal Access Token
Set the OAuthAccessToken connection property to your personal token, which can be obtained by following the steps below:
- Log into the Application Dashboard and create an app.
- Click the app. 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:
- Log into the Application Dashboard and create an app.
- Click the app. 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 a Desktop Application
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.
- Extracts the access token from the callback URL and authenticates requests.
- Obtains a new access token when the old one expires.
Create an 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.
- Log into the Application Dashboard and create an app.
- Enter a name to be displayed to users when they log in to grant permissions to your app.
-
Click Create App. 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.
Customizing the SSL Configuration
By default, the provider attempts to negotiate SSL/TLS by checking the server's certificate against the system's trusted certificate store. To specify another certificate, see the SSLServerCert property for the available formats to do so.
Connecting Through a Firewall or Proxy
HTTP Proxies
To connect through the Windows system proxy, you do not need to set any additional connection properties. To connect to other proxies, set ProxyAutoDetect to false.
In addition, to authenticate to an HTTP proxy, set ProxyAuthScheme, ProxyUser, and ProxyPassword, in addition to ProxyServer and ProxyPort.
Other Proxies
Set the following properties:
- To use a proxy-based firewall, set FirewallType, FirewallServer, and FirewallPort.
- To tunnel the connection, set FirewallType to TUNNEL.
- To authenticate, specify FirewallUser and FirewallPassword.
- To authenticate to a SOCKS proxy, additionally set FirewallType to SOCKS5.
Troubleshooting the Connection
To show provider activity from query execution to network traffic, use Logfile and Verbosity. The examples of common connection errors below show how to use these properties to get more context. Contact the support team for help tracing the source of an error or circumventing a performance issue.
- Authentication errors: Typically, recording a Logfile at Verbosity 4 is necessary to get full details on an authentication error.
- Queries time out: A server that takes too long to respond will exceed the provider's client-side timeout. Often, setting the Timeout property to a higher value will avoid a connection error. Another option is to disable the timeout by setting the property to 0. Setting Verbosity to 2 will show where the time is being spent.
- The certificate presented by the server cannot be validated: This error indicates that the provider cannot validate the server's certificate through the chain of trust. If you are using a self-signed certificate, there is only one certificate in the chain.
To resolve this error, you must verify yourself that the certificate can be trusted and specify to the provider that you trust the certificate. One way you can specify that you trust a certificate is to add the certificate to the trusted system store; another is to set SSLServerCert.
- 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.
Authenticate to Square from a Web Application
When connecting via a Web application, or if the provider is not authorized to open a browser window, you need to register an application with Square.
Get an Access Token
Set the following connection properties to obtain the OAuthAccessToken:
- OAuthClientId: Set this to the Application Id in your app settings.
- OAuthClientSecret: Set this to the Application Secret in your app settings.
You can then call stored procedures to complete the OAuth exchange:
- Set the AuthMode input to WEB and set the CallbackURL input to the Redirect URI you specified in your app settings. The stored procedure returns the URL to the OAuth endpoint.
- Log in and authorize the application. You are redirected back to the callback URL.
- Set the AuthMode input to WEB. Set the Verifier input to the "code" parameter in the query string of the callback URL.