![]() |
Matillion Data Model for Square v2
|
string
""
The Id of one of your business locations that will be set as default. This can also be set in the search criteria of the query. A value set in the query overrides the value set in this connection property. You can retrieve the Ids for your Locations by querying the Locations table.
bool
false
If you are using a production account, this property can be left blank.
string
"OFF"
The following options are available:
string
""
As part of registering an OAuth application, you will receive the OAuthClientId value, sometimes also called a consumer key, and a client secret, the OAuthClientSecret.
string
""
As part of registering an OAuth application, you will receive the OAuthClientId, also called a consumer key. You will also receive a client secret, also called a consumer secret. Set the client secret in the OAuthClientSecret property.
string
""
The OAuthAccessToken property is used to connect using OAuth. The OAuthAccessToken is retrieved from the OAuth server as part of the authentication process. It has a server-dependent timeout and can be reused between requests.
The access token is used in place of your user name and password. The access token protects your credentials by keeping them on the server.
string
"%APPDATA%\\CData\\Square Data Provider\\OAuthSettings.txt"
When InitiateOAuth is set to GETANDREFRESH or REFRESH, the driver saves OAuth values to avoid requiring the user to manually enter OAuth connection properties and allowing the credentials to be shared across connections or processes.
Alternatively to specifying a file path, memory storage can be used instead. Memory locations are specified by using a value starting with 'memory://' followed by a unique identifier for that set of credentials (ex: memory://user1). The identifier can be anything you choose but should be unique to the user. Unlike with the file based storage, you must manually store the credentials when closing the connection with memory storage to be able to set them in the connection when the process is started again. The OAuth property values can be retrieved with a query to the sys_connection_props system table. If there are multiple connections using the same credentials, the properties should be read from the last connection to be closed.
If left unspecified, the default location is "%APPDATA%\\CData\\Square Data Provider\\OAuthSettings.txt" with %APPDATA% being set to the user's configuration directory:
Platform | %APPDATA% |
Windows | The value of the APPDATA environment variable |
Mac | ~/Library/Application Support |
Linux | ~/.config |
string
"http://localhost:33333"
During the authentication process, the OAuth authorization server redirects the user to this URL. This value must match the callback URL you specify in your app settings.
string
""
The verifier code returned from the OAuth authorization URL. This can be used on systems where a browser cannot be launched such as headless systems.
See Establishing a Connection to obtain the OAuthVerifier value.
Set OAuthSettingsLocation along with OAuthVerifier. When you connect, the driver exchanges the OAuthVerifier for the OAuth authentication tokens and saves them, encrypted, to the specified file. Set InitiateOAuth to GETANDREFRESH automate the exchange.
Once the OAuth settings file has been generated, you can remove OAuthVerifier from the connection properties and connect with OAuthSettingsLocation set.
To automatically refresh the OAuth token values, set OAuthSettingsLocation and additionally set InitiateOAuth to REFRESH.
string
""
The OAuthRefreshToken property is used to refresh the OAuthAccessToken when using OAuth authentication.
string
""
Pair with OAuthTokenTimestamp to determine when the AccessToken will expire.
string
""
Pair with OAuthExpiresIn to determine when the AccessToken will expire.
string
""
If using a TLS/SSL connection, this property can be used to specify the TLS/SSL certificate to be accepted from the server. Any other certificate that is not trusted by the machine is rejected.
This property can take the following forms:
Description | Example |
A full PEM Certificate (example shortened for brevity) | -----BEGIN CERTIFICATE----- MIIChTCCAe4CAQAwDQYJKoZIhv......Qw== -----END CERTIFICATE----- |
A path to a local file containing the certificate | C:\cert.cer |
The public key (example shortened for brevity) | -----BEGIN RSA PUBLIC KEY----- MIGfMA0GCSq......AQAB -----END RSA PUBLIC KEY----- |
The MD5 Thumbprint (hex values can also be either space or colon separated) | ecadbdda5a1529c58a1e9e09828d70e4 |
The SHA1 Thumbprint (hex values can also be either space or colon separated) | 34a929226ae0819f2ec14b4a3d904f801cbb150d |
If not specified, any certificate trusted by the machine is accepted.
Certificates are validated as trusted by the machine based on the System's trust store. The trust store used is the 'javax.net.ssl.trustStore' value specified for the system. If no value is specified for this property, Java's default trust store is used (for example, JAVA_HOME\lib\security\cacerts).
Use '*' to signify to accept all certificates. Note that this is not recommended due to security concerns.
string
"NONE"
This property specifies the protocol that the driver will use to tunnel traffic through the FirewallServer proxy. Note that by default, the driver connects to the system proxy; to disable this behavior and connect to one of the following proxy types, set ProxyAutoDetect to false.
Type | Default Port | Description |
TUNNEL | 80 | When this is set, the driver opens a connection to Square and traffic flows back and forth through the proxy. |
SOCKS4 | 1080 | When this is set, the driver sends data through the SOCKS 4 proxy specified by FirewallServer and FirewallPort and passes the FirewallUser value to the proxy, which determines if the connection request should be granted. |
SOCKS5 | 1080 | When this is set, the driver sends data through the SOCKS 5 proxy specified by FirewallServer and FirewallPort. If your proxy requires authentication, set FirewallUser and FirewallPassword to credentials the proxy recognizes. |
To connect to HTTP proxies, use ProxyServer and ProxyPort. To authenticate to HTTP proxies, use ProxyAuthScheme, ProxyUser, and ProxyPassword.
string
""
This property specifies the IP address, DNS name, or host name of a proxy allowing traversal of a firewall. The protocol is specified by FirewallType: Use FirewallServer with this property to connect through SOCKS or do tunneling. Use ProxyServer to connect to an HTTP proxy.
Note that the driver uses the system proxy by default. To use a different proxy, set ProxyAutoDetect to false.
int
0
This specifies the TCP port for a proxy allowing traversal of a firewall. Use FirewallServer to specify the name or IP address. Specify the protocol with FirewallType.
string
""
The FirewallUser and FirewallPassword properties are used to authenticate against the proxy specified in FirewallServer and FirewallPort, following the authentication method specified in FirewallType.
string
""
This property is passed to the proxy specified by FirewallServer and FirewallPort, following the authentication method specified by FirewallType.
bool
false
This takes precedence over other proxy settings, so you'll need to set ProxyAutoDetect to FALSE in order use custom proxy settings.
NOTE: When this property is set to True, the proxy used is determined as follows:
To connect to an HTTP proxy, see ProxyServer. For other proxies, such as SOCKS or tunneling, see FirewallType.
string
""
The hostname or IP address of a proxy to route HTTP traffic through. The driver can use the HTTP, Windows (NTLM), or Kerberos authentication types to authenticate to an HTTP proxy.
If you need to connect through a SOCKS proxy or tunnel the connection, see FirewallType.
By default, the driver uses the system proxy. If you need to use another proxy, set ProxyAutoDetect to false.
int
80
The port the HTTP proxy is running on that you want to redirect HTTP traffic through. Specify the HTTP proxy in ProxyServer. For other proxy types, see FirewallType.
string
"BASIC"
This value specifies the authentication type to use to authenticate to the HTTP proxy specified by ProxyServer and ProxyPort.
Note that the driver will use the system proxy settings by default, without further configuration needed; if you want to connect to another proxy, you will need to set ProxyAutoDetect to false, in addition to ProxyServer and ProxyPort. To authenticate, set ProxyAuthScheme and set ProxyUser and ProxyPassword, if needed.
The authentication type can be one of the following:
If you need to use another authentication type, such as SOCKS 5 authentication, see FirewallType.
string
""
The ProxyUser and ProxyPassword options are used to connect and authenticate against the HTTP proxy specified in ProxyServer.
You can select one of the available authentication types in ProxyAuthScheme. If you are using HTTP authentication, set this to the user name of a user recognized by the HTTP proxy. If you are using Windows or Kerberos authentication, set this property to a user name in one of the following formats:
user@domain domain\user
string
""
This property is used to authenticate to an HTTP proxy server that supports NTLM (Windows), Kerberos, or HTTP authentication. To specify the HTTP proxy, you can set ProxyServer and ProxyPort. To specify the authentication type, set ProxyAuthScheme.
If you are using HTTP authentication, additionally set ProxyUser and ProxyPassword to HTTP proxy.
If you are using NTLM authentication, set ProxyUser and ProxyPassword to your Windows password. You may also need these to complete Kerberos authentication.
For SOCKS 5 authentication or tunneling, see FirewallType.
By default, the driver uses the system proxy. If you want to connect to another proxy, set ProxyAutoDetect to false.
string
"AUTO"
This property determines when to use SSL for the connection to an HTTP proxy specified by ProxyServer. This value can be AUTO, ALWAYS, NEVER, or TUNNEL. The applicable values are the following:
AUTO | Default setting. If the URL is an HTTPS URL, the driver will use the TUNNEL option. If the URL is an HTTP URL, the component will use the NEVER option. |
ALWAYS | The connection is always SSL enabled. |
NEVER | The connection is not SSL enabled. |
TUNNEL | The connection is through a tunneling proxy. The proxy server opens a connection to the remote host and traffic flows back and forth through the proxy. |
string
""
The ProxyServer is used for all addresses, except for addresses defined in this property. Use semicolons to separate entries.
Note that the driver uses the system proxy settings by default, without further configuration needed; if you want to explicitly configure proxy exceptions for this connection, you need to set ProxyAutoDetect = false, and configure ProxyServer and ProxyPort. To authenticate, set ProxyAuthScheme and set ProxyUser and ProxyPassword, if needed.
string
""
Once this property is set, the driver will populate the log file as it carries out various tasks, such as when authentication is performed or queries are executed. If the specified file doesn't already exist, it will be created.
Connection strings and version information are also logged, though connection properties containing sensitive information are masked automatically.
If a relative filepath is supplied, the location of the log file will be resolved based on the path found in the Location connection property.
For more control over what is written to the log file, you can adjust the Verbosity property.
Log contents are categorized into several modules. You can show/hide individual modules using the LogModules property.
To edit the maximum size of a single logfile before a new one is created, see MaxLogFileSize.
If you would like to place a cap on the number of logfiles generated, use MaxLogFileCount.
Java logging is also supported. To enable Java logging, set Logfile to:
Logfile=JAVALOG://myloggername
As in the above sample, JAVALOG:// is a required prefix to use Java logging, and you will substitute your own Logger.
The supplied Logger's getLogger method is then called, using the supplied value to create the Logger instance. If a logging instance already exists, it will reference the existing instance.
When Java logging is enabled, the Verbosity will now correspond to specific logging levels.
string
"1"
The verbosity level determines the amount of detail that the driver reports to the Logfile. Verbosity levels from 1 to 5 are supported. These are detailed in the Logging page.
string
""
Only the modules specified (separated by ';') will be included in the log file. By default all modules are included.
See the Logging page for an overview.
string
"100MB"
When the limit is hit, a new log is created in the same folder with the date and time appended to the end. The default limit is 100 MB. Values lower than 100 kB will use 100 kB as the value instead.
Adjust the maximum number of logfiles generated with MaxLogFileCount.
int
-1
When the limit is hit, a new log is created in the same folder with the date and time appended to the end and the oldest log file will be deleted.
The minimum supported value is 2. A value of 0 or a negative value indicates no limit on the count.
Adjust the maximum size of the logfiles generated with MaxLogFileSize.
string
"%APPDATA%\\CData\\Square Data Provider\\Schema"
The path to a directory which contains the schema files for the driver (.rsd files for tables and views, .rsb files for stored procedures). The folder location can be a relative path from the location of the executable. The Location property is only needed if you want to customize definitions (for example, change a column name, ignore a column, and so on) or extend the data model with new tables, views, or stored procedures.
Note: Given that this driver supports multiple schemas, the structure for Square custom schema files is as follows:
If left unspecified, the default location is "%APPDATA%\\CData\\Square Data Provider\\Schema" with %APPDATA% being set to the user's configuration directory:
Platform | %APPDATA% |
Windows | The value of the APPDATA environment variable |
Mac | ~/Library/Application Support |
Linux | ~/.config |
string
""
Listing the schemas from databases can be expensive. Providing a list of schemas in the connection string improves the performance.
string
""
Listing the tables from some databases can be expensive. Providing a list of tables in the connection string improves the performance of the driver.
This property can also be used as an alternative to automatically listing views if you already know which ones you want to work with and there would otherwise be too many to work with.
Specify the tables you want in a comma-separated list. Each table should be a valid SQL identifier with any special characters escaped using square brackets, double-quotes or backticks. For example, Tables=TableA,[TableB/WithSlash],WithCatalog.WithSchema.`TableC With Space`.
Note that when connecting to a data source with multiple schemas or catalogs, you will need to provide the fully qualified name of the table in this property, as in the last example here, to avoid ambiguity between tables that exist in multiple catalogs or schemas.
string
""
Listing the views from some databases can be expensive. Providing a list of views in the connection string improves the performance of the driver.
This property can also be used as an alternative to automatically listing views if you already know which ones you want to work with and there would otherwise be too many to work with.
Specify the views you want in a comma-separated list. Each view should be a valid SQL identifier with any special characters escaped using square brackets, double-quotes or backticks. For example, Views=ViewA,[ViewB/WithSlash],WithCatalog.WithSchema.`ViewC With Space`.
Note that when connecting to a data source with multiple schemas or catalogs, you will need to provide the fully qualified name of the table in this property, as in the last example here, to avoid ambiguity between tables that exist in multiple catalogs or schemas.
string
"v1"
Set this property to v1 to use the Square Connect API v1 or v2 to use the Square Connect API v2.
bool
false
When AutoCache = true, the driver automatically maintains a cache of your table's data in the database of your choice.
When AutoCache = true, the driver caches to a simple, file-based cache. You can configure its location or cache to a different database with the following properties:
string
""
You can cache to any database for which you have a JDBC driver, including CData JDBC drivers.
The cache database is determined based on the CacheDriver and CacheConnection properties. The CacheDriver is the name of the JDBC driver class that you want to use to cache data.
Note that you must also add the CacheDriver JAR file to the classpath.
The following examples show how to cache to several major databases. Refer to CacheConnection for more information on the JDBC URL syntax and typical connection properties.
The driver simplifies Derby configuration. Java DB is the Oracle distribution of Derby. The JAR file is shipped in the JDK. You can find the JAR file, derby.jar, in the db subfolder of the JDK installation. In most caching scenarios, you need to specify only the following, after adding derby.jar to the classpath:
jdbc:square:CacheLocation='c:/Temp/cachedir';InitiateOAuth=GETANDREFRESH;OAuthClientId=MyApplicationId;OAuthClientSecret=MyApplicationSecret;CallbackURL=http://localhost:33333;LocationId=MyDefaultLocationTo customize the Derby JDBC URL, use CacheDriver and CacheConnection. For example, to cache to an in-memory database, use a JDBC URL like the following:
jdbc:square:CacheDriver=org.apache.derby.jdbc.EmbeddedDriver;CacheConnection='jdbc:derby:memory';InitiateOAuth=GETANDREFRESH;OAuthClientId=MyApplicationId;OAuthClientSecret=MyApplicationSecret;CallbackURL=http://localhost:33333;LocationId=MyDefaultLocation
The following is a JDBC URL for the SQLite JDBC driver:
jdbc:square:CacheDriver=org.sqlite.JDBC;CacheConnection='jdbc:sqlite:C:/Temp/sqlite.db';InitiateOAuth=GETANDREFRESH;OAuthClientId=MyApplicationId;OAuthClientSecret=MyApplicationSecret;CallbackURL=http://localhost:33333;LocationId=MyDefaultLocation
The following is a JDBC URL for the included CData JDBC Driver for MySQL:
jdbc:square:Cache Driver=cdata.jdbc.mysql.MySQLDriver;Cache Connection='jdbc:mysql:Server=localhost;Port=3306;Database=cache;User=root;Password=123456';InitiateOAuth=GETANDREFRESH;OAuthClientId=MyApplicationId;OAuthClientSecret=MyApplicationSecret;CallbackURL=http://localhost:33333;LocationId=MyDefaultLocation
The following JDBC URL uses the Microsoft JDBC Driver for SQL Server:
jdbc:square:Cache Driver=com.microsoft.sqlserver.jdbc.SQLServerDriver;Cache Connection='jdbc:sqlserver://localhost\sqlexpress:7437;user=sa;password=123456;databaseName=Cache';InitiateOAuth=GETANDREFRESH;OAuthClientId=MyApplicationId;OAuthClientSecret=MyApplicationSecret;CallbackURL=http://localhost:33333;LocationId=MyDefaultLocation
The following is a JDBC URL for the Oracle Thin Client:
jdbc:square:Cache Driver=oracle.jdbc.OracleDriver;CacheConnection='jdbc:oracle:thin:scott/tiger@localhost:1521:orcldb';InitiateOAuth=GETANDREFRESH;OAuthClientId=MyApplicationId;OAuthClientSecret=MyApplicationSecret;CallbackURL=http://localhost:33333;LocationId=MyDefaultLocation
NOTE: If using a version of Oracle older than 9i, the cache driver will instead be oracle.jdbc.driver.OracleDriver .
The following JDBC URL uses the official PostgreSQL JDBC driver:
jdbc:square:CacheDriver=cdata.jdbc.postgresql.PostgreSQLDriver;CacheConnection='jdbc:postgresql:User=postgres;Password=admin;Database=postgres;Server=localhost;Port=5432;';InitiateOAuth=GETANDREFRESH;OAuthClientId=MyApplicationId;OAuthClientSecret=MyApplicationSecret;CallbackURL=http://localhost:33333;LocationId=MyDefaultLocation
string
""
The cache database is determined based on the CacheDriver and CacheConnection properties. Both properties are required to use the cache database. Examples of common cache database settings can be found below. For more information on setting the caching database's driver, refer to CacheDriver.
The connection string specified in the CacheConnection property is passed directly to the underlying CacheDriver. Consult the documentation for the specific JDBC driver for more information on the available properties. Make sure to include the JDBC driver in your application's classpath.
The driver simplifies caching to Derby, only requiring you to set the CacheLocation property to make a basic connection.
Alternatively, you can configure the connection to Derby manually using CacheDriver and CacheConnection. The following is the Derby JDBC URL syntax:
jdbc:derby:[subsubprotocol:][databaseName][;attribute=value[;attribute=value] ... ]
For example, to cache to an in-memory database, use the following:
jdbc:derby:memory
To cache to SQLite, you can use the SQLite JDBC driver. The following is the syntax of the JDBC URL:
jdbc:sqlite:dataSource
The installation includes the CData JDBC Driver for MySQL. The following is an example JDBC URL:
jdbc:mysql:User=root;Password=root;Server=localhost;Port=3306;Database=cache
The following are typical connection properties:
The JDBC URL for the Microsoft JDBC Driver for SQL Server has the following syntax:
jdbc:sqlserver://[serverName[\instance][:port]][;database=databaseName][;property=value[;property=value] ... ]
For example:
jdbc:sqlserver://localhost\sqlexpress:1433;integratedSecurity=true
The following are typical SQL Server connection properties:
To use integrated security, you will also need to add sqljdbc_auth.dll to a folder on the Windows system path. This file is located in the auth subfolder of the Microsoft JDBC Driver for SQL Server installation. The bitness of the assembly must match the bitness of your JVM.
The following is the conventional JDBC URL syntax for the Oracle JDBC Thin driver:
jdbc:oracle:thin:[userId/password]@[//]host[[:port][:sid]]
For example:
jdbc:oracle:thin:scott/tiger@myhost:1521:orcl
The following are typical connection properties:
Data Source: The connect descriptor that identifies the Oracle database. This can be a TNS connect descriptor, an Oracle Net Services name that resolves to a connect descriptor, or, after version 11g, an Easy Connect naming (the host name of the Oracle server with an optional port and service name).
The following is the JDBC URL syntax for the official PostgreSQL JDBC driver:
jdbc:postgresql:[//[host[:port]]/]database[[?option=value][[&option=value][&option=value] ... ]]
For example, the following connection string connects to a database on the default host (localhost) and port (5432):
jdbc:postgresql:postgres
The following are typical connection properties:
string
"%APPDATA%\\CData\\Square Data Provider"
The CacheLocation is a simple, file-based cache. The driver uses Java DB, Oracle's distribution of the Derby database. To cache to Java DB, you will need to add the Java DB JAR file to the classpath. The JAR file, derby.jar, is shipped in the JDK and located in the db subfolder of the JDK installation.
If left unspecified, the default location is "%APPDATA%\\CData\\Square Data Provider" with %APPDATA% being set to the user's configuration directory:
Platform | %APPDATA% |
Windows | The value of the APPDATA environment variable |
Mac | ~/Library/Application Support |
Linux | ~/.config |
int
600
The tolerance for stale data in the cache specified in seconds. This only applies when AutoCache is used. The driver checks with the data source for newer records after the tolerance interval has expired. Otherwise, it returns the data directly from the cache.
bool
false
When Offline = true, all queries execute against the cache as opposed to the live data source. In this mode, certain queries like INSERT, UPDATE, DELETE, and CACHE are not allowed.
bool
false
As you execute queries with this property set, table metadata in the Square catalog are cached to the file store specified by CacheLocation if set or the user's home directory otherwise. A table's metadata will be retrieved only once, when the table is queried for the first time.
The driver automatically persists metadata in memory for up to two hours when you first discover the metadata for a table or view and therefore, CacheMetadata is generally not required. CacheMetadata becomes useful when metadata operations are expensive such as when you are working with large amounts of metadata or when you have many short-lived connections.
int
0
When BatchSize is set to a value greater than 0, the batch operation will split the entire batch into separate batches of size BatchSize. The split batches will then be submitted to the server individually. This is useful when the server has limitations on the size of the request that can be submitted.
Setting BatchSize to 0 will submit the entire batch as specified.
int
0
The maximum lifetime of a connection in seconds. Once the time has elapsed, the connection object is disposed. The default is 0 which indicates there is no limit to the connection lifetime.
bool
false
When set to true, a connection will be made to Square when the connection is opened. This property enables the Test Connection feature available in various database tools.
This feature acts as a NOOP command as it is used to verify a connection can be made to Square and nothing from this initial connection is maintained.
Setting this property to false may provide performance improvements (depending upon the number of times a connection is opened).
int
-1
Limits the number of rows returned rows when no aggregation or group by is used in the query. This helps avoid performance issues at design time.
string
""
The properties listed below are available for specific use cases. Normal driver use cases and functionality should not require these properties.
Specify multiple properties in a semicolon-separated list.
CachePartial=True | Caches only a subset of columns, which you can specify in your query. |
QueryPassthrough=True | Passes the specified query to the cache database instead of using the SQL parser of the driver. |
DefaultColumnSize | Sets the default length of string fields when the data source does not provide column length in the metadata. The default value is 2000. |
ConvertDateTimeToGMT | Determines whether to convert date-time values to GMT, instead of the local time of the machine. |
RecordToFile=filename | Records the underlying socket data transfer to the specified file. |
int
60
The allowed idle time a connection can remain in the pool until the connection is closed. The default is 60 seconds.
int
100
The maximum connections in the pool. The default is 100. To disable this property, set the property value to 0 or less.
int
1
The minimum number of connections in the pool. The default is 1.
int
60
The max seconds to wait for a connection to become available. If a new connection request is waiting for an available connection and exceeds this time, an error is thrown. By default, new requests wait forever for an available connection.
string
""
This setting is particularly helpful in Entity Framework, which does not allow you to set a value for a pseudo column unless it is a table column. The value of this connection setting is of the format "Table1=Column1, Table1=Column2, Table2=Column3". You can use the "*" character to include all tables and all columns; for example, "*=*".
bool
false
If this property is set to true, the driver will allow only SELECT queries. INSERT, UPDATE, DELETE, and stored procedure queries will cause an error to be thrown.
string
""
The RTK property may be used to license a build. See the included licensing file to see how to set this property. The runtime key is only available if you purchased an OEM license.
bool
true
When SupportEnhancedSQL = true, the driver offloads as much of the SELECT statement processing as possible to Square and then processes the rest of the query in memory. In this way, the driver can execute unsupported predicates, joins, and aggregation.
When SupportEnhancedSQL = false, the driver limits SQL execution to what is supported by the Square API.
The driver determines which of the clauses are supported by the data source and then pushes them to the source to get the smallest superset of rows that would satisfy the query. It then filters the rest of the rows locally. The filter operation is streamed, which enables the driver to filter effectively for even very large datasets.
The driver uses various techniques to join in memory. The driver trades off memory utilization against the requirement of reading the same table more than once.
The driver retrieves all rows necessary to process the aggregation in memory.
int
60
If Timeout = 0, operations do not time out. The operations run until they complete successfully or until they encounter an error condition.
If Timeout expires and the operation is not yet complete, the driver throws an exception.
bool
false
This property enables connection pooling. The default is false. See Connection Pooling for information on using connection pools.
Query the available catalog categories.
Retrieve all catalog categories:
SELECT * FROM CatalogCategories
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The category's ID. |
Name | String | False |
The category's name. |
UpdatedAt | Datatime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Query the available catalog discounts.
Retrieve all catalog discounts:
SELECT * FROM CatalogDiscounts
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The discount's ID. |
Name | String | False |
The discount's name. |
UpdatedAt | Datatime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
DiscountType | String | False |
Indicates whether the discount is a fixed amount or percentage, or entered at the time of sale. |
Percentage | String | False |
The percentage of the discount as a string representation of a decimal number, using a . as the decimal separator and without a % sign. A value of 7.5 corresponds to 7.5%. Specify a percentage of 0 if DiscountType is VARIABLE_PERCENTAGE. |
Amount | Integer | False |
The discount's amount. |
Currency | String | False |
The discount's money currency. |
PinRequired | Boolean | False |
Indicates whether a mobile staff member needs to enter their PIN to apply the discount to a payment in the Square Point of Sale app. |
LabelColor | String | False |
The color of the discount's display label in the Square Point of Sale app. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Query the available catalog images.
Retrieve all catalog images:
SELECT * FROM CatalogImages
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The image file ID. |
Name | String | False |
The internal name of this image. |
UpdatedAt | Datatime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
URL | String | False |
The URL of this image. |
Caption | String | False |
A caption that describes what is shown in the image. Displayed in the Square Online Store. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Query the available items.
Retrieve all catalog items:
SELECT * FROM CatalogItems
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The item's ID. |
Name | String | False |
The item's name. |
UpdatedAt | Datatime | True |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
Description | String | False |
The item's description. |
Abbreviation | String | False |
The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. |
LabelColor | String | False |
The color of the item's display label in the Square Point of Sale app. |
AvailableOnline | Boolean | False |
If true, the item can be added to shipping orders from the merchant's online store. |
AvailableForPickup | Boolean | False |
If true, the item can be added to pickup orders from the merchant's online store. |
AvailableElectronically | Boolean | False |
If true, the item can be added to electronically fulfilled orders from the merchant's online store. |
CategoryId | String | False |
The ID of the item's category, if any. |
TaxIds | String | False |
A set of IDs indicating the CatalogTaxes that are enabled for this item. |
ModifierListInfo | String | False |
Info about the modifier lists that apply to this item. |
ProductType | String | False |
The product type of the item. May not be changed once an item has been created. |
SkipModifierScreen | Boolean | False |
If true, the Square Point of Sale app will immediately add the item to the cart with the pre-selected modifiers, and merchants can edit modifiers by drilling down onto the item's details. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
ImageId | String | False |
The Id of the Image |
Query the available item variations.
Retrieve all catalog item variations:
SELECT * FROM CatalogItemVariations
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The item variation's ID. |
ItemId [KEY] | String | False |
The ID of the CatalogItem associated with this item variation. |
Name | String | False |
The item variation's name. |
UpdatedAt | Datatime | True |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
Sku | String | False |
The item variation's SKU. |
Upc | String | False |
The item variation's UPC. |
Ordinal | Integer | False |
The order in which this item variation should be displayed. |
PricingType | String | False |
Indicates whether the item variation's price is fixed or determined at the time of sale. |
PriceMoneyAmount | Integer | False |
The item variation's price amount, if fixed pricing is used. |
PriceMoneyCurrency | String | False |
The item variation's price currency, if fixed pricing is used. |
LocationOverrides | String | False |
Per-location price and inventory overrides. |
TrackInventory | Boolean | False |
If true, inventory tracking is active for the variation. |
InventoryAlertType | String | False |
Indicates whether the item variation displays an alert when its inventory quantity is less than or equal to its InventoryAlertThreshold. |
InventoryAlertThreshold | Integer | False |
If the inventory quantity for the variation is less than or equal to this value and InventoryAlertType is LOW_QUANTITY, the variation displays an alert in the merchant dashboard. |
UserData | String | False |
Arbitrary user metadata to associate with the item variation. |
ServiceDuration | Integer | False |
If the CatalogItem that owns this item variation is of type APPOINTMENTS_SERVICE, then this is the duration of the service in milliseconds. |
CatalogMeasurementUnitId | String | True |
Represents the unit used to measure a CatalogItemVariation and specifies the precision for decimal quantities. |
MeasurementUnitId | String | False |
ID of the 'CatalogMeasurementUnit' that is used to measure the quantity sold of this item variation. If left unset, the item will be sold in whole quantities. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Query the available catalog modifier lists.
Retrieve all catalog modifier lists:
SELECT * FROM CatalogModifierLists
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The CatalogModifierList's ID. |
Name | String | False |
The CatalogModifierList's name. |
UpdatedAt | Datetime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
Modifiers | String | False |
The options included in the CatalogModifierList. Each CatalogObject must have type MODIFIER and contain CatalogModifier data. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
SelectionType | String | False |
Indicates whether multiple options from the modifier list can be applied to a single CatalogItem.. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Query the available catalog modifiers.
Retrieve all catalog modifiers:
SELECT * FROM CatalogModifiers
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The modifier's ID. |
Name | String | False |
The modifier's name. |
UpdatedAt | Datatime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
PriceMoneyAmount | Integer | False |
The modifier's price amount. |
PriceMoneyCurrency | String | False |
The modifier's price currency. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source.
Name | Type | Description |
Type | String |
The catalog object type to be modified. |
Query the available catalog taxes.
Retrieve all catalog taxes:
SELECT * FROM CatalogTaxes
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The Id of the tax. |
Name | String | False |
The tax's name. |
UpdatedAt | Datatime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
CalculationPhase | String | False |
Whether the tax is calculated based on a payment's subtotal or total. |
InclusionType | String | False |
Whether the tax is ADDITIVE or INCLUSIVE. |
Percentage | String | False |
The percentage of the discount as a string representation of a decimal number, using a . as the decimal separator and without a % sign. A value of 7.5 corresponds to 7.5%. |
AppliesToCustomAmounts | Boolean | False |
If true, the fee applies to custom amounts entered into the Square Point of Sale app that are not associated with a particular CatalogItem. |
Enabled | Boolean | False |
If true, the tax will be shown as enabled in the Square Point of Sale app. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Create, update, delete, and query the available CustomerCards in Square.
The driver uses the Square API to process search criteria that refer to the CustomerId column, while other filters are processed client side within the driver. You can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will have an unfiltered response.
Select all CustomerCards from all customers:
SELECT * FROM CustomerCards
Select all CustomerCards from a specific customer:
Select * FROM CustomerCards WHERE CustomerId='CBASEPlKoFeu4nWm0MX_oHdklAIgAQ'
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The card's unique ID, if any. |
CustomerId [KEY] | String | False |
The customer's unique ID. |
CardBrand | String | True |
The card's brand (such as VISA). |
Last4Digits | String | True |
The last 4 digits of the card's number. |
ExpireMonth | Integer | True |
The month of the card's expiration date. This value is always between 1 and 12, inclusive. |
ExpireYear | Integer | True |
The four-digit year of the card's expiration date. |
CardholderName | String | False |
The cardholder name. This value is present only if this object represents a customer's card on file. |
PhoneNumber | String | True |
The customer's phone number. |
Fingerprint | String | True |
The unique string fingerprint for the card. The fingerprint is based on the credit card number and is unique to the merchant. If a card is used at multiple locations for the same merchant, it will have the same fingerprint in each case. |
CardNonce | String | False |
A card nonce representing the credit card to link to the customer. |
BillingAddressLine1 | String | False |
The first line of the address. |
BillingAddressLine2 | String | False |
The second line of the address. |
BillingAddressLine3 | String | False |
The third line of the address. |
BillingAddressLocality | String | False |
The city or town of the address. |
BillingAddressSubLocality | String | False |
A civil region within the address's locality. |
BillingAddressSubLocality2 | String | False |
A civil region within the address's sublocality. |
BillingAddressSubLocality3 | String | False |
A civil region within the address's sublocality_2. |
BillingAddressAdministrativeDistrictLevel1 | String | False |
A civil entity within the address's country. In the US, this is the state. |
BillingAddressAdministrativeDistrictLevel2 | String | False |
A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
BillingAddressAdministrativeDistrictLevel3 | String | False |
A civil entity within the address's administrative_district_level_2. |
BillingAddressPostalCode | String | False |
The address's postal code. |
BillingAddressCountry | String | False |
The address's country, in ISO 3166-1-alpha-2 format. |
BillingAddressFirstName | String | False |
Optional first name when it's representing recipient. |
BillingAddressLastName | String | False |
Optional last name when it's representing recipient. |
BillingAddressOrganization | String | False |
Optional organization name when it's representing recipient. |
Create, update, delete, and query the available customers in Square.
The driver uses the Square API to process search criteria that refer to the Id column, while other filters are processed client side within the driver. You can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will have an unfiltered response.
Retrieve all customers:
SELECT * FROM Customers
Retrieve only one customer:
Select * FROM Customers WHERE Id='0SY145EEWD0YXCW489VV386KH8'
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The Id of the customer. |
GivenName | String | False |
The customer's given (i.e., first) name. |
FamilyName | String | False |
The customer's family (i.e., last) name. |
Nickname | String | False |
The customer's nickname. |
String | False |
The customer's email address. | |
CompanyName | String | False |
The name of the customer's company. |
PhoneNumber | String | False |
The customer's phone number. |
AddressLine1 | String | False |
The first line of the address. |
AddressLine2 | String | False |
The second line of the address. |
AddressLine3 | String | False |
The third line of the address. |
AddressLocality | String | False |
The city or town of the address. |
AddressSubLocality | String | False |
A civil region within the address's locality. |
AddressSubLocality2 | String | False |
A civil region within the address's sublocality. |
AddressSubLocality3 | String | False |
A civil region within the address's sublocality_2. |
AddressAdministrativeDistrictLevel1 | String | False |
A civil entity within the address's country. In the US, this is the state. |
AddressAdministrativeDistrictLevel2 | String | False |
A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
AddressAdministrativeDistrictLevel3 | String | False |
A civil entity within the address's administrative_district_level_2. |
AddressPostalCode | String | False |
The address's postal code. |
AddressCountry | String | False |
The address's country, in ISO 3166-1-alpha-2 format. |
AddressFirstName | String | False |
Optional first name when it's representing recipient. |
AddressLastName | String | False |
Optional last name when it's representing recipient. |
AddressOrganization | String | False |
Optional organization name when it's representing recipient. |
Birthday | Datetime | False |
The birthday associated with the customer profile, in RFC 3339 format. Year is optional, timezone and times are not allowed |
CreatedAt | Datetime | True |
The time when the customer was created. |
UpdatedAt | Datetime | True |
The time when the customer was last updated. |
ReferenceId | String | False |
A second ID you can set to associate the customer with an entity in another system. |
Note | String | False |
A note to associate with the customer. |
CardsAggregate | String | True |
The non-confidential details of the customer's cards on file. |
Preferences | String | True |
The customer's preferences. |
Segments | String | True |
The IDs of segments the customer belongs to. |
Query historical physical counts and adjustments on inventory items.
The driver uses the Square API to process search criteria that refer to the Type, CatalogObjectId, State and LocationId column, while other filters are processed client side within the driver. You can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will have an unfiltered response.
Select all the inventory changes:
SELECT * FROM InventoryChanges
Select all the inventory changes from a specific location ID:
SELECT * FROM InventoryChanges WHERE LocationId='Sandbox_Location_Id'
Select all the inventory changes with a specific type:
SELECT * FROM InventoryChanges WHERE Type='ADJUSTMENT'
Select all the inventory changes in a specific state:
SELECT * FROM InventoryChanges WHERE State='IN_STOCK'
Select all the inventory changes for a specific catalog object:
SELECT * FROM InventoryChanges WHERE CatalogObjectId='5QJP4XMEN5TQ4W4UY7YL'
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
A unique ID generated by Square for the Inventory change. |
ReferenceId | String | False |
An optional ID provided by the application to tie the Inventory change to an external system. |
Type | String | False |
Indicates how the inventory change was applied. The allowed values are PHYSICAL_COUNT, ADJUSTMENT. |
CatalogObjectId | String | False |
The Square generated ID of the CatalogObject being tracked. |
CatalogObjectType | String | False |
The CatalogObjectType of the CatalogObject being tracked. Tracking is only supported for the ITEM_VARIATION type. |
State | String | False |
The current InventoryState for the related quantity of items. |
LocationId | String | False |
The Square ID of the Location where the related quantity of items are being tracked. |
Quantity | String | False |
The number of items affected by the physical count as a decimal string. |
EmployeeId | String | False |
The Square ID of the Employee responsible for the physical count. |
OccurredAt | Datetime | False |
A client-generated timestamp in RFC 3339 format that indicates when the physical count took place. For write actions, the occurred_at timestamp cannot be older than 24 hours or in the future relative to the time of the request. |
CreatedAt | Datetime | False |
A read-only timestamp in RFC 3339 format that indicates when Square received the physical count. |
FromState | String | False |
The InventoryState of the related quantity of items before the adjustment. |
ToState | String | False |
The InventoryState of the related quantity of items before the adjustment. |
TotalPriceMoneyAmount | Integer | False |
The amount of the total price paid for goods associated with the adjustment. Present if and only if to_state is SOLD. Always non-negative. |
TotalPriceMoneyCurrency | String | False |
The currency of the total price paid for goods associated with the adjustment. Present if and only if to_state is SOLD. Always non-negative. |
TransactionId | String | False |
The read-only Square ID of the [Transaction][#type-transaction] that caused the adjustment. Only relevant for payment-related state transitions. |
RefundId | String | False |
The read-only Square ID of the Transaction that caused the adjustment. Only relevant for payment-related state transitions. |
PurchaseOrderId | String | False |
The read-only Square ID of the Refund that caused the adjustment. Only relevant for refund-related state transitions. |
GoodsReceiptId | String | False |
The read-only Square ID of the Square goods receipt that caused the adjustment. Only relevant for state transitions from the Square for Retail app. |
FromLocationId | String | False |
The Square ID of the Location where the related quantity of items were tracked before the transfer. |
ToLocationId | String | False |
The Square ID of the Location where the related quantity of items were tracked before the transfer. |
Create and query the details for all Refunds initiated by a merchant or any of the mobile staff of the merchant during a date range.
By default this table returns all refunds initiated by a merchant or any of the merchants mobile staff starting from January 1, 2013, as in the following query:
SELECT * FROM Refunds Select * from Refunds where Id = '12345' Select * from Refunds where Status = 'COMPLETED' and LocationId = '92BYHNBR6W77E' Select * from Refunds where LocationId = '9J0M984DXGA7W' // To get the refund for a given location
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The unique ID for this refund, generated by Square. |
TenderId | String | False |
The Square-issued Id of the transaction tender the refund is applied to. |
RefundedMoneyAmount | Int64 | False |
The amount of money, in the smallest denomination of the currency indicated by currency. For example, when currency is USD, amount is in cents. |
RefundedMoneyCurrency | String | False |
The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
RefundedAppFeeMoneyAmount | Int64 | False |
The amount of money, in the smallest denomination of the currency indicated by currency. For example, when currency is USD, amount is in cents. |
RefundedAppFeeMoneyCurrency | String | False |
The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
CreatedAt | Datetime | False |
The time when the merchant initiated the refund for Square to process. |
LocationId | String | False |
The Id of the location. |
OrderId | String | False |
The ID of the order associated with the refund. |
PaymentId | String | False |
The ID of the payment associated with this refund. |
ProcessingFeeMoneyAmount | Int64 | False |
Processing fees and fee adjustments assessed by Square for this refund. The amount of money, in the smallest denomination of the currency indicated by currency. For example, when currency is USD, amount is in cents. |
ProcessingFeeMoneyCurrency | String | False |
Processing fees and fee adjustments assessed by Square for this refund. The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
ProcessingFeeEffectiveAt | Datetime | False |
Processing fees and fee adjustments assessed by Square for this refund. The timestamp of when the fee takes effect, in RFC 3339 format. |
ProcessingFeeType | String | False |
Processing fees and fee adjustments assessed by Square for this refund. The type of fee assessed or adjusted. The fee type can be INITIAL or ADJUSTMENT. |
Reason | String | False |
The merchant-specified reason for the refund. |
Status | String | False |
The refund's status The allowed values are COMPLETED, FAILED, PENDING, REJECTED. |
UpdatedAt | Datetime | False |
The timestamp of when the refund was last updated, in RFC 3339 format. |
Query the Bank Accounts of the merchant.
Name | Type | Description |
Id [KEY] | String | The Square-issued Id of the bank account. |
LocationId | String | The Id of the location. |
BankName | String | The name of the bank that manages the account. |
Name | String | The name associated with the bank account. |
Type | String | The type of the bank account. For example, savings or checking. |
Country | String | The ISO 3166 Alpha 2 country code where the bank account is based. |
AccountNumberSuffix | String | The last few digits of the bank account number. |
CurrencyCode | String | The code of the currency associated with the bank account. |
PrimaryBankIdentificationNumber | String | Primary identifier for the bank. |
Status | String | The current verification status of this BankAccount object. |
Creditable | Boolean | Indicates whether it is possible for Square to send money to this bank account. |
Debitable | Boolean | Indicates whether it is possible for Square to take money from this bank account. |
Version | Integer | The current version of the BankAccount. |
Query Location information for a Merchant.
Retrieve all Locations:
SELECT * FROM Locations
Name | Type | Description |
Id [KEY] | String | The location's unique ID. |
Name | String | The location's name. Location names are set by the account owner and displayed in the dashboard as the location's nickname |
Address | String | The location's physical address. |
TimeZone | String | The IANA Timezone Database identifier for the location's timezone. |
Capabilities | String | Indicates which Square features are enabled for the location. |
Status | String | The location's status. |
CreatedAt | Datetime | The time when the location was created, in RFC 3339 format. |
MerchantId | String | The identifier of the merchant that owns the location. |
Country | String | The location's country, in ISO 3166-1-alpha-2 format. |
LanguageCode | String | The language associated with the location in BCP 47 format. |
Currency | String | The currency used for all transactions at this location, specified in ISO 4217 format. |
PhoneNumber | String | The location's phone_number. |
BusinessName | String | The location's business_name which is shown to its customers. |
Type | String | The location's type, as set by the account owner in the Square dashboard. |
WebsiteUrl | String | The location's website, as set by the account owner in the Square dashboard. |
Query the available merchants in Square.
The driver uses the Square API to process search criteria that refer to the Id column, while other filters are processed client side within the driver. You can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will have an unfiltered response.
Retrieve all the merchants in your Square account.
SELECT * FROM Merchants
Specify Id in the WHERE clause using the = operator:
SELECT * FROM Merchants WHERE Id='CD215R7H3340KCD'
Name | Type | Description |
Id [KEY] | String | The Id of the merchant. |
BusinessName | String | The merchant's business name. |
Country | String | The merchant's country. |
Currency | String | The merchant's currency. |
Status | String | The merchant's status. |
LanguageCode | String | Code of the language. |
MainLocationId | String | The ID of the main Location for this merchant. |
The order items included in the order. Every order has at least one order item.
The driver uses the Square API to process search criteria that refer to the OrderId column, while other filters are processed client side within the driver. You can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will have an unfiltered response.
Retrieve all the OrderItems found in every order of your Square account. Only orders that have been successfully charged are included in the response.
SELECT * FROM OrderItems
You can retrieve all order items from an order by specifying the OrderId.
SELECT * FROM OrderItems WHERE OrderId='TzratjkPk9rhOuLYvSXeznmVvIx5PVlZpg72GfPQGBxckDeeWNBN8yqnf11qTrg3W3AelXC1kB'
You can also use the IN operator to specify multiple OrderIds in the WHERE clause.
SELECT * FROM OrderItems WHERE OrderId IN ('XKKB7LD30TpfNyW3e843ziklKh4vWEvweQyL5l4ESJLH3N2XXNBN8yqnf11qTrg3W3AelXC1kB','pxICohrEXPDtoUitiZhG1um5uhp5WI7CRMHknbuKpaj53PXfWNBN8yqnf11qTrg3W3AelXC1kB','6j8avtXB5fIaPZ9H12beiZP7sCSiqguGhHpwmECsEaENswJnWNBN8yqnf11qTrg3W3AelXC1kB')
Name | Type | Description |
OrderId [KEY] | String | The order's unique ID. |
OrderItemNumber [KEY] | Integer | The nth item of the order. |
LocationId | String | The Id of the location. |
Name | String | The name of the order item. |
Quantity | String | The quantity purchased, as a string representation of a number. |
Note | String | The note of the order item. |
CatalogObjectId | String | The CatalogItemVariation id applied to this order item. |
VariationName | String | The name of the variation applied to this order item. |
Taxes | String | The taxes applied to this order item. |
Discounts | String | The discounts applied to this order item. |
Modifiers | String | The CatalogModifiers applied to this order item. |
BasePriceMoneyAmount | Integer | The base price for a single unit of the order item. |
BasePriceMoneyCurrency | String | The currency of the base price for a single unit of the order item. |
GrossSalesMoneyAmount | Integer | The gross sales amount of money calculated as (item base price + modifiers price) * quantity. |
GrossSalesMoneyCurrency | String | The currency of the gross sales. |
TotalTaxMoney | Integer | The total tax amount of money to collect for the order item. |
TotalTaxMoneyCurrency | String | The currency of the total tax amount of money to collect for the order item. |
TotalDiscountMoneyAmount | Integer | The total discount amount of money to collect for the order item. |
TotalDiscountMoneyCurrency | String | The currency of the total discount amount of money to collect for the order item. |
TotalMoneyAmount | Integer | The total amount of money to collect for this order item. |
TotalMoneyCurrency | String | The currency of the total amount of money to collect for this order item. |
Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase.
The driver uses the Square API to process search criteria that refer to the Id column, while other filters are processed client side within the driver. You can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will have an unfiltered response.
Retrieve all the orders in your Square account. Only orders that have been successfully charged are included in the response.
SELECT * FROM Orders
Specify multiple Ids in the WHERE clause using the IN operator:
SELECT * FROM Orders WHERE Id IN ('XKKB7LD30TpfNyW3e843ziklKh4vWEvweQyL5l4ESJLH3N2XXNBN8yqnf11qTrg3W3AelXC1kB','pxICohrEXPDtoUitiZhG1um5uhp5WI7CRMHknbuKpaj53PXfWNBN8yqnf11qTrg3W3AelXC1kB','6j8avtXB5fIaPZ9H12beiZP7sCSiqguGhHpwmECsEaENswJnWNBN8yqnf11qTrg3W3AelXC1kB')
Name | Type | Description |
Id [KEY] | String | The order's unique ID. |
ReferenceId | String | A client specified identifier to associate an entity in another system with this order. |
LocationId | String | The Id of the location. |
TaxesCatalogObjectId | String | Only used for catalog taxes. The catalog object ID of an existing CatalogTax. |
TaxesName | String | Only used for ad hoc taxes. The tax's name. Do not provide a value for this field if you set catalogobjectid. |
TaxesPercentage | String | Only used for ad hoc taxes. The percentage of the tax, as a string representation of a decimal number. |
TaxesMoneyAmount | Integer | Only used for ad hoc discounts. The monetary amount of the discount. |
TaxesMoneyCurrency | String | Only used for ad hoc discounts. The currency of the discount monetary amount. |
DiscountsCatalogObjectId | String | Only used for catalog taxes. The catalog object ID from exsiting CatalogDiscount. |
DiscountsName | String | Only used for ad hoc discounts. The discount's name. |
DiscountsPercentage | String | Only used for ad hoc discounts. The percentage of the discount, as a string representation of a decimal number. |
DiscountsMoneyAmount | Integer | Only used for ad hoc discounts. The monetary amount of the discount. |
DiscountsMoneyCurrency | String | Only used for ad hoc discounts. The currency of the discount monetary amount. |
TotalTaxMoney | Integer | The total tax amount of money to collect for this order. |
TotalTaxMoneyCurrency | String | The currency of the total tax amount of money to collect for this order. |
TotalDiscountMoneyAmount | Integer | The total discount amount of money to collect for this order. |
TotalDiscountMoneyCurrency | String | The currency of the total discount amount of money to collect for this order. |
TotalMoneyAmount | Integer | The total amount of money to collect for this order. |
TotalMoneyCurrency | String | The currency of the total amount of money to collect for this order. |
Query the available card Payments in Square. Cash and other tenders payments will not be returned.
The following queries show the filters that are processed server side, while other filters are processed client side within the driver. You can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will have an unfiltered response.
Retrieve all Payments:
SELECT * FROM PaymentsRetrieve a single payment by providing a valid Id:
Select * FROM Payments where id = '5xNDT7Sd6qFHsLyKlugpZIqeV'
Filter by the creation date of a Payment:
SELECT * FROM Payments WHERE CreatedAt>'2015-08-15' SELECT * FROM Payments WHERE CreatedAt<'2015-08-15'
Name | Type | Description |
Id [KEY] | String | The Id of the payment. |
MoneyAmount | Int64 | The amount of money, in the smallest denomination of the currency indicated by currency. For example, when currency is USD, amount is in cents. |
MoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
AppFeeMoneyAmount | Int64 | The amount the developer is taking as a fee for facilitating the payment on behalf of the seller. |
AppFeeMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
ApprovedMoneyAmount | Int64 | The initial amount of money approved for this payment. The amount the developer is taking as a fee for facilitating the payment on behalf of the seller. |
ApprovedMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
BankAccountOwnershipType | String | The ownership type of the bank account performing the transfer.
The allowed values are INDIVIDUAL, COMPANY, UNKNOWN. |
ACHDetailsAccountNumberSuffix | String | The last few digits of the bank account number. |
ACHDetailsAccountType | String | The type of the bank account performing the transfer.
The allowed values are CHECKING, SAVINGS, UNKNOWN. |
ACHDetailsRoutingNumber | String | The routing number for the bank account. |
BankName | String | The name of the bank associated with the bank account. |
BankAccountCountry | String | The two-letter ISO code representing the country the bank account is located in. |
BankAccountFingerprint | String | Uniquely identifies the bank account for this seller and can be used to determine if payments are from the same bank account. |
BankAccountStatementDescription | String | The statement description as sent to the bank. |
BankAccountTransferType | String | The type of the bank transfer.
The allowed values are ACH, UNKNOWN. |
BillingAddressLine1 | String | The first line of the address. |
BillingAddressLine2 | String | The second line of the address, if any. |
BillingAddressLine3 | String | The third line of the address, if any. |
BillingAddressAdministrativeDistrictLevel1 | String | A civil entity within the address's country. In the US, this is the state. |
BillingAddressAdministrativeDistrictLevel2 | String | A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
BillingAddressAdministrativeDistrictLevel3 | String | A civil entity within the address's administrative_district_level_2, if any. |
BillingAddressCountry | String | The address's country, in ISO 3166-1-alpha-2 format. |
BillingAddressFirstName | String | Optional first name when it's representing recipient. |
BillingAddressLastName | String | Optional last name when it's representing recipient. |
BillingAddressLocality | String | The city or town of the address. |
BillingAddressOrganization | String | Optional organization name when it's representing recipient. |
BillingAddressPostalCode | String | The address's postal code. |
BillingAddressSubLocality | String | A civil region within the address's locality, if any. |
BillingAddressSubLocality2 | String | A civil region within the address's sublocality, if any. |
BillingAddressSubLocality3 | String | A civil region within the address's sublocality_2, if any. |
BuyerEmailAddress | String | The buyer's email address. |
Capabilities | String | Actions that can be performed on this payment:EDIT_AMOUNT_UP,EDIT_AMOUNT_DOWN,EDIT_TIP_AMOUNT_UP,EDIT_TIP_AMOUNT_DOWN |
CardDetailsApplicationCryptogram | String | For EMV payments, the cryptogram generated for the payment. |
CardDetailsApplicationIdentifier | String | For EMV payments, the application ID identifies the EMV application used for the payment. |
CardDetailsApplicationName | String | For EMV payments, the human-readable name of the EMV application used for the payment. |
CardDetailsAuthResultCode | String | The status code returned by the card issuer that describes the payment's authorization status. |
CardDetailsAverageStatus | String | The status code returned from the Address Verification System (AVS) check.
The allowed values are AVS_ACCEPTED, AVS_REJECTED, AVS_NOT_CHECKED. |
CardId | String | Unique ID for this card. Generated by Square. |
CardBillingAddressLine1 | String | The first line of the address. |
CardBillingAddressLine2 | String | The second line of the address, if any. |
CardBillingAddressLine3 | String | The third line of the address, if any. |
CardBillingAddressAdministrativeDistrictLevel1 | String | A civil entity within the address's country. In the US, this is the state. |
CardBillingAddressAdministrativeDistrictLevel2 | String | A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
CardBillingAddressAdministrativeDistrictLevel3 | String | A civil entity within the address's administrative_district_level_2, if any. |
CardBillingAddressCountry | String | The address's country, in ISO 3166-1-alpha-2 format. |
CardBillingAddressFirstName | String | Optional first name when it's representing recipient. |
CardBillingAddressLastName | String | Optional last name when it's representing recipient. |
CardBillingAddressLocality | String | The city or town of the address. |
CardBillingAddressOrganization | String | Optional organization name when it's representing recipient. |
CardBillingAddressPostalCode | String | The address's postal code. |
CardBillingAddressSubLocality | String | A civil region within the address's locality, if any. |
CardBillingAddressSubLocality2 | String | A civil region within the address's sublocality, if any. |
CardBillingAddressSubLocality3 | String | A civil region within the address's sublocality_2, if any. |
CardBin | String | The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API returns this field. |
CardType | String | The type of the card. The Card object includes this field only in response to Payments API calls.
The allowed values are UNKNOWN_CARD_TYPE, CREDIT, DEBIT. |
CardholderName | String | The name of the cardholder. |
CardCustomerId | String | The ID of a customer created using the Customers API to be associated with the card. |
CardEnabled | Boolean | Indicates whether or not a card can be used for payments. |
CardExpiryMonth | Int64 | The expiration month of the associated card as an integer between 1 and 12. |
CardExpiryYear | Int64 | The four-digit year of the card's expiration date. |
CardFingerprint | String | Intended as a Square-assigned identifier, based on the card number, to identify the card across multiple locations within a single application. |
CardFingerprint | String | Intended as a Square-assigned identifier, based on the card number, to identify the card across multiple locations within a single application. |
CardLast4 | String | The last 4 digits of the card number. |
CardPrepaidType | String | Indicates whether the Card is prepaid or not. The Card object includes this field only in response to Payments API calls |
CardReferenceId | String | An optional user-defined reference ID that associates this card with another entity in an external system. |
CardVersion | Int64 | Current version number of the card. Increments with each card update. |
CardTimelineAuthorizedAt | Datetime | The timestamp when the payment was authorized, in RFC 3339 format. |
CardTimelineCapturedAt | Datetime | The timestamp when the payment was captured, in RFC 3339 format. |
CardTimelineVoidedAt | Datetime | The timestamp when the payment was voided, in RFC 3339 format. |
CardCVVStatus | String | The status code returned from the Card Verification Value (CVV) check.
The allowed values are CVV_ACCEPTED, CVV_REJECTED, CVV_NOT_CHECKED. |
CardDeviceId | String | The Square-issued ID of the device. |
CardDeviceInstallationId | String | The Square-issued installation ID for the device. |
CardDeviceName | String | The name of the device set by the seller. |
CardEntryMethod | String | The method used to enter the card's details for the payment.
The allowed values are KEYED, SWIPED, EMV, ON_FILE, CONTACTLESS. |
RefundRequiresCardPresence | Boolean | Whether the card must be physically present for the payment to be refunded. If set to true, the card must be present. |
CardStatementDescription | String | The statement description sent to the card networks. |
CardStatus | String | The card payment's current state.
The allowed values are AUTHORIZED, CAPTURED, VOIDED, FAILED. |
CardVerificationMethod | String | For EMV payments, the method used to verify the cardholder's identity.
The allowed values are PIN, SIGNATURE, PIN_AND_SIGNATURE, ON_DEVICE, NONE. |
CardVerificationResults | String | For EMV payments, the results of the cardholder verification.
The allowed values are SUCCESS, FAILURE, UNKNOWN. |
CashBuyerSupplierMoneyAmount | Int64 | The amount of money, in the smallest denomination of the currency indicated by currency. |
CashBuyerSupplierMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
CashChangeBackMoneyAmount | Int64 | The amount of change due back to the buyer. This read-only field is calculated from the amount_money and buyer_supplied_money fields. |
CashChangeBackMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
CreatedAt | Datetime | The timestamp of when the payment was created, in RFC 3339 format. |
CustomerId | String | The Customer ID of the customer associated with the payment. |
DelayAction | String | The action to be applied to the payment when the delay_duration has elapsed. |
DelayDuration | String | The duration of time after the payment's creation when Square automatically applies the delay_action to the payment. |
DelayedUntil | Datetime | The timestamp of when the delay_action is automatically applied, in RFC 3339 format. |
EmployeeId | String | An optional ID of the employee associated with taking the payment. |
ExternalDetailsSource | String | A description of the external payment source. For example, 'Food Delivery Service'. |
ExternalDetailsType | String | The type of external payment the seller received.
The allowed values are CHECK, BANK_TRANSFER, OTHER_GIFT_CARD, CRYPTO, SQUARE_CASH, SOCIAL, EXTERNAL, EMONEY, CARD, STORED_BALANCE, OTHER. |
ExternalDetailsSourceFeeMoneyAmount | Int64 | The fees paid to the source. The amount_money minus this field is the net amount seller receives. |
ExternalDetailsSourceFeeMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
ExternalDetailsSourceId | String | An ID to associate the payment to its originating source. |
LocationId | String | The ID of the location associated with the payment. |
Note | String | An optional note to include when creating a payment. |
OrderId | String | The ID of the order associated with the payment. |
ProcessingFee | String | The processing fees and fee adjustments assessed by Square for this payment. |
ReceiptNumber | String | The payment's receipt number. The field is missing if a payment is canceled. |
ReceiptURL | String | The URL for the payment's receipt. The field is only populated for COMPLETED payments. |
ReferenceId | String | An optional ID that associates the payment with an entity in another system. |
RefundIds | String | A list of refund_ids identifying refunds for the payment. |
RefundedMoneyAmount | Int64 | The total amount of the payment refunded to date. |
RefundedMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
RiskEvaluationCreatedAt | Datetime | Provides information about the risk associated with the payment, as determined by Square. |
RiskEvaluationLevel | String | The risk level associated with the payment.
The allowed values are PENDING, NORMAL, MODERATE, HIGH. |
RiskEvaluationLevel | String | The risk level associated with the payment.
The allowed values are PENDING, NORMAL, MODERATE, HIGH. |
ShippingAddressLine1 | String | The first line of the address. |
ShippingAddressLine2 | String | The second line of the address, if any. |
ShippingAddressLine3 | String | The third line of the address, if any. |
ShippingAddressAdministrativeDistrictLevel1 | String | A civil entity within the address's country. In the US, this is the state. |
ShippingAddressAdministrativeDistrictLevel2 | String | A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
ShippingAddressAdministrativeDistrictLevel3 | String | A civil entity within the address's administrative_district_level_2, if any. |
ShippingAddressCountry | String | The address's country, in ISO 3166-1-alpha-2 format. |
ShippingAddressFirstName | String | Optional first name when it's representing recipient. |
ShippingAddressLastName | String | Optional last name when it's representing recipient. |
ShippingAddressLocality | String | The city or town of the address. |
ShippingAddressOrganization | String | Optional organization name when it's representing recipient. |
ShippingAddressPostalCode | String | The address's postal code. |
ShippingAddressSubLocality | String | A civil region within the address's locality, if any. |
ShippingAddressSubLocality2 | String | A civil region within the address's sublocality, if any. |
ShippingAddressSubLocality3 | String | A civil region within the address's sublocality_2, if any. |
SourceType | String | The source type for this payment.
The allowed values are CARD, BANK_ACCOUNT, CASH, EXTERNAL. |
StatementDescriptionIdentifier | String | Additional payment information that gets added to the customer's card statement as part of the statement description. |
Status | String | Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED. |
TipMoneyAmount | Int64 | The amount designated as a tip. |
TipMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
TotalMoneyAmount | Int64 | The total amount for the payment, including amount_money and tip_money. |
TotalMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
UpdatedAt | Datetime | The timestamp of when the payment was last updated, in RFC 3339 format. |
VersionToken | String | Used for optimistic concurrency. This opaque token identifies a specific version of the Payment object. |
Query the available list of TeamMember for a business in Square.
The driver uses the Square API to process search criteria that refer to the Id, LocationId and Status column, while other filters are processed client side within the driver. You can turn off the client-side execution of the query by setting SupportEnhancedSQL to false in which case any search criteria that refers to other columns will have an unfiltered response.
Retrieve a specific team member:
Select * FROM Teams WHERE Id='1ccaibDk3FapStf997Qi'
Retrieve the team member for a specific location:
SELECT * FROM Teams where LocationId='92BYHNBR6W77E'
Retrieve list of team members for specified locations:
SELECT * FROM Teams where LocationId IN ('92BYHNBR6W77E', '92BYHNBR6W77EABCD', '92BYHNBR6W77EABCDEFGH')
Retrieve list of Active team members:
SELECT * FROM Teams where Status = 'ACTIVE'
Retrieve list of Active team members in a given location:
SELECT * FROM Teams where LocationId='92BYHNBR6W77E' and Status = 'ACTIVE'
Name | Type | Description |
Id [KEY] | String | The Id of the team member. |
FirstName | String | The first name of the team member. |
LastName | String | The last name of the team member. |
String | The email address of the team member. | |
Status | String | Whether the team member is ACTIVE or INACTIVE.
The allowed values are ACTIVE, INACTIVE. |
CreatedAt | Datetime | The time when the team member entity was created. |
UpdatedAt | Datetime | The time when the team member entity was last updated. |
PhoneNumber | String | The phone number of the team member. |
ReferenceId | String | A second ID used to associate the team member with an entity in another system. |
IsOwner | Boolean | Whether the team member is the owner of the Square account. |
AssignmentType | String | The current assignment type of the team member. |
LocationId | String | The locations that the team member is assigned to. |