Connect Lemon Squeezy and every order, subscription renewal and refund reaches the program, credited to the partner whose link brought the customer.
Add a webhook
- Open the program, Setup, Billing, Lemon Squeezy. Lemon Squeezy asks you to type a signing secret, so Bolt Claw makes one and shows it once: copy it now, with the endpoint URL.
- In Lemon Squeezy: Settings, Webhooks, Add webhook. Paste the URL
and the signing secret, and select
order_created,order_refunded,subscription_payment_successandsubscription_payment_refunded.
Lost the secret? Make new ones replaces it; paste the new one into Lemon Squeezy straight away.
Pass the referral to checkout
Add the code to the checkout URL as custom data:
const url = new URL(checkoutUrl); // your Lemon Squeezy checkout link
url.searchParams.set("checkout[custom][boltclaw_ref]", BoltClawReferral.code() ?? "");
url.searchParams.set("checkout[custom][boltclaw_customer_id]", "acme-user-10442");
From the API, the same goes in checkout_data.custom. A subscription's first
payment is counted once, as its order; each renewal after it is a renewal.
Refunds
order_refunded and subscription_payment_refunded carry the running total
refunded, so a partial refund takes back that share. Lemon Squeezy has no
dispute event.
Discount codes
Lemon Squeezy sends no discount code at all, so a sale made with a code alone cannot be credited. Use partner links, or pass the referral at checkout as above.
Test mode
Lemon Squeezy says whether each event is from test mode; a test order is recorded as test data.
Check it works
On the program's Setup tab, the Billing row of the setup status turns
Connected with the first verified event, and says when a delivery was refused
(nearly always the wrong secret). Then press Send a test sale to see a
click, a signup, a sale and a refund go through your rules with test data, or
make a real test purchase in Lemon Squeezy's test mode. See Connect your billing system
for the whole setup status and what test data never does.