What you’ll need
- A Stripe account with at least one product or price created
- Admin or developer access to create API keys
- The Trfyx tracker already installed on your website
Step-by-step setup
1
Create a restricted API key in Stripe
Go to your Stripe Dashboard → API Keys and click Create restricted key.Name it something like
Trfyx so you can identify it later.Permissions needed: You only need read access. The pre-filled link in the Trfyx setup form selects the right permissions automatically. If you’re creating the key manually, enable:- Checkout Sessions: Read
- Subscriptions: Read
2
Paste the key in Trfyx
In your Trfyx dashboard, open Integrations and select Stripe. Paste the restricted API key (it starts with
rk_live_).Click Connect.3
Trfyx creates the webhook automatically
You don’t need to set up the webhook manually. When you click Connect, Trfyx uses the Stripe API to create a webhook endpoint pointing to your site’s unique webhook URL.The webhook listens for these events:
checkout.session.completed— one-time purchases and initial subscription sign-upspayment_intent.succeeded— direct payment intentsinvoice.paid— subscription renewalscustomer.subscription.created— new subscriptionscustomer.subscription.updated— plan changes, trial endingscustomer.subscription.deleted— cancellationscharge.refunded— refundscharge.dispute.created— payment disputes openedcharge.dispute.closed— disputes resolved
4
Make a test purchase
If you have Stripe test mode enabled, create a test checkout. Within seconds, you should see the payment appear in Revenue → Overview.Check that:
- The amount is correct
- The match method shows (e.g., “explicit session” or “email fallback”)
- The source attribution looks right (if you visited from a campaign link)
Improving Stripe attribution quality
For the best possible attribution, pass the Trfyx visitor ID when you create the Stripe Checkout session. The tracker stores it in thedf_visitor_id cookie:
What Stripe data flows into Trfyx
Troubleshooting
Payments aren't showing up
Payments aren't showing up
- Check your Stripe webhook logs at Developers → Webhooks in the Stripe Dashboard
- Confirm the endpoint URL matches your Trfyx app URL
- Make sure the webhook isn’t disabled
- Verify your restricted key hasn’t been revoked
All payments show as 'unattributed'
All payments show as 'unattributed'
This usually means the visitor ID isn’t reaching Stripe, or visitors are blocking the tracker. Try:
- Passing the visitor ID when you create the checkout (see above)
- Setting up a proxy to avoid ad blockers
Duplicate payments appearing
Duplicate payments appearing
Trfyx deduplicates by Stripe event ID. If you’re seeing duplicates, you may have two webhook endpoints pointing to the same Trfyx site. Check Developers → Webhooks in Stripe and remove any extra endpoints.