# Testing Lago integrations safely

Lago supports isolated integration testing without using a production billing environment.

## Lago Cloud

Create separate Lago organizations for staging and production. Each organization has its own API keys, customers, plans, events, subscriptions, invoices, and webhook configuration. Use the staging organization base URL and API key in test workloads, and keep its credentials separate from production.

## Self-hosted test environment

Run the open-source Lago stack locally or in an isolated test deployment with Docker. A self-hosted test instance exposes the same REST API and lets an agent exercise customer, subscription, event, invoice, and webhook workflows without changing Lago Cloud production data.

## Recommended workflow

1. Create or deploy a dedicated test environment.
2. Create a test-only API key and store it in a secret manager.
3. Configure test webhook destinations.
4. Create disposable customers, plans, and subscriptions.
5. Send deterministic usage events with unique `transaction_id` values.
6. Verify results, then delete or recreate the isolated environment as needed.

## References

- [Integration testing guide](https://getlago.com/docs/guide/integration-testing)
- [Self-hosted Docker guide](https://getlago.com/docs/guide/lago-self-hosted/docker)
- [API authentication](https://getlago.com/auth.md)
