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

# Quickstart

> Create a sandbox, publish a product and generate your first payment link.

Start with a test key. Sandbox payments do not move real money. Keep secret keys
on your server, never in a browser bundle or source control.

Integrating with an AI agent? Start with [agent onboarding](https://beinfi.com/en/agent-onboarding).
It collects your email, app name and billing intent, then prepares the environment
and returns a link to finish registration in Infi.

## 1. Create a sandbox

In a new project directory, run:

```bash theme={null}
npx -y @beinfi/cli bootstrap --intent one-time --ref docs --json
```

The CLI provisions a sandbox, writes `infi.company.ts` and `.env.local`,
syncs an example one-time product with a published version, and runs its checks.
Review the generated catalog and price before using it.

Save the returned claim URL: opening it lets you claim ownership of the tenant.
The default claim window is 30 days; use the returned `expiresAt` as the deadline.
Do not commit the generated secret key. With the claim-email update, provisioning
with an email also queues the claim link for delivery, at most once per address
every 24 hours. Always keep the returned link; provisioning success does not
confirm email delivery. The bootstrap command above does not supply an email.

If you only need a sandbox key, without generating project files:

```bash theme={null}
npx -y @beinfi/cli claim create --json
```

That second command does not give you a ready-to-sell product. The seed product
is a draft; create and publish your own product before creating a payment link.
The detailed [catalog guide](https://beinfi.com/en/catalogo) has the three calls.

## 2. Install the SDK

```bash theme={null}
npm install @beinfi/sdk
```

Load `INFI_SECRET_KEY` and `INFI_TENANT_SLUG` from the generated environment
file in your server runtime. Then:

```ts theme={null}
import { Infi } from "@beinfi/sdk";

const infi = new Infi({
  secretKey: process.env.INFI_SECRET_KEY!
});

const products = await infi.products.list();
```

Test keys (`sk_test_`) select the sandbox API and checkout. Live keys
(`sk_live_`) select production. You do not need to set a base URL.

## 3. Create a payment link

After the one-time bootstrap, use the published `item` product:

```ts theme={null}
const product = products.find((entry) => entry.key === "item");
if (!product?.id) throw new Error("Publish the example product first.");

const { url } = await infi.links.create(product.id, {
  slug: process.env.INFI_TENANT_SLUG!
});

console.log(url);
```

Open the returned URL. The customer and invoice are created when the buyer
submits checkout. A payment link is not proof that a payment succeeded.

The route is selected at payment time from compatible providers. For live
payments, connect your own supported provider account first.

## 4. Confirm the result

In the sandbox, use the test checkout and poll the invoice. Once you have the
invoice ID:

```ts theme={null}
const paid = await infi.pay.waitForPaid({
  slug: process.env.INFI_TENANT_SLUG!,
  invoiceId
});
```

`true` means the invoice is paid; `false` means polling timed out. Use
[signed webhooks](https://beinfi.com/en/webhooks) for production. Sandbox webhook registration
currently depends on a secret store that may be unavailable; polling is the
documented sandbox path.

## 5. Go live

Claim your tenant, connect a provider account, register your webhook endpoint and
use a live key. Check provider status in your dashboard before accepting payments.

Existing saved cards, subscriptions and provider-specific code are not
automatically migrated when you connect a provider. The Stripe-compatible SDK
is a separate Early access surface; the examples here use `@beinfi/sdk`.

Read the [SDK guide](https://beinfi.com/en/sdk) for idempotency and the
[HTTP API reference](https://beinfi.com/en/api-http) if you use another language.
