## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://docs.m3ter.com/llms.txt)

Use this file to discover all available pages before exploring further.

You can define and manage integrations for sending your end customer Account Bills generated in m3ter outbound into your Xero system:

- First, [create the integration](https://docs.m3ter.com/guides/integrations/setting-up-integrations/configuring-stripe-integrations#creating-the-integration).
- Second, [set up authentication](https://docs.m3ter.com/guides/integrations/setting-up-integrations/configuring-stripe-integrations#setting-up-authentication-for-integration) for the integration to connect with Xero.

**Important! Notes and Warnings:**

- **Note: Xero Integration in Beta Release!** Please note that the Xero integration is currently in beta release:
  - See [Feature Release Stages](https://docs.m3ter.com/guides/getting-started/feature-release-stages) for Beta release definition.
  - If you intend to implement this integration for your m3ter Organization, please contact m3ter Support or your m3ter contact person to discuss.
- **Note: Accounting Products?** Many line item types can be mapped to specific Accounting Products to serve your revenue recognition and accounting purposes. Where this is the case, the integration will use the assigned Accounting Products.
- **Note: Reviewing Integration Runs!** When you’ve set up an integration with Xero for your Organization in your production environment, you can review details of the integration runs performed for the integration. See [Reviewing Integration Run Details](https://docs.m3ter.com/guides/integrations/setting-up-integrations/reviewing-integration-run-details).
- **Warning: High-Precision Values!** The Xero system _does not_ currently support high-precision values. Values with more than 2 decimal places of precision are rounded leading to inaccurate values. Please bear this in mind when pricing Product Plans and entering a price per unit, and when defining maximum decimal places for Currencies.

## Creating the Integration

You can quickly set up a Xero integration in the Console.

**To define a m3ter - Xero integration:**

1. Select **Integrations**:
    The **Integrations** page opens with **All** selected by default.
2. Select **Xero**:
    The **Integrations>Xero** page opens.
3. On the **Configurations** panel, select **Configure new integration>Configure bill integration**:
    The **Create** page opens and the **Entity type** - **Bill** and **External system** - **Xero** are shown at the top of the page.
4. Use the **Global configuration** panel to:
   - Enter a **Name** for the Integration. This is required and is useful if you intend to create multiple Integrations for the same External system/Entity type and need to clearly differentiate them.
   - Select the Accounts you want the integration to apply to:
     - **Account ids.** Select the Accounts you want to include - all selected Accounts are treated as _allowed_ for the integration.
     - **Restricted account ids.** Select the Accounts you want to exclude - all selected Accounts are treated as _disallowed_ for the integration.

**Notes:**

- If you want to include _all Accounts_ in the integration, leave both **Accounts ids** and **Restricted account ids** empty.
- Any filtering by **Account ids** you define using these settings to control which Accounts the integration runs for will be _in addition_ to any filtering you define using the **Account filter** option.

- Select Users for Email notifications if disabled:
   - **Integration disabled notification users**. Select Organization Users you want to receive an Email notification if the integration is automatically disabled.

**Notes:**

- An integration is automatically disabled if there have been 20 successive previous error Event responses to earlier attempts to run the integration. See [Reviewing and Resolving Integration Events](https://docs.m3ter.com/guides/integrations/setting-up-integrations/reviewing-and-resolving-integration-events) for more details.
- If you select Organization Users to receive an Email notification when the integration is automatically disabled, their User id will be listed under **Configuration Data** on the **Integration Details** page.

5. Use the **Entity configuration** panel to configure the m3ter entity you will be synchronizing with for the integration. In the case of an outbound Bill integration, this entity will be the Bill generated for a customer Account in m3ter:
   - **Only send bill on approval.** Enable this if you only want Bills to be sent when they have been approved. If disabled, the Bill will be sent every time it is regenerated. Default is disabled.
   - **Use external mapping account code.** Enable this if you want the integration to look in the External Mappings for the Account identifier code, which means you can use an external Id. If this is disabled, the m3ter Account Id is used. Default is disabled.
   - **Excluded line item types.** Optionally, filter the Bill line item types you send to the destination system. 
   - **Account filter**. Optionally, enter an expression that is run on the Account to determine whether or not the integration includes the Account.
  **Notes:**
- **Other Account fields for Account filter expression?** You can reference other fields on the Account object in the **Account filter** expression. 
- **Additional filtering?** Any global filtering you define using the settings to include/exclude Accounts for integration runs by **Account ids** will be _in addition_ to any filtering you define using the **Account filter** option.

- **Enforce external mappings for config**. Optionally enable this if you want the integration to use only those external mappings specified as being for this configuration.

- **Excluded products**. Optionally filter the Bill line items you send to the external system.

- **Excluded aggregations**. Optionally filter the Bill line items you send to the external system.

6. Use the **External system configuration** panel to enter the settings specific to the external system:
   - **Split usage line items**. This setting determines how m3ter will create usage invoice items in Xero.
   - **Sort line items by**. Optionally, select a property to sort line items by before they are sent out to the external system.
   - **Xero describe pricing bands**. 
   - **Strict line item mapping**.

**Possible rounding errors!** If you enable **Strict line item mapping**, this might result in rounding errors for the originating **Quantity** or **Unit price** values being mapped directly.

7. Select **Create integration**. You are returned to the **Integrations>Xero** page, where the integration is listed on the **Configurations** panel:

## Setting Up Authentication for the Integration

When you’ve created a Xero integration, you can select an Integration Credential you’ve created for authentication allowing the integration to connect with your Xero system. **To set up authentication for your m3ter - Xero integration:**

1. Select **Integrations**. The **Integrations** page opens.
2. Select **Xero**. The **Integrations>Xero** page opens.
3. On the **Configurations** panel, select the **Name** hotlink text of the Xero integration you want to set up authentication for.
   
4. Select **Connect credential**. A **Select credential** modal appears.
5. Select a Credential you created earlier and want to use to authenticate the integration with Xero.
6. Select **Confirm**. The modal closes and on **Integrations details** the integration now shows as **CONNECTED**:

- The Credential used to connect the integration is shown.
- If at any time you want to disconnect the integration, select **Disconnect credential**.
- If you want to use a different Credential for connecting the integration, select **Change credential**.
