> ## 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 Xero app for OAuth.

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

* Client ID
* Client Secret
* Scopes

### Pre-requisites

1. Xero Developer account. You can create one [here](https://www.xero.com/signup/developers/).

### Required Settings

* **Mandatory Scopes**

1. offline\_access
2. openid
3. profile
4. email
5. accounting.transactions

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

### Creating an app in Xero

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

1. Log in to your [Xero Developer account](https://developer.xero.com/app/manage).
2. Under `My Apps` tab in the top nav bar, click on the  `New app` button.

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

3. Go to your [`Apps catalog`](https://app.gocobalt.io/apps) in **Refold** > Search for `Xero` > `Settings` > `Use your credentials` > `Callback Url` >  Copy it.
4. After clicking on `New App` in Xero, enter the `App Name`, select `Integration type` as **Web app**, provide a company URL, paste the Callback Url under `Redirect URI` and click on the `Create app` button.
5. Navigate to **Configuration** in the side menu, copy the **Client ID** and get the **Client Secret** by clicking on `Generate a secret`.

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

#### Configuring credentials in Refold

App settings page lets you configure the authentication settings for an `OAuth2` 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/Xero/xero_cobalt.png?fit=max&auto=format&n=PicQQg0XJq1JrBVB&q=85&s=62cbaafa45b4eb75181b4c8bdc16e332" alt="Setting up application client credentials" data-path="images/Xero/xero_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/Xero/xero_scopes.png?fit=max&auto=format&n=PicQQg0XJq1JrBVB&q=85&s=1f93abf35ac04cda95453624acdba0bd" alt="OAuth Scopes" data-path="images/Xero/xero_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 Xero actions and triggers. Following are the set of Xero actions and triggers
supported by Refold.

<Tabs>
  <Tab title="Actions">
    <AccordionGroup>
      <Accordion title="Contact">
        1. **Create Contact** - Create a contact in Xero.
        2. **Upsert Contact** - Update a contact in Xero.
      </Accordion>

      <Accordion title="Credit Note">
        3. **Upsert Credit Note** - Upsert Credit Note in Xero.
      </Accordion>

      <Accordion title="Employee">
        4. **Upsert Employee** - Upsert employee in Xero.
      </Accordion>

      <Accordion title="Invoice">
        5. **Upsert Invoice** - Upsert invoice in Xero.
      </Accordion>

      <Accordion title="Payment">
        6. **Create Overpayment** - Create overpayment in Xero.
        7. **Create Invoice Payment** - Create invoice payment in Xero.
        8. **Delete Payment** - Delete a payment in Xero.
      </Accordion>

      <Accordion title="Transaction">
        9. **Create Transaction** - Create a transaction in Xero.
        10. **Upsert Transaction** - Upsert a transaction in Xero.
        11. **List Transaction** - List all transactions in Xero.
      </Accordion>

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

  <Tab title="Triggers">
    There are no triggers in this application.
  </Tab>
</Tabs>
