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

# Setup

> Connect to your Zettle app for OAuth.

To setup your Zettle app in Refold for OAuth, you will need the following credentials from your [Zettle Developer account](https://developer.zettle.com/dashboard):

* Client ID
* Client Secret
* Scopes

### Pre-requisites

1. Zettle Developer account. You can create one [here](https://developer.zettle.com/register).

### Required Settings

* **Mandatory Scopes**

1. READ:USERINFO

<Info>If you haven't already created an app in Zettle, you'd need to create one.</Info>

### Creating an app in Zettle

To create a Zettle app and acquire the above mentioned credentials, please follow the steps mentioned below:

1. Log in to your [Zettle Developer account](https://developer.zettle.com/dashboard) Dashboard.
2. Click on `Create new app credentials` and select `Public API Credentials` button.

<img height="200" src="https://mintcdn.com/cobalt-55/PicQQg0XJq1JrBVB/images/Zettle/zettle_navigation.png?fit=max&auto=format&n=PicQQg0XJq1JrBVB&q=85&s=1a797cfc277d5313a72e7df5cffe31fb" alt="Navigation for App setup" data-path="images/Zettle/zettle_navigation.png" />

3. Go to your [`Apps catalog`](https://app.gocobalt.io/apps) in **Refold** > Search for `Zettle` > `Settings` > `Use your credentials` > `Callback Url` > Copy it.

4. Provide the `App name`, `App URL`, `Company Name` and paste the Callback Url copied in `OAuth Redirect URIs` field. Click on `Create credentials`.

5. Copy the **Client ID** and **Client Secret** from the **API app Credentials** section.

<Note>
  Ensure that the Client secret is saved as it will be shown only once.
</Note>

<img height="200" src="https://mintcdn.com/cobalt-55/PicQQg0XJq1JrBVB/images/Zettle/zettle_credentials.png?fit=max&auto=format&n=PicQQg0XJq1JrBVB&q=85&s=c539f57784f5c70e45f162d1b730e508" alt="Getting Credentials" data-path="images/Zettle/zettle_credentials.png" />

#### Configuring credentials in Refold

App settings page lets you configure the authentication settings for an `OAuth 2.0` based application. For your customers to provide you authorization to access their data,
they would first need to install your application. This page lets you set up your application credentials.

<img height="200" src="https://mintcdn.com/cobalt-55/PicQQg0XJq1JrBVB/images/Zettle/zettle_cobalt.png?fit=max&auto=format&n=PicQQg0XJq1JrBVB&q=85&s=f9cb9bfe951e30819c4808397b5073cd" alt="Setting up application client credentials" data-path="images/Zettle/zettle_cobalt.png" />

Provide the acquired Client ID and Client Secret under Settings of the app and save it.

#### Configuring Scopes

Refold lets you configure what permissions to ask from your users while they install your application. The scopes can be added or removed from the App settings page, under `Permissions & Scopes`
section.

For some applications Refold sets **mandatory scopes** which cannot be removed. Additional scopes can be selected from the drop down. Refold also has the provision to add any
custom scopes supported by the respective platform.

<img height="200" src="https://mintcdn.com/cobalt-55/PicQQg0XJq1JrBVB/images/Zettle/zettle_scopes.png?fit=max&auto=format&n=PicQQg0XJq1JrBVB&q=85&s=8c070952884525791e7e317aa89ba0df" alt="OAuth Scopes" data-path="images/Zettle/zettle_scopes.png" />

Once the scopes has been added to the application in Refold, the app will now request for access of the mentioned scopes.

<Warning>
  If you are facing scopes missing or invalid scope error. Make sure you are not passing any custom scope not supported by the platform.
</Warning>

#### Actions and triggers

Once the above setup is completed, you can create orchestrations of your use-cases using Zettle actions and triggers. Following are the set of Zettle actions and triggers
supported by Refold.

<Tabs>
  <Tab title="Actions">
    <AccordionGroup>
      <Accordion title="Inventory">
        1. **List Inventories** - List all inventories in Zettle.
        2. **Create Inventory** - Create new inventory in Zettle.
        3. **Update Inventory Balance** - Update an inventory balance in Zettle.
      </Accordion>

      <Accordion title="Products">
        4. **List Products** - List all products in Zettle.
        5. **Create Product** - Create new product in Zettle.
        6. **Update Product** - Update a product in Zettle.
      </Accordion>

      <Accordion title="Purchases">
        7. **List Purchases** - List all purchases in Zettle.
        8. **Get Purchase by ID** - Get a purchase by ID in Zettle.
      </Accordion>

      <Accordion title="Others">
        9. **HTTP Request** - Make HTTP API calls to any Zettle documented REST APIs.
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Triggers">
    1. **Product Created** - Triggers when a product is created on Zettle.
    2. **Purchase Created** - Triggers when a purchase is created on Zettle.
    3. **Inventory Balance Changed** - Triggers when inventory balance is changed on Zettle.
  </Tab>
</Tabs>
