SquareFinancial services, merchant service aggregator and mobile payment service.
Square allows users to send and receive money for free through a mobile application using Square Cash, and that lets merchants process payments via smartphone using Square Point-of-Sale.
Within the workflow builder, highlight the Square connector.
In the Square connector properties panel to the right of the builder, click on the Authenticate tab and the 'Add new authentication' button.
This will result in a Tray.io authentication pop-up modal. The first page will ask you to name your authentication and select the type of authentication you wish to create ('Personal' or 'Organisational').
The next page asks you for your 'Client ID' and 'Client Secret' credentials and also which 'Environment you would like to use; 'Production' or 'Sandbox'.
In order to get these fields, head to the Square developer dashboard. Log in and then click on the OAuth2 application you would like to use or create one if you haven't already by clicking the '+'.
To get the 'Client ID' and 'Client Secret', head to the OAuth section by selecting the 'OAuth' tab from the left panel. Depending on whether you want to use 'Production' or 'Sandbox', select the appropriate tab available on the top of the page.
If you are using a Sandbox environment, make sure you have your Sandbox account created. If not, refer to the Using the Sandbox Environment section below to create your Sandbox account.
On this page, you will now see 'Application ID' and 'Application Secret'. You can copy and paste these credentials into the Tray.io authentication pop-up window, where you can also select the corresponding 'Environment'.
You must also set the 'Redirect URL' on this page to Tray.io's redirect URL
Once you have entered the 'Redirect URL' and entered all the details into the Tray.io authentication modal, the next step is to select the required scopes available on the Tray.io authentication modal. Select them all if you want to use all the operations, and then click the 'Create authentication' button.
Go back to your settings authentication field (within the workflow builder properties panel), and select the recently added authentication from the dropdown options now available.
Your connector authentication setup should now be complete.
Using the Sandbox Environment
To create your Sandbox account, head back to the Square developer dashboard. At the bottom of the page, there is a section called 'Sandbox Test Accounts'.
Click 'Add' to create an account if you have not already got one, and then proceed to enter an 'Account Name' of your choice and select a 'Country'. Then click 'Create'.
Once the account is successfully created, open the account using the 'Open' tab available on the right-hand side of the 'Sandbox Test Accounts' section. This will open the Sandbox Square dashboard.
With the Sandbox Square dashboard open all the time, you can authenticate your Square connector for the Sandbox environment using the authentication process mentioned in the Authentication section above.
The examples below show one or two of the available connector operations in use.
Please see the Full Operations Reference at the end of this page for details on all available operations for this connector.
Using the Raw HTTP Request ('Universal Operation')
As of version 1.0, you can effectively create your own operations.
This is a very powerful feature which you can put to use when there is an endpoint in Square which is not used by any of our operations.
To use this you will first of all need to research the endpoint in the Square API documentation Version 2021-01-21, to find the exact format that Square will be expecting the endpoint to be passed in.
Note that you will only need to add the suffix to the endpoint, as the base URL will be automatically set (the base URL is picked up based upon the value you selected for the environment while creating your authentication).
The base URL for Square is:
As an example, say that the 'List payments' operation did not exist in our Square connector, and you wanted to use this endpoint. You would use the Square API docs to find the relevant endpoint - which in this case is a
GET request called:
More details about this endpoint can be found here.
As you can see, there is also the option to include a query parameter for filtering, should you wish to do so. So if you know what your method, endpoint, and details of your query parameters are, you can get the payment information with the following settings:
Query Parameter: Key:
Final outcome being: https://connect.squareup.com/v2/payments?total=100
Below is an example of a way in which you could potentially use the Square connector, to get orders related to payments equal to a certain amount of money.
The steps will be as follows:
- Setup using a manual trigger and Square connector to list payments
- Loop through the list of payments
- Get the order related to each payment
1 - Setup Trigger & Square connector to list payments
Once you have clicked 'Create new workflow' from your main Tray.io dashboard named it, select the Manual trigger from the trigger options available:
From the connectors panel on the left, add a Square connector to your workflow. Set the operation to 'List payments'.
Feel free to re-name your steps as you go along to make things clearer for yourself and other users. The operation names themselves often suffice.
You can also filter the list of payments using the available fields on the properties panel. In our example, we are going to filter out all payments that are not exactly $100. To do this we add value
100 to the 'Total' field.
Once this is setup, we are now returning all payments that are exactly $100.
2 - Loop through the list of payments
Next, search for the Loop collection connector within your connector panel, and drag it into your workflow as your next step. Set your operations to 'Loop list'.
The Loop Collection connector allows you to iterate through a list of results. In this example, we will use it to iterate through the data found within the previous Square connector step.
In order to specify the list you want to loop through, start by using the list mapping icon (found next to the list input field, within the properties panel) to generate the connector-snake.
While hovering over the 'square-1' step (with the tail end of the connector-snake), select
payments from the list of output properties displayed. This will auto-populate a jsonpath within your list input field, and update the type selector to jsonpath.
For more clarification on the pathways you have available, open the [Debug panel] (/platform/troubleshooting/logs-and-debugging/) to view your step's Input and Output.
3 - Get the order related to each payment
The last step is to drag a Square connector inside of the Loop Collection step itself. Set the operation to 'Get order'. As you can see, the 'Order ID' field is required.
Again use the 'Order ID' mapping icon to generate the connector-snake, this time hover the tail over the 'loop-1' step and select
order_id from the output properties.
The step is now setup and this will return each order that totalled exactly $100.
By running the workflow and going to the 'Debug' panel, you will be able to see the result. The 'Loop Collection' will result in potentially running the 'square-2' step multiple times for all the items found in the 'square-1' step.