Skip to main content
The Stripe integration connects your Stripe account to DATALYR for complete payment attribution, subscription tracking, and MRR (Monthly Recurring Revenue) analysis.

What Gets Synced

Payments:
  • Payment intent ID, amount, currency
  • Customer email, customer ID
  • Payment method, status
  • Created date, payment timestamp
Subscriptions:
  • Subscription ID, status, plan
  • MRR (monthly recurring revenue)
  • Customer email, customer ID
  • Start date, current period, billing interval
  • Subscription items and prices
Customers:
  • Customer ID, email, name, phone
  • Created date
  • Total lifetime value
Events Tracked:
  • payment_intent.succeeded - Payment completed
  • invoice.payment_succeeded - Subscription payment
  • checkout.session.completed - Checkout completed
  • customer.subscription.created - New subscription
  • customer.subscription.updated - Subscription changed
  • customer.subscription.deleted - Subscription cancelled
  • customer.created - New customer

Setup

1. Connect Stripe Account

  1. Navigate to Settings → Integrations in DATALYR
  2. Click “Connect” next to Stripe
  3. You’ll be redirected to Stripe authorization page
  4. Select your Stripe account
  5. Click “Connect” to authorize DATALYR
  6. Grant read permissions for:
    • Payments
    • Subscriptions
    • Customers
    • Events

2. Create Restricted API Key

  1. Go to Stripe Dashboard → API Keys
  2. Click “Create restricted key”
  3. Name: Enter “DATALYR”
  4. Permissions: Select Read for Events (left column only)
  5. Connect Permissions: Leave all as “None” (right column)
  6. Click “Create key”
  7. Copy the key (starts with rk_live_...)
  8. Paste into DATALYR connection modal
Important: Only grant Read access to Events. All payment and subscription data comes within the events stream.

3. Verify Integration

Test Payment:
  1. Create a test payment in Stripe (use test mode)
  2. Go to DATALYR Dashboard → Event Stream
  3. Verify payment_intent.succeeded event appears
  4. Check that customer email matches
Check Attribution:
  1. Click on the payment event in Event Stream
  2. Verify attribution data (source, medium, campaign)
  3. Confirm customer journey is linked

Payment Attribution

DATALYR attributes payments to marketing sources using email matching:

How It Works

Step 1: User Clicks Ad
User clicks Google ad
DATALYR captures: gclid=abc123, utm_source=google
Stores in visitor profile: anon_xyz789
Step 2: User Browses
User views pricing page, reads features
All events tracked with Google attribution
Step 3: User Signs Up
User enters email: [email protected]
Creates account on your site

DATALYR calls identify():
datalyr.identify('user_456', {
  email: '[email protected]'
});

Links: anon_xyz789 → user_456
Step 4: User Pays via Stripe
User completes payment in Stripe Checkout
Payment email: [email protected]
Amount: $99/month
Step 5: Payment Synced
DATALYR syncs payment via webhook or API
Searches for visitor with email: [email protected]
Finds visitor: anon_xyz789
Links payment to gclid: abc123 from Day 1
Step 6: Conversion Sent
DATALYR sends conversion to Google Ads
Includes: gclid=abc123, value=$99
Google attributes conversion to original ad
Result: Payment correctly attributed to Google ad, even if it happened days after the click.

Email Matching

Requirements:
  • Stripe customer email must match visitor email
  • Visitor must be tracked before payment (via tracking script)
  • Payment must be within attribution window (default 30 days)
Best Practice: Call identify() immediately after user signup:
// After user creates account
datalyr.identify(user.id, {
  email: user.email,
  name: user.name
});
This ensures email is linked to visitor profile before Stripe payment.

Subscription Tracking

DATALYR tracks subscription lifecycle and calculates MRR automatically.

MRR Calculation

Monthly Subscriptions:
Price: $99/month
Quantity: 1
MRR = $99
Annual Subscriptions:
Price: $999/year
Normalized to monthly: $999 / 12 = $83.25
MRR = $83.25
Weekly Subscriptions:
Price: $25/week
Normalized to monthly: $25 × 4.33 = $108.25
MRR = $108.25
Multiple Items:
Item 1: $49/month × 1 = $49
Item 2: $29/month × 2 = $58
Total MRR = $107

Subscription Events

customer.subscription.created: Fired when new subscription starts.
{
  "event_name": "customer.subscription.created",
  "value": 99.00,
  "subscription": {
    "id": "sub_abc123",
    "status": "active",
    "customer": "cus_xyz789",
    "mrr": 99.00,
    "interval": "month"
  },
  "customer_email": "[email protected]",
  "attribution": {
    "utm_source": "google",
    "gclid": "abc123"
  }
}
customer.subscription.updated: Fired when subscription changes (upgrade, downgrade, plan change). customer.subscription.deleted: Fired when subscription cancels.
{
  "event_name": "customer.subscription.deleted",
  "value": -99.00,
  "subscription": {
    "id": "sub_abc123",
    "status": "canceled",
    "customer": "cus_xyz789",
    "mrr": -99.00
  }
}
Note: Cancelled subscriptions show negative MRR for tracking churn.

MRR Dashboard

DATALYR Dashboard shows:
  • Total MRR (monthly recurring revenue)
  • ARR (annual recurring revenue = MRR × 12)
  • New MRR (from new subscriptions)
  • Churned MRR (from cancellations)
  • Net MRR growth
  • MRR by source/medium/campaign
Filter by:
  • Date range
  • Acquisition source
  • Plan/product
  • Customer segment

Payment Events

payment_intent.succeeded

Fired when one-time payment completes. Use Cases:
  • Course purchases
  • One-time product sales
  • Consultation bookings
  • Donation payments
Deduplication: DATALYR automatically deduplicates to prevent double-counting:
  • If checkout.session.completed has payment_intent, only payment_intent.succeeded is counted
  • This prevents same purchase from appearing twice

invoice.payment_succeeded

Fired when subscription renewal payment succeeds. Use Cases:
  • Monthly subscription renewals
  • Annual subscription renewals
  • Usage-based billing

checkout.session.completed

Fired when Stripe Checkout session completes. Use Cases:
  • Checkout page conversions
  • Embedded checkout tracking
Note: Only counted if no payment_intent exists (to avoid double-counting with payment_intent.succeeded).

Customer Journey

DATALYR links Stripe customers to their complete journey from first touch to payment.

Journey Example

Day 1: First Visit
User clicks Facebook ad
DATALYR tracks:
  - anonymous_id: anon_abc123
  - fbclid: IwAR123
  - utm_source: facebook
  - Event: page_view (pricing page)
Day 1: Reads Content
User reads features, watches demo video
DATALYR tracks:
  - anonymous_id: anon_abc123 (same)
  - Events: video_played, button_clicked
  - Attribution preserved: facebook / cpc
Day 3: Returns and Signs Up
User returns via Google search
Creates account: [email protected]

DATALYR calls:
datalyr.identify('user_456', {
  email: '[email protected]'
});

Links: anon_abc123 → user_456
Day 7: Subscribes
User starts $99/month subscription via Stripe
Payment email: [email protected]
Day 7: Payment Synced
DATALYR syncs payment:
  - Matches email to user_456
  - Links to original anon_abc123
  - Attributes to fbclid from Day 1
  - Creates payment_intent.succeeded event
  - Sends conversion to Meta with fbclid
Result in Dashboard:
  • First touch: Facebook ad (Day 1)
  • Last touch: Google organic (Day 3)
  • Conversion: $99/month subscription
  • Attribution: Facebook (first-touch) or Google (last-touch)

Advanced Features

Baseline MRR Snapshot

On initial sync, DATALYR fetches ALL active subscriptions to establish MRR baseline: What’s Captured:
  • All active subscriptions (unlimited history)
  • Current MRR per subscription
  • Subscription start dates
  • Customer attribution
Why It Matters:
  • Accurate MRR reporting from day one
  • Historical MRR trends
  • Proper churn calculations
Frequency:
  • Initial sync: Full snapshot
  • Subsequent syncs: Incremental (new/updated subscriptions only)

Deduplication Logic

DATALYR prevents double-counting revenue: Scenario 1: Checkout + Payment Intent
User completes Stripe Checkout
→ checkout.session.completed fires
→ payment_intent.succeeded fires

DATALYR only counts payment_intent.succeeded
Result: $99 revenue (not $198)
Scenario 2: Invoice + Payment Intent
Subscription renewal
→ invoice.payment_succeeded fires

DATALYR counts invoice payment
Result: $99 MRR renewal tracked

Multi-Currency Support

DATALYR handles payments in any currency:
  • Payments synced in original currency
  • Dashboard shows currency breakdown
  • Conversions sent to ad platforms in original currency
  • Optional currency conversion for unified reporting

Test Mode Support

DATALYR syncs both live and test mode payments:
  • Live payments: Production revenue
  • Test payments: For testing integration
  • Filter by mode in dashboard
Best Practice: Use test mode to verify integration before going live.

Troubleshooting

Payments Not Appearing

Check:
  1. Integration is connected and active (Settings → Integrations)
  2. Stripe connection has valid API keys
  3. Payment is in live mode (not test mode, unless testing)
  4. Payment is within sync window (last 30 days for initial sync)
Test:
  • Create test payment in Stripe test mode
  • Check Event Stream within 1 minute (if webhook configured)
  • Or wait up to 15 minutes (for API sync)

Payments Not Attributed

Verify:
  1. Customer email in Stripe matches visitor email
  2. User was identified via identify() before payment
  3. Visitor was tracked before payment (check Event Stream)
  4. Attribution window not exceeded (default 30 days)
Fix: Call identify() immediately after signup:
datalyr.identify(user.id, {
  email: user.email
});

MRR Showing Incorrect

Common Issues:
  1. Multiple currencies: Filter by currency or enable conversion
  2. Test mode payments: Filter out test mode
  3. Cancelled subscriptions: Check if showing as negative MRR
Verify:
  • Check subscription status in Stripe Dashboard
  • Confirm DATALYR shows same subscriptions
  • Compare MRR totals

Duplicate Payments

Causes:
  • Webhook and API sync both creating events
  • Stripe sending duplicate webhooks
Prevention:
  • DATALYR automatically deduplicates by event ID
  • Same payment_intent will never create duplicate events
  • If seeing duplicates, contact support with event ID

Data Privacy

Customer Data:
  • Customer emails hashed before sending to ad platforms (SHA-256)
  • GDPR compliant hashing
  • No plaintext PII sent to Meta/Google/TikTok
Data Retention:
  • Payments retained indefinitely for reporting
  • Subscriptions retained for MRR tracking
  • Customers retained for attribution
GDPR Compliance:
  • Opt-out respected across all platforms
  • No data synced for opted-out users
  • Data deletion on request

Next Steps

Need Help?

Questions about Stripe integration? Check our troubleshooting guide or contact support.