Skip to content
Payment providers

Stripe Elements and PaymentIntent analytics

2 min read · Updated · By the Reveata team

Short answerWhen your server creates a Stripe PaymentIntent for Elements, the Payment Element or a mobile app, put reveata_visitor_id and reveata_session_id in its metadata. Reveata reads them when payment_intent.succeeded arrives and credits the payment to that visit.

With Stripe Elements (opens in a new tab) the checkout lives on your own page: your server creates a PaymentIntent and the browser or app confirms it. Reveata follows the PaymentIntent, so that is where the visitor id goes.

What you get

  • One-off payments from Elements, the Payment Element, Express Checkout and Stripe's iOS, Android and React Native SDKs, credited to their visit.
  • Refunds and lost disputes booked against the original payment, as negative revenue on the day they happen, with the same source.
  • The buyer's email from the receipt email, the customer or the billing details, used as a fallback match.

How to pass the ids

  1. Connect Stripe (Stripe revenue analytics).
  2. Send window.reveata.metadata() from the page to the endpoint that creates the PaymentIntent, or read the _dt_v and _dt_s cookies on the server.
  3. Store them as metadata:
js
const intent = await stripe.paymentIntents.create({
  amount: 4900,
  currency: 'usd',
  metadata: {
    reveata_visitor_id: body.reveata_visitor_id,
    reveata_session_id: body.reveata_session_id,
  },
});

reveata_user_id, the id you pass to identify, works as a third key.

Mobile apps

A React Native or Expo app with the Reveata SDK has its own visitor id: send Reveata.metadata() to your server and put it in the PaymentIntent metadata, as on the web. Apps without the SDK can still be linked by identifying the buyer with the same user id or email on your website, or by opening a web checkout page that runs the script.

How Reveata counts PaymentIntents

Case How it is counted
A succeeded PaymentIntent One payment, under its pi_… id
A PaymentIntent that pays an invoice Counted once, through the invoice
Webhook and scheduled import of the same intent Stored once per Stripe id

For subscriptions, put the ids on the first payment through Stripe Checkout or in the subscription's metadata, because the invoice is what counts.

Frequently asked questions

What happens to a PaymentIntent without metadata?

It still counts as revenue. Reveata then matches it by the buyer's email for visitors you identified, and keeps trying every hour for 90 days.

Do I need the session id?

No. The visitor id alone is enough to match. The session id pins the exact visit, which helps last-touch attribution.

How do I check it works?

Pay with a Stripe test card on a test website after opening it from a link ending in ?ref=test. The PaymentIntent's metadata in Stripe shows reveata_visitor_id, and Reveata lists the payment with the source test.

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?
IntegrationStripe revenue analytics by traffic sourceReveata reads your Stripe payments, invoices, subscriptions, refunds and lost disputes through a read-only connection, then credits each payment to the visit that brought the buyer, so revenue sits next to traffic in every report.IntegrationReact Native and Expo app analyticsThe @reveata/react-native package records screens as pages, queues events offline, and sends them to the same Reveata website as your site. A Platform filter separates app from web, and funnels can start on the website and finish in the app.IntegrationDodo Payments analytics with revenue by sourceReveata connects to Dodo Payments with an API key and a webhook you add in Dodo, imports payments, refunds, disputes and subscriptions, and credits each payment to a visit through reveata_visitor_id in the checkout or payment metadata.IntegrationPolar analytics with revenue attributionReveata imports Polar orders, refunds and subscriptions and receives new ones through a Polar webhook. Put the Reveata visitor id in the checkout metadata, which Polar copies onto orders and subscriptions, and each sale is credited to the visit that led to it.IntegrationRevenue attribution for custom billing with the Payments APIIf your provider is not one Reveata connects to, or you bill customers yourself, post each payment to the Reveata Payments API with a website key. Include the visitor id, a user id or an email, and the payment is attributed like any connected provider's.IntegrationStripe Checkout analytics and attributionAdd the Reveata visitor and session ids to the metadata of each Stripe Checkout Session your server creates. When Stripe reports the payment, Reveata reads the ids and credits the money to the exact visit that started the checkout.