Lemon Squeezy
Attribute a paid Lemon Squeezy order using signed webhooks and checkout custom data — no backend SDK needed.
- A Lemon Squeezy store with at least one product and variant.
- Lemon Squeezy test mode enabled for sandbox testing.
Webhook events
| Event | What it signals | Growth Rail action |
|---|---|---|
order_created | A 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.
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.
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.
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.
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);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.
| Outcome | Meaning |
|---|---|
| Completed | Purchase proof and SDK attribution token matched. The referral reward has been triggered. |
| Awaiting attribution | The 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. |
| Ignored | The event was verified but no matching attribution claim exists and the hold window has expired, or the event type is out of scope. |
- 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.