Polar affiliate tracking with Refficks
Polar sends every paid order, refund and subscription change to Refficks, signed with your webhook endpoint's secret.
What it gives you
- Every paid order in Polar (one-time purchases, a subscription's first payment and each renewal) is credited to the partner whose link brought the buyer, or whose code they used.
- A refund takes the commission's share back, including one Polar makes to head off a chargeback.
- Polar signs every delivery, so a commission can approve itself on a plan that does.
What it does not
- Commission is worked out on each payment after discounts and before tax, however it was paid, and before Polar's fee.
- Polar sends no word of a chargeback it did not head off with a refund. The commission on a sale lost to one stays until you reverse it on the Commissions page.
- A partner's code works only if the same discount exists in Polar. Refficks cannot make it for you.
- A Checkout Link whose own metadata in Polar sets reference_id keeps yours, so a buyer through it is credited by their email or a code, not by their link.
- A checkout your server creates carries the visitor only with the line in step 4.
- A buyer is matched by the email they paid with. One who paid with another email than your site knows is credited by their link or a code.
Steps
1. Connect Polar
Choose whether this connection is for your Polar organization or your sandbox one, then press Connect below to get your address. A sandbox connection shows what each payment would have credited, and credits nothing.
In Polar, open Settings › Webhooks and press Add Endpoint. Paste the address, keep the format Raw, and tick these events: customer.created, customer.updated, order.paid, subscription.created, subscription.updated, subscription.active, subscription.canceled, subscription.uncanceled, subscription.revoked, subscription.past_due, refund.created, refund.updated. Save the endpoint.
Then press Copy Secret on the endpoint (it begins whsec_), paste it below and save. Until it is saved, every delivery is refused.
2. Put the Refficks script on your site
Paste the snippet on every page of your website, including the pages with your Polar Checkout Links.
3. Link to Polar Checkout Links
Press "I sell with Polar" on this page, and the script adds who the visitor is to every link to buy.polar.sh as reference_id. Polar keeps it on the order and on every renewal, so the partner whose link brought the buyer is credited for each one. Nothing to paste.
Leave reference_id out of the link's own metadata in Polar: if you set one there, Polar keeps yours and the visitor is lost. A reference_id you add to a link yourself is left as you wrote it.
4. Or, for checkouts your server creates
If your server creates checkouts through Polar's API, ask the Refficks script who the visitor is in the browser, send it with the request, and put it in the checkout's metadata as below. Polar copies it to the order and the subscription.
5. Give partners codes in Polar
A partner's code works when the same discount exists in Polar (Products › Discounts), with the partner's code as its code: letters and numbers only. Polar names the discount's code on every order that used it, so codes made before you connected work too.
6. Make a test purchase
With a sandbox connection, open your site through any partner's link, copied from their page under Partners, follow a link to a sandbox Checkout Link and buy with Stripe's test card, 4242 4242 4242 4242. It arrives here as a test, saying what it would have credited.
Sources
Have an account? Open this guide in Refficks for your own script and the checks that show when it is working. New to Refficks? Create an account.