LinkTrace docs

Lemon Squeezy: carry attribution into orders, then ingest paid events

Lemon Squeezy sales tracking in LinkTrace relies on signed webhook ingestion plus customer and click metadata attached at checkout creation time.

Attach attribution to Lemon Squeezy checkout

Use the SDK helper when generating the Lemon Squeezy checkout payload.

ts
import { withLemonSqueezyCheckoutAttribution } from "@finndean/linktrace-node"

const payload = withLemonSqueezyCheckoutAttribution(
  {
    checkout_data: {},
    product_options: {},
  },
  {
    clickId,
    customerId: user.id,
    email: user.email,
    eventName: "purchase",
  },
)

Webhook ingestion

Create a Lemon Squeezy webhook endpoint that points to the LinkTrace workspace webhook URL.

  • Copy the LinkTrace Lemon Squeezy webhook URL from the dashboard provider panel.
  • Set the Lemon Squeezy signing secret in LinkTrace provider settings.
  • Verify that your webhook payload includes the order, customer, and metadata fields you expect LinkTrace to use for attribution.

Local testing

For local validation, send a correctly signed Lemon Squeezy webhook payload directly into your local LinkTrace endpoint.

bash
curl -X POST 'http://127.0.0.1:3001/api/v1/integrations/lemonsqueezy/<webhook-token>/webhooks' \
  -H 'Content-Type: application/json' \
  -H 'X-Signature: <signed-payload>' \
  -d '{...}'
Related guides