Send your Stripe payment events to SourceTrack by webhook, and see which channel, campaign and landing page brought each paying customer.
This is a webhook adapter you set up yourself in the Stripe Dashboard. It is not a Stripe marketplace app. Stripe signs every event, and SourceTrack checks that signature before it records anything.
What SourceTrack records
- Checkout purchases: a purchase when a Checkout Session completes and is paid (
checkout.session.completed). For delayed payment methods such as ACH, SEPA debit or Klarna, the purchase is recorded when the payment settles (checkout.session.async_payment_succeeded). - Subscription invoices: the first paid invoice of a subscription as a new subscription, and later paid invoices (renewals, plan changes) as renewals (
invoice.paid). - Trials, failed payments and cancellations: a trial start, a failed invoice payment and a cancelled subscription, from the
customer.subscription.*andinvoice.payment_failedevents. - Refunds: a refund as a negative amount against the original sale, so revenue by source is net of refunds (
refund.created). - Lost disputes: a chargeback that closes as lost is taken off the original sale (
charge.dispute.closed). - The amount and currency Stripe reports. Where Stripe reports the tax on a Checkout Session or invoice, the amount is recorded before tax.
What SourceTrack does not do
- It does not record Stripe test-mode events, including Stripe’s “Send test webhook”. Stripe still sees a 200 OK, but nothing is recorded as revenue.
- It does not record Payment Intents that are not part of a Checkout Session.
payment_intent.succeededis ignored. Use the Offline Conversions API for those sales. - It does not read custom metadata keys such as
metadata.st_aid. Useclient_reference_id,metadata.anonymous_idormetadata.visitor_id. - It does not invent a source. A sale with no visitor id that cannot be matched is recorded as unattributed, not credited to a channel.
- It does not receive card numbers. Stripe’s webhook events do not contain them.
Step-by-step setup
Step 1: Pass the visitor id to Stripe
The SourceTrack tracker gives each visitor an anonymous id, stored in the browser as st_aid.
- Checkout Sessions created by your backend: read
st_aidfrom the browser request and pass it asclient_reference_id, or asmetadata.anonymous_id, when you create the session. - Payment Links (
buy.stripe.com): put the SourceTrack tracker on the page that holds the link. On the standard install, the tracker addsclient_reference_idto the link when the visitor clicks it, if tracking is allowed for that visitor. A link that already has its ownclient_reference_idis left as it is, and the cookieless install does not add it.
Step 2: Add the webhook endpoint in Stripe
- In your Stripe Dashboard, go to Developers → Webhooks and add an endpoint.
- Set the endpoint URL to
https://api.srctk.com/api/webhooks/stripe/YOUR_SITE_KEY, replacingYOUR_SITE_KEYwith your site key (shown in the app under Setup → Install). - Select at least these events:
checkout.session.completedcheckout.session.async_payment_succeeded(needed if you accept delayed payment methods)refund.createdinvoice.paid, if you sell subscriptionscustomer.subscription.created,customer.subscription.updated,customer.subscription.deletedandinvoice.payment_failed, if you want trials, failed payments and cancellations
Step 3: Save the signing secret in SourceTrack
Copy the endpoint’s signing secret (it starts with whsec_) and paste it into SourceTrack under Integrations → Stripe webhook recipe. Without it, every event is refused with a 400 error.
How it works under the hood
Stripe sends each event to your site’s endpoint. SourceTrack checks the signature with the secret you saved, then ignores test-mode events and event types it does not handle.
For a Checkout purchase, SourceTrack looks for the visitor id in client_reference_id, metadata.anonymous_id or metadata.visitor_id. If none is there, it can match the buyer’s email to a visitor who already gave that email on your site. For a subscription Checkout, the money is recorded once, on the subscription’s paid invoice (invoice.paid), not a second time on the Checkout Session.
A renewal invoice carries no visitor id. SourceTrack credits it to the visitor the same Stripe customer’s original checkout was matched to on your site. With no such match, the renewal is recorded as unattributed.
A refund is matched to its original payment and inherits that sale’s visitor, so it nets against the same source. If Stripe delivers the same event twice, it is recorded once.
Sending sales to ad platforms (beta)
On a paid plan with Meta, Google Ads or another ad platform connected, a verified Stripe sale can also be sent server-side to those platforms. This is in beta. For a Checkout purchase sent to Meta, the buyer’s email, phone and address from Stripe are hashed and sent with it; SourceTrack does not store them for this. Failed payments and cancellations are never sent.
Test it end to end
- Visit your site through a link with UTM tags, for example
?utm_source=test&utm_medium=email&utm_campaign=stripe-check. - Make a real, low-value live purchase through your own checkout. Test-mode payments are not recorded.
- In the Stripe Dashboard, open the webhook endpoint and check that the event was answered with 200 OK.
- In SourceTrack, check that the purchase appears with the test source.
- Refund the purchase in Stripe and check that the refund nets it out.
Common problems and fixes
- Nothing appears after a test payment. Test-mode events are ignored by design. Use a real, low-value live purchase.
- ACH, SEPA or Klarna sales are missing. Subscribe to
checkout.session.async_payment_succeeded. Those sessions complete unpaid first, and revenue is recorded only when the payment settles. - Stripe shows 400 errors. The signing secret is missing or does not match this endpoint. Copy it again from the endpoint and save it in SourceTrack.
- Sales show as unattributed. The visitor id was not passed. Check
client_reference_idormetadata.anonymous_idon the Checkout Session, and check that the tracker runs on the page before checkout.
Related guides
Frequently Asked Questions
Does SourceTrack see my customers’ card details?
No. Stripe’s webhook events do not contain card numbers, and SourceTrack does not ask for them.
What if customers pay on a hosted Stripe Checkout page?
That works, as long as your backend passes the visitor id into the Checkout Session (Step 1). SourceTrack does not add it to a Checkout Session for you. For Payment Links, the standard tracker adds it when the visitor clicks the link.
How are recurring subscription payments attributed?
Each paid renewal invoice is credited to the visitor that customer’s original checkout was matched to on your site. If the original checkout was not matched, the renewal is recorded as unattributed.
Is this the same as how I pay for SourceTrack?
No. This webhook records your own customers’ purchases. It has nothing to do with your SourceTrack subscription.