> For the complete documentation index, see [llms.txt](https://docs.xenoraa.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xenoraa.com/xenoraa-super-admin-operations-manual/tenant-lifecycle-and-subscription-management.md).

# Tenant Lifecycle & Subscription Management

## Tenant Lifecycle & Subscription Management

As a Super Admin, managing the lifecycle of your tenants is your most frequent and critical task. Xenoraa implements a robust multi-tenant model where each tenant's data is isolated and scoped by their `user_id` (the tenant owner). This chapter guides you through creating, suspending, impersonating, and managing modules for your tenants.

***

### 1. Tenant Overview & Search

The Tenants page (`/superadmin/users`) lists all registered platform subscribers. Sub-users created by tenant admins (such as their staff, cashiers, or accountants) are filtered out of this view to keep your subscriber list clean and actionable.

#### Filtering and Exporting Tenants

* **Plan Filter:** Filter tenants by **Starter**, **Professional**, **Business**, or **Suspended** status.
* **Search Bar:** Search instantly by tenant name, email, or username.
* **CSV Export:** Click **Export CSV** to download the filtered subscriber list for offline reporting or marketing campaigns.

***

### 2. Step-by-Step Operational Workflows

#### Workflow A: Suspending or Activating a Tenant

If a tenant fails to pay their subscription, violates terms of service, or requests account closure, you must suspend their account. Suspension immediately blocks their access to the admin dashboard and public-facing storefronts.

```
[Tenant List] ──(Click Tenant)──> [User Detail Page] ──(Click Toggle Status)──> [Confirm Suspension]
```

1. Navigate to **Tenants** (`/superadmin/users`).
2. Search for the tenant and click **View** to open their detail page (`/superadmin/users/{id}`).
3. Locate the **Status Badge** in the header.
4. Click the **Suspend Account** button (or **Activate Account** if the tenant is currently suspended).
5. The system will toggle the `status` column in the `users` table to `suspended`. The tenant will be logged out immediately and redirected to a suspension notice page.

***

#### Workflow B: Impersonating a Tenant (Login-As-User)

When troubleshooting an issue reported by a tenant, you can securely log into their account without asking for their password. This is called **Impersonation**.

1. Open the tenant's detail page (`/superadmin/users/{id}`).
2. Click the **Impersonate User** button in the top action bar.
3. The system will store your Super Admin ID in the session (`Session::put('superadmin_id', auth()->id())`) and log you in as the tenant.
4. You will be redirected to the tenant's dashboard (`/admin/dashboard`) with full access to their CRM, POS, Accounts, and settings.
5. A persistent **Exit Impersonation** bar will be docked at the top of the screen.
6. Once troubleshooting is complete, click **Exit Impersonation** to safely return to your Super Admin session.

***

#### Workflow C: Managing Tenant Modules & Seats

Xenoraa allows you to customize which modules are active for a specific tenant and override their maximum seat count. This is useful for upselling custom add-ons or providing custom pricing packages.

1. Navigate to **Plan Modules** (`/superadmin/plan-modules`).
2. Search for the target tenant.
3. **Toggle Modules:** Check or uncheck modules (CRM 2.0, Accounts, POS, E-Commerce, Xena AI) to enable or disable them for that tenant.
4. **Override Seats:** Enter a custom number in the **Max Seats** field to override their default plan limit.
5. Click **Save Changes** to update the `tenant_modules` and `tenant_seat_overrides` tables. The changes take effect immediately on the tenant's next page load.

***

### Tenant Status & Plan Matrix

The following matrix outlines the differences between tenant states and subscription tiers:

| Status / Plan       |  CRM 2.0  |  Accounts |      POS     | E-Commerce |   Xena AI  | Max Seats |
| ------------------- | :-------: | :-------: | :----------: | :--------: | :--------: | :-------: |
| **Starter**         |  ✅ Basic  |     ❌     |       ❌      |      ❌     |      ❌     |  3 seats  |
| **Professional**    |   ✅ Full  |  ✅ Basic  | ✅ 1 Terminal |      ✅     | ✅ (100 cr) |  10 seats |
| **Business**        |   ✅ Full  |   ✅ Full  |  ✅ Unlimited |      ✅     | ✅ (300 cr) | Unlimited |
| **Suspended**       | ❌ Blocked | ❌ Blocked |   ❌ Blocked  |  ❌ Blocked |  ❌ Blocked |  0 seats  |
| **Custom Override** |   Custom  |   Custom  |    Custom    |   Custom   |   Custom   |   Custom  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.xenoraa.com/xenoraa-super-admin-operations-manual/tenant-lifecycle-and-subscription-management.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
