Integration
Lovable
Sign up in the agent conversation and integrate the SDK on the server.
Updated
1. Prepare the account
Look for existing Infi credentials first. Reuse an existing integration through normal sign-in. For a new account, follow agent onboarding. Ask for the email, app name and offer intent. Explain that the OTP authorizes creating a sandbox account and handing its test credentials to this project.
2. Confirm the email in the conversation
Connect the remote MCP at https://api-sandbox.beinfi.com/mcp without a token
for new signup. Call onboarding_start_v1 for the missing-field questions,
then repeat with the returned key and the person's answers to request the OTP.
Ask for this signup's six-digit code and call onboarding_verify_v1.
The complete result contains account with the owner already linked and test
keys. Give the person dashboardUrl for later sign-in with the same email.
There is no claim step.
Without MCP, the agent follows the two HTTP calls in the onboarding guide.
3. Env in the Lovable app
INFI_SECRET_KEY=sk_test_...
INFI_PUBLISHABLE_KEY=pk_test_...
INFI_TENANT_SLUG=your-tenantSave INFI_SECRET_KEY in your server functions' secrets. Only
INFI_PUBLISHABLE_KEY may be exposed in the browser when a client API requires
one; it is Infi's, not the payment provider's. Never expose the secret in a
VITE_* variable. Provide only this signup OTP to the agent. Never provide your password.
Do not set INFI_AUTH_BASE_URL / INFI_PAY_BASE_URL — they are legacy and
nothing reads them. The hosts come from the key's prefix.
4. Create the product
The seed product is good for neither selling nor metering (version in draft,
no meter). Create and publish your own — three calls in
catalog. Keep the productId: it goes into the payment
link, checkout() and every usage event.
5. Integrate the SDK
Infi does not log your user in — use the auth the app already has (Supabase, in the typical Lovable case) and pass that id to Infi.
// server — enrollment + usage metering
import { Infi } from "@beinfi/sdk";
const infi = new Infi({ secretKey: process.env.INFI_SECRET_KEY! });
// yourUserId comes from YOUR auth (e.g. Supabase)
const enrollment = await infi.products.enroll(productId, {
externalId: yourUserId,
email: userEmail,
});
await infi.track({
customerId: enrollment.id,
productId, // required once the tenant has more than one product
meter: "tokens",
value: "1200",
});To charge, send a payment link. To know they paid,
polling in sandbox — registering a webhook answers 503
with a test key.
MCP tools
A reference for what the MCP server exposes. Point your MCP client at it like this:
{
"mcpServers": {
"infi": { "command": "npx", "args": ["-y", "@beinfi/mcp"] }
}
}| Tool | What for |
|---|---|
onboarding_start_v1 | Asks for missing details and requests the OTP in the conversation |
onboarding_verify_v1 | Confirms the code and returns an owned account |
infi_doctor | Setup health (JSON + fix commands) |
infi_go_live_status | Guidance for claim → KYC → sk_live_ |
infi_sync_plan / infi_sync_apply | Dry-run / apply of the company file |
infi_set_app_url | Updates the app's origins |
infi_pull | Backend → infi.company.ts |