> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Square

> Connect Alumio to Square.

## Extra information

Connector package documentation:
System documentation:

# Setting up HTTP Client Square

## Steps

1. In Alumio Dashboard, go to Clients > HTTP Clients. Create a new HTTP Client and select Square HTTP Client as the prototype of the HTTP Client.
2. Fill in the Base URI, and Authentication Type
3. If you Picked Token, Fill in the Token.
4. If you Picked the Oauth2 Code, Fill in the Client ID, Client Secret, Code and Scopes (optional).

# Subscribing to Entities from Square

## Steps

1. Go to Connections -> Incoming and create a new incoming configuration and select Square Subscriber as the subscriber.
2. Select the entity you want to subscribe from Square.
3. Add any request parameters needed to subscribe to the entity (optional).
4. You can optionally add a transformer to transform the request parameters into something you need.
5. Select the Square HTTP Client to use.

## General Concept

We follow Square documentation on building this connector so you can easily use the connector based on Square API Reference.

**Entity**
It’s the entity you want to subscribe from Square. Please refer to the entities in Management APIs from Square API Reference page.

**Request Parameters**
These are the parameters you can provide to get the needed entity based on Square API Reference. Please look at the example below on how to fill Request Parameters field when subscribing Single Request entity

<img src="https://mintcdn.com/alumio/2XcHi1eVMdbU3dfQ/images/connectors/square-01.png?fit=max&auto=format&n=2XcHi1eVMdbU3dfQ&q=85&s=5a4df5b0b3e295ff1d2c9330d0f29f62" alt="Square connector screenshot 1" width="690" height="395" data-path="images/connectors/square-01.png" />

<img src="https://mintcdn.com/alumio/2XcHi1eVMdbU3dfQ/images/connectors/square-02.png?fit=max&auto=format&n=2XcHi1eVMdbU3dfQ&q=85&s=ce62703e8f6f90e0bd3cbc25198cbdd5" alt="Square connector screenshot 2" width="690" height="226" data-path="images/connectors/square-02.png" />

That’s why we need to define **group\_id** property inside **path** property in the Request Parameters field. The properties inside **query** parameters will be parsed as query parameters. Here is the final URL that will be called when using such Request Parameters field.

/v2/customers/groups/6X2498EPBWFMZW7RQJW4ZFZZAA

**Input Transformer**
Any transformer’s set here will be executed after the Request Parameters loaded. So, you basically can add any transformer to provide and transform the request parameters into anything you need either as path parameters and/or as query parameters of an entity.

**HTTP Client**
It’s the HTTP Client configuration or prototype you will use to access Square.

# Publishing Entity to Square

## Steps

1. Go to Connections -> Outgoing, create a new outgoing configuration and select Square Publisher as the publisher.
2. Select the action that you want the publisher to do with the data.
3. Select the Square entity you want the data to be published to.
4. Select the HTTP Client to use.
   <img src="https://mintcdn.com/alumio/2XcHi1eVMdbU3dfQ/images/connectors/square-03.png?fit=max&auto=format&n=2XcHi1eVMdbU3dfQ&q=85&s=a35c036de1f071b488309bdb4ca0991c" alt="Square connector screenshot 3" width="690" height="212" data-path="images/connectors/square-03.png" />

## General Concept

Like the subscriber, the publisher has similar methods on how to use it. The difference is the payload that will be submitted by the publisher originating from the data (from routes, from transformers in outgoing configuration).

**Action**
Currently we support Create (HTTP POST method), Update (HTTP PUT method), and Delete (HTTP DELETE method).

**Entity**
We support publishing to most Square endpoints but not with publishing binary files at the moment. Please refer to the entities in Management APIs from Square API Reference page. Based on the documentation, some endpoints may need one or more path parameters.

For endpoints that require object as the request payload, please look at the example below. For example, we want to Delete Customer Group. Please select “Delete” as the action and “Delete Customer Group” as the entity of the publisher.

<img src="https://mintcdn.com/alumio/7UvD5mMEqL1iwmZ5/images/connectors/square-04.png?fit=max&auto=format&n=7UvD5mMEqL1iwmZ5&q=85&s=51bdd034ca2373b5ed063a77b9842e12" alt="Square connector screenshot 4" width="690" height="214" data-path="images/connectors/square-04.png" />

<img src="https://mintcdn.com/alumio/7UvD5mMEqL1iwmZ5/images/connectors/square-05.png?fit=max&auto=format&n=7UvD5mMEqL1iwmZ5&q=85&s=39eaf2cb0dfb9bb7f4b3f10738cb693e" alt="Square connector screenshot 5" width="690" height="219" data-path="images/connectors/square-05.png" />

You can put the payload you want to send to Square into payload property in the data.

Alumio will send an API request to Square with URL /v2/customers/groups/6X2498EPBWFMZW7RQJW4ZFZZAA

**HTTP Client**
It’s the HTTP Client configuration or prototype you will use to access Square.

# Extra Note

## Payload in Incoming

For Incoming that is using POST Method.

Ex: Search Vendors
in the docs they give example on payload like this.

<img src="https://mintcdn.com/alumio/7UvD5mMEqL1iwmZ5/images/connectors/square-06.png?fit=max&auto=format&n=7UvD5mMEqL1iwmZ5&q=85&s=a7459a1e4d4e919775aa16a01f06ac9b" alt="Square connector screenshot 6" width="409" height="500" data-path="images/connectors/square-06.png" />

Take a look at the Data given.
this will give an error, where the query is unknown.

Instead remove the Query like this.

```
{
  "filter": {
    "status": [
        "ACTIVE"
      ]
    },
    "sort": {
      "field": "CREATED_AT",
      "order": "ASC"
    }
  }
```

Or in Alumio like this

```
{
  "path": [],
  "query": [],
  "payload": {
    "filter": {
      "status": [
        "ACTIVE"
      ]
    },
    "sort": {
      "field": "CREATED_AT",
      "order": "ASC"
    }
  }
}
```
