LancelotDocs
Stripe

Connect revenue

Stripe

Connect Stripe with a read-only restricted key. Lancelot can't charge, refund or move money.

Create the key

  1. In Stripe, open Developers → API keys → Create restricted key (direct link).
  2. Set Read on these four, and leave everything else at None:
ResourceWhy
CustomersWho your customers are, and their IDs in metadata
SubscriptionsEach customer's plan and price
InvoicesWhat each customer actually paid
ProductsPlan names
  1. In Lancelot, open Settings → Integrations and paste the key. It starts with rk_live_ (or rk_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:

  1. metadata.customer_id
  2. metadata.user_id
  3. 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.