Connect revenue
Stripe
Connect Stripe with a read-only restricted key. Lancelot can't charge, refund or move money.
Create the key
- In Stripe, open Developers → API keys → Create restricted key (direct link).
- Set Read on these four, and leave everything else at None:
| Resource | Why |
|---|---|
| Customers | Who your customers are, and their IDs in metadata |
| Subscriptions | Each customer's plan and price |
| Invoices | What each customer actually paid |
| Products | Plan names |
- In Lancelot, open Settings → Integrations and paste the key. It starts with
rk_live_(orrk_test_in a test environment).
A full secret key (sk_live_) is refused: Lancelot only accepts restricted keys. The key is stored encrypted.
What happens next
- Lancelot checks the key can list customers, subscriptions and invoices.
- It imports the last 12 months of invoices.
- After that it syncs every night at 03:30 UTC. To sync sooner, call
POST /api/v1/stripe/sync, at most once every five minutes.
How customers are matched
Lancelot joins a Stripe customer to your usage by customer ID. For each Stripe customer it uses the first of:
metadata.customer_idmetadata.user_id- The Stripe customer ID (
cus_...)
If none of these match the ID your app sends, it falls back to email, but only when the email is unique on both sides. The simplest setup is to set metadata.customer_id to your own user or account ID when you create the Stripe customer. See Customer IDs.
Several products on one Stripe account
If one Stripe account bills more than one of your products, each Lancelot product can count only its own Stripe products' revenue. Choose them in Settings for each product.