GrowthRailDocs
Prerequisites
  • A Lemon Squeezy store with at least one product and variant.
  • Lemon Squeezy test mode enabled for sandbox testing.

Webhook events

EventWhat it signalsGrowth Rail action
order_createdA customer completed checkout; Lemon Squeezy confirmed payment.Record purchase proof; join to pending SDK attribution claim.

How attribution works

A verified provider event proves the purchase happened — but not that the user was referred. Growth Rail completes a referral only when that event joins to the opaque attribution claim previously captured by the SDK on the referring user's device.

Identity rule: Growth Rail joins events to claims using stable IDs and opaque tokens. It never correlates users by email, name, phone number, or billing address.
1

Create the Growth Rail connection

Open Dashboard → Integrations → Purchases, choose Lemon Squeezy, and create a Sandbox or Production connection. Copy the generated webhook endpoint URL — you will paste it into Lemon Squeezy in the next step.

2

Register the webhook in Lemon Squeezy

In Lemon Squeezy → Settings → Webhooks, add the copied endpoint and subscribe to order_created.

Return to Growth Rail and save the Webhook signing secret used for X-Signature. Growth Rail encrypts and stores it — the raw value is never returned by the API after saving.

Security: Never commit webhook secrets to source control or log them. If a secret is compromised, rotate it in both Lemon Squeezy and Growth Rail immediately.
3

Pass attribution data from your app

Set gr_attribution to the opaque SDK token and gr_user_id to your stable user ID in checkout custom data. Lemon Squeezy returns these values under meta.custom_data.

ts
const checkoutUrl = new URL(yourLemonSqueezyCheckoutUrl);
const attribution = GrowthRail.getAttributionToken();

if (attribution) {
  checkoutUrl.searchParams.set(
    'checkout[custom][gr_attribution]',
    attribution,
  );
  checkoutUrl.searchParams.set(
    'checkout[custom][gr_user_id]',
    currentUser.id,
  );
}

window.location.assign(checkoutUrl);
4

Verify end-to-end in test mode

Use Lemon Squeezy test mode to complete an order, then confirm order_created appears as a verified Growth Rail delivery.

OutcomeMeaning
CompletedPurchase proof and SDK attribution token matched. The referral reward has been triggered.
Awaiting attributionThe webhook signature was valid, but the SDK claim has not arrived yet — or the stable user ID did not match a pending claim. The event is held; Growth Rail completes the referral when the claim arrives.
IgnoredThe event was verified but no matching attribution claim exists and the hold window has expired, or the event type is out of scope.
Provider-specific notes
  • Growth Rail counts order_created once per order and ignores renewal-only events in this integration.
  • Guest checkout must include gr_attribution. Growth Rail never falls back to the purchaser email.
  • Refund and chargeback events do not automatically reverse issued rewards in the current version.