EarnedStats Docs

Revenue

Polar

Orders and refunds, plus an import of past orders.

1. Add the webhook

In Polar, Settings, Webhooks, add this endpoint with format Raw and subscribe to order.paid and order.refunded:

Endpoint
https://earnedstats.com/api/webhooks/polar/YOUR_SITE_ID

2. Paste the secret

Copy the webhook secret into Settings, Revenue, Polar.

3. The visitor id

Polar checkout links on your pages are tagged by the script as reference_id. For checkouts you create in code, set metadata.reference_id to the visitor id.

Tip

Set the success URL to a page on your site with ?checkout_id={CHECKOUT_ID} so a visit to it links the order to the exact visitor.

Import past orders

Create an organization access token with the orders:read scope and paste it in Settings. Older orders are imported right away, and any the webhook missed are picked up once a day.