Revenue

Polar

One webhook, two metadata keys, and Polar orders and subscriptions are tied to the traffic that produced them.

Updated All docs as one Markdown file

The webhook

Endpoint URL
https://geckostats.com/api/webhooks/polar/<website-id>

Add it in Polar with the payload format set to Raw, and paste the secret into the Connect payments step of the website. Events are verified with the Standard Webhooks signature.

Metadata on the checkout

Node
await polar.checkouts.create({ products, metadata: { ...existingMetadata, ...attribution }, successUrl: 'https://<your-domain>/thanks?checkout_id={CHECKOUT_ID}', });

Polar Checkout Links (buy.polar.sh) need no change: the script sets reference_id to ml_<visitor>__<session> when the link is clicked, unless your code already sets its own.