Metrivo
Docs/Stripe Integration

Stripe Integration Setup

Connect Stripe to Metrivo using secure webhooks. By receiving successful charge signals, Metrivo matches transactions to acquisition sessions and campaigns to calculate marketing ROI.

Read-Only & Secure

Metrivo never accesses your Stripe balance, initiates transfers, or holds client credentials. Our integration works entirely by listening to signed, inbound webhook notifications verifying payment success.

How the integration works

When a payment occurs, Stripe fires a webhook to Metrivo. The attribution engine processes this event and matches it to a user visit by checking the checkout metadata or customer details.

For high-confidence session-level attribution, you must pass the Metrivo tracking identifiers to Stripe when creating Checkout Sessions or Payment Intents. If no metadata is present, Metrivo falls back to matching by the customer's email hash.

Setup steps

1

Generate your Metrivo webhook URL

Go to Data Connections in your Metrivo dashboard, select Stripe, enter a temporary/mode selection, and generate your endpoint URL. It will look like: https://metrivo.co/api/integrations/stripe/webhook/<YOUR_INTEGRATION_ID>.

2

Add Webhook Endpoint in Stripe

Log into your Stripe Dashboard and go to Developers → Webhooks → Add Endpoint. Paste your Metrivo webhook URL.

3

Select Stripe Events to Listen For

Configure the endpoint to listen for checkout.session.completed and invoice.paid. Add the endpoint and copy the signing secret (starts with whsec_).

4

Save Webhook Secret in Metrivo

Return to the Metrivo Data Connections page and paste your whsec_ signing secret. Metrivo uses this secret to verify all incoming webhook signatures.

5

Verify signed webhook delivery

Trigger a test charge in Stripe. Metrivo will receive the webhook, cryptographically verify its signature using your saved secret, and mark the integration active.

1. Configure Webhooks in Stripe

Create a webhook in the Stripe Developer Dashboard to notify Metrivo of billing updates.

  1. Open the Stripe Webhooks Dashboard.
  2. Click Add endpoint.
  3. Set the Endpoint URL to:
    https://metrivo.co/api/integrations/stripe/webhook/<YOUR_INTEGRATION_ID>
  4. Select the following events to listen to:
    • checkout.session.completed
    • invoice.paid
  5. Click Add endpoint.
  6. Locate and copy your Signing secret (e.g. whsec_...).

2. Configure Stripe in Metrivo

Save your Stripe webhook signing secret in your Metrivo Settings:

  • Navigate to your dashboard Settings > Payment Integrations.
  • Under Stripe, enter your whsec_... webhook signing secret.
  • Click Save changes.

Passing Tracking IDs (High-Confidence Match)

Retrieve the current attribution metadata from the browser using the Metrivo tracker, send it to your backend, then attach it as Stripe `metadata`. You can also set `client_reference_id` to `metadata.metrivo_session_id` for a second session hint:

// Client: send this object to your checkout endpoint const metadata = window.Metrivo.getAttributionMetadata(); // Server: initialize Stripe Checkout with that metadata stripe.checkout.sessions.create({ line_items: [{ price: "price_123", quantity: 1 }], mode: "subscription", success_url: "https://example.com/success", client_reference_id: metadata.metrivo_session_id, metadata, subscription_data: { metadata }, });

Attaching these properties enables high-confidence session-to-payment resolution on the backend. For recurring revenue, Metrivo checks `invoice.paid` metadata first, then subscription metadata, then customer metadata, and finally the Checkout Session for the subscription when a per-integration Stripe API key is available. If the metadata is missing, Metrivo records missing-data evidence and leaves the payment unattributed instead of guessing.

Supported Stripe Events

checkout.session.completed

Triggered when a customer completes a checkout session. Metrivo parses the customer email, maps metadata inputs, and attributes revenue.

invoice.paid

Triggered on successful subscription cycles. Metrivo uses invoice metadata, customer identity, and prior payment links to attempt a confidence-labeled match.

Using a different payment gateway?

Check out our other guides to link webhooks or connect custom payment gateways.