Stripe integration

Sync paid invoices and subscription lifecycle events from Stripe into OnRamp to see revenue alongside your funnel data.


What gets synced

Stripe eventOnRamp event type
First paid invoice (subscription create)subscription_started
Renewal invoice paidsubscription_renewed
One-time paid invoicepayment
Subscription deleted / canceledsubscription_canceled
Refund issuedrefund (negative amount - nets out of the Revenue total)
invoice.payment_succeeded webhooksubscription_started, subscription_renewed or payment

Revenue amounts, currency, and Stripe price ID are stored with each event.

MRR is calculated separately from current subscription prices and quantities, normalized to a month and reduced by recurring discounts. A permanently free subscription contributes zero MRR. Final invoices, prorations, refunds and one-time coupons do not determine the recurring run-rate.

Active and past-due subscriptions count towards MRR. Trials, scheduled cancellations, canceled, paused and unpaid subscriptions, and metered charges are excluded. OnRamp refreshes this snapshot during each successful sync and verified webhook. Historical dates before the first snapshot retain their event-based estimates.


Connect

  1. Open Integrations, then Revenue, and select Stripe
  2. Paste your Stripe Secret key (sk_live_... or sk_test_... for testing)
  3. Choose an identity strategy (see below)
  4. Click Connect - OnRamp validates the key and starts the initial sync

OnRamp only needs read access. A Restricted key needs Customers, Invoices, Subscriptions and Coupons, plus Charges and Refunds for refund sync.


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:

javascript
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.

javascript
// 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():

javascript
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.

  1. In the Stripe dashboard, go to Developers → Webhooks → Add endpoint
  2. Set the URL to your OnRamp webhook endpoint (shown in Integrations after connecting)
  3. Select these events:
    • invoice.payment_succeeded
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
    • refund.created
  4. 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 the resources listed above.

No revenue appearing - verify the identity strategy matches how your app tracks users. Check the integration's last sync error in Integrations.

Duplicate events - OnRamp uses invoice IDs as deduplication keys in ClickHouse, so re-syncing the same invoices is safe.