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

# Stripe & Xero Integration

> Connect Stripe and Xero to automatically sync invoices, detect recurring revenue, and reconcile payments.

WisePilot connects to Stripe and Xero to pull in invoice data, detect MRR patterns, and reconcile charges against your revenue records.

## Stripe

### Connecting

1. Navigate to **Settings > Integrations**
2. Click **Connect Stripe** and enter your Stripe API key
3. Once connected, your invoices and charges appear in the **Invoices** tab

### What Syncs

* **Invoices** — All Stripe invoices with customer, amount, and subscription details
* **Standalone charges** — Charges not attached to invoices (common for simple billing setups)
* **Active subscriptions** — Available as a dropdown when creating revenue records

### MRR Detection

WisePilot groups standalone charges by customer and amount to detect recurring patterns:

1. Charges with the same customer and amount are grouped
2. The average interval between charges is calculated
3. Monthly (20-45 days), quarterly (80-100 days), and annual (350-380 days) patterns are identified
4. Detected patterns surface with a one-click action to create a revenue record

<Tip>
  MRR detection works best with at least 2 charges from the same customer at the same amount. New subscriptions will be detected after their second charge.
</Tip>

### Cross-Website Exclusion

If multiple websites share a Stripe account, each charge can only be claimed by one website. Charges claimed by other websites are automatically hidden from your invoice feed.

## Xero

### Connecting

1. Navigate to **Settings > Integrations**
2. Click **Connect Xero** to start the OAuth flow
3. Authorize WisePilot in your Xero account
4. Select the Xero tenant (organization) to link

### What Syncs

* **Invoices** — Accounts receivable invoices with contact and line item details
* **Repeating invoices** — Recurring invoice templates for MRR matching
* **Contact filtering** — Filter invoices by contact name or account code in settings

### Token Refresh

Xero OAuth tokens expire every 30 minutes. WisePilot automatically refreshes them with a graduated retry system:

* **Strike 1** — Retry immediately
* **Strike 2** — Wait and retry
* **Strike 3** — Mark connection as unhealthy; re-authorize from Settings

<Warning>
  If your Xero connection shows as unhealthy, click **Reconnect** in Settings to re-authorize. This usually means the refresh token has expired (after 60 days of inactivity).
</Warning>

## Reconciliation States

Every invoice from Stripe or Xero is assigned a reconciliation status:

| State          | Meaning                                                              | Action                         |
| -------------- | -------------------------------------------------------------------- | ------------------------------ |
| **Matched**    | Auto-linked to a revenue record (via subscription or charge pattern) | None needed                    |
| **Unmatched**  | No matching revenue record found                                     | Create as one-time, or dismiss |
| **Reconciled** | Manually confirmed as linked to a revenue record                     | None needed                    |
| **Dismissed**  | Marked as irrelevant (refunds, test charges, internal transfers)     | Can be undone                  |

The **Unmatched** filter is selected by default so you can quickly process new charges that need attention.
