Stripe integration
Sync paid invoices and subscription lifecycle events from Stripe into OnRamp to see revenue alongside your funnel data.
What gets synced
| Stripe event | OnRamp event type |
|---|---|
| First paid invoice (subscription create) | subscription_started |
| Renewal invoice paid | subscription_renewed |
| Subscription deleted / canceled | subscription_canceled |
invoice.payment_succeeded webhook | subscription_started or subscription_renewed |
Revenue amounts, currency, and Stripe price ID are stored with each event.
Connect
- Go to Settings → Integrations → Add integration → Stripe
- Paste your Stripe Secret key (
sk_live_...orsk_test_...for testing) - Choose an identity strategy (see below)
- Click Connect - OnRamp validates the key and starts the initial sync
OnRamp only needs read access. Create a Restricted key in the Stripe dashboard with read permissions on Customers and Invoices if you prefer not to use your full secret key.
Identity strategies
OnRamp must match a Stripe customer to an OnRamp anonymous_id. Choose the strategy that fits your app:
Option A - anonymous_id via metadata (most reliable)
When creating or updating a Stripe customer, set:
await stripe.customers.update(customerId, {
metadata: { onramp_anonymous_id: onramp.anonymousId },
})
OnRamp checks this metadata field first. No event property configuration needed.
Option B - email match via identify()
Call OnRamp.identify() after the user signs in. OnRamp matches the email against the Stripe customer's email address.
// React / Next.js
const { identify } = useOnRamp()
identify({ email: user.email })
// React Native / Expo
OnRamp.identify({ email: user.email })
Select Identity strategy: email when connecting.
Option C - custom user ID via identify()
If your app uses its own user ID as the Stripe customer's metadata or description, pass it via identify():
identify({ userId: currentUser.id })
Select Identity strategy: property and set Identity property to userId.
Webhook (optional but recommended)
Configuring a Stripe webhook lets OnRamp capture cancellations and refunds in real time rather than waiting for the next 6-hour sync.
- In the Stripe dashboard, go to Developers → Webhooks → Add endpoint
- Set the URL to your OnRamp webhook endpoint (shown in Settings → Integrations after connecting)
- Select these events:
invoice.payment_succeededcustomer.subscription.deleted
- Copy the Signing secret and paste it into the integration settings in OnRamp
Initial sync
After connecting, OnRamp paginates through all paid invoices newest-first and stops at the last synced invoice on subsequent runs. Large Stripe accounts with many invoices may take a few minutes to fully backfill.
The sync cursor is stored per integration - reconnecting with a new key preserves your sync position.
Troubleshooting
"Credential validation failed" - check that the secret key is correct and not expired. Restricted keys need read access to Customers and Invoices.
No revenue appearing - verify the identity strategy matches how your app tracks users. Check the integration's last sync error in Settings → Integrations.
Duplicate events - OnRamp uses invoice IDs as deduplication keys in ClickHouse, so re-syncing the same invoices is safe.
