LinkTrace docs
Stripe: attribute Checkout, then ingest paid webhooks
Stripe sales tracking has two parts: preserve attribution when you create Checkout, then deliver Stripe paid events back into LinkTrace.
Attach attribution to Checkout
Create Checkout Sessions on your backend and include click attribution in metadata.
ts
import { withStripeCheckoutAttribution } from "@finndean/linktrace-node"
const session = await stripe.checkout.sessions.create(
withStripeCheckoutAttribution(
{
mode: "payment",
line_items: [{ price: process.env.STRIPE_PRICE_ID!, quantity: 1 }],
success_url: "https://your-site.com/success",
cancel_url: "https://your-site.com/cancel",
},
{
clickId,
customerId: user.id,
email: user.email,
eventName: "purchase",
},
),
)Local webhook testing
Use Stripe CLI locally. Forward webhooks into the LinkTrace Stripe provider endpoint shown in the dashboard.
bash
stripe listen \
--events checkout.session.completed,invoice.paid \
--forward-to 'http://127.0.0.1:3001/api/v1/integrations/stripe/<webhook-token>/webhooks'Production setup
In production, create a real Stripe webhook endpoint in Stripe Dashboard and point it at the LinkTrace webhook URL for the workspace.
- Subscribe to
checkout.session.completedandinvoice.paid. - Copy the Stripe signing secret back into LinkTrace provider settings.
- Keep the webhook URL in LinkTrace stable per workspace and Stripe account label.
Related guides