LinkTrace docs
Polar: preserve attribution at checkout, then verify paid orders
LinkTrace can ingest Polar order-paid events as sales. Your app should still attach click attribution when you create the Polar checkout.
Attach metadata to Polar checkout
Use the SDK helper when creating your Polar checkout session or payment link payload.
ts
import { withPolarCheckoutAttribution } from "@finndean/linktrace-node"
const payload = withPolarCheckoutAttribution(
{
productPriceId: process.env.POLAR_PRICE_ID!,
successUrl: "https://your-site.com/success",
},
{
clickId,
customerId: user.id,
email: user.email,
eventName: "purchase",
},
)Webhook ingestion
Polar sales enter LinkTrace through the provider webhook endpoint configured in the dashboard.
- Create a Polar webhook endpoint that points to the LinkTrace Polar webhook URL for your workspace.
- Copy the Polar webhook secret into LinkTrace provider settings.
- Verify that paid orders carry the same customer and attribution metadata you set during checkout creation.
Local testing
For local verification, send a signed Polar webhook payload to the local LinkTrace endpoint instead of waiting on a full end-to-end checkout flow.
bash
curl -X POST 'http://127.0.0.1:3001/api/v1/integrations/polar/<webhook-token>/webhooks' \
-H 'Content-Type: application/json' \
-H 'Polar-Signature: <signed-payload>' \
-d '{...}'Related guides