Stripe
Connect Stripe so Bantico can attribute completed payments back to the tracked link, campaign, source, medium, content, and lead that drove the customer.
The strongest Stripe attribution comes from passing Bantico context directly into Stripe Checkout metadata. That means sending fields like linkId, campaignId, source, medium, content, and leadId.
How to connect Stripe
Here's the quickest way to connect Stripe to Bantico.
- Open Stripe API keys.
- Create a restricted key for Bantico.
- Name it something like
Bantico. - Add
https://app.bantico.comas the allowed domain if Stripe asks for one. - Copy the generated key.
- Open your Bantico project settings.
- Go to Integrations.
- Click Connect for Stripe.
- Paste the restricted key.
- Save the integration.
After that, Bantico can start using Stripe payment outcomes in your attribution reporting.
Consent-gated loading
Bantico uses visitor and session cookies to persist attribution on the same site. If you need consent-first behavior for EU users, only load Bantico after consent is granted.
data-persist flag in the current Bantico loader. Use the normal Bantico script and gate when you load it.<script> window.BANTICO_TOKEN = "YOUR_TOKEN";</script><script src="https://app.bantico.com/bantico.js"></script>How attribution works
When a Stripe payment arrives, Bantico tries to resolve attribution using the strongest available context.
- Stripe Checkout metadata
- Tracked-link and campaign context already present on the session
- Identified user data such as email, if available
The most reliable setup is always sending Bantico context directly into Stripe metadata when you create the checkout session.
Stripe Checkout metadata
When creating a Stripe Checkout session on your server, pass Bantico attribution context into metadata.
import Stripe from "stripe"; const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!); export async function POST(request: Request) { const { priceId, bantico } = await request.json(); const session = await stripe.checkout.sessions.create({ mode: "payment", line_items: [{ price: priceId, quantity: 1 }], success_url: "https://yourapp.com/success", cancel_url: "https://yourapp.com/pricing", metadata: { linkId: bantico?.linkId || "", campaignId: bantico?.campaignId || "", source: bantico?.source || "", medium: bantico?.medium || "", content: bantico?.content || "", leadId: bantico?.leadId || "", }, }); return Response.json({ url: session.url });}These metadata fields should match the same Bantico context you use in tracked links and events: linkId, campaignId, source, medium, content, and leadId.
Email fallback with identify
If a checkout is missing full link metadata, Bantico can still use identified user data as fallback context.
Call bantico.identify() when the user signs in or becomes known:
bantico.identify({ id: "user_123", email: "jane@example.com", name: "Jane Smith",});Direct Stripe metadata is still the preferred setup. Identify-based fallback is helpful, but it should not replace proper checkout metadata.
Learn more about identifying users.
Troubleshooting
If Stripe payments are showing up but attribution looks wrong, check the following:
- You pass Bantico metadata when creating the checkout session.
- The metadata values match the same tracked link, campaign, source, medium, content, and lead context used elsewhere in Bantico.
- Stripe is connected in your Bantico project settings.
- If you use consent-gated loading, Bantico only loads after consent.
- Your checkout flow actually sends the metadata to Stripe on the server.
If everything looks correct and attribution is still off, contact support with an example checkout or payment so it's easier to debug.