What the Polar integration can and can’t do
Before you start
You’ll need:- Admin access to your Polar organization, so you can create an access token and a webhook.
- The ability to add code to your website, or someone who can.
- Your Referly guide open. In Referly, open your program, go to Settings, then Integrations, and pick the card matching how you sell: Polar Payment Links, Polar Embedded Checkout, or Polar Checkout API. Your webhook address is shown there, filled in with your program’s details.
Step 1: Install the tracking script on your site
The tracking script recognises visitors who arrived from an affiliate link, records the click, and remembers who referred them until they buy. Copy the snippet from Step 1 of your Polar guide in Referly — it comes pre-filled with your program ID — and paste it inside thehead section of your website, on every page.
Step 2: Create an access token in Polar
Open your token settings
Name it and set no expiration
Select the scopes
discounts:readdiscounts:writeevents:readsubscriptions:readcustomers:readcustomers:writeorders:readrefunds:readwebhooks:readwebhooks:write
Copy the token
polar_pat_. Keep it somewhere safe; anyone with it can act on your Polar organization.Step 3: Connect Polar in Referly
Find your organization ID
Open the integrations dialog
Fill in both fields
Connect
Step 4: Send the referral into Polar
Pick the tab that matches how your customers buy. In each case the snippet goes near the bottom of the page, just before the closingbody tag, on the pages where checkout starts — and the tracking script from Step 1 has to be on the same page.
- Payment links
- Embedded checkout
- Checkout API
Step 5: Add the Referly webhook in Polar
This is how Polar tells Referly that an order was placed, paid, or refunded. Without it, nothing reaches Referly at all.Open webhook settings
Paste the webhook address
Referly Integration, or anything you’ll recognise later.Set the format to Raw
Choose the events
order.createdorder.paidorder.refunded
Create it
How Referly decides who gets credit
When an order arrives, Referly checks two things, in this order:The discount code on the order
The referral in the order's details
Letting affiliates use discount codes
Referly can create and manage Polar discount codes for you, so affiliates can promote a code instead of a link. Set this up on the Coupons page — see Connect a coupon source and Create coupons.Step 6: Test it end to end
Visit your site through an affiliate link
Check the click landed
Start checkout and check the link
Complete the order
Check the order in Polar
Check the result in Referly
Clean up
Checking that renewals are credited
Polar copies the referral onto the subscription as well as the first order, so renewals normally arrive carrying it. It’s worth confirming once: after your first subscriber’s first renewal, open that renewal order in Polar and check the metadata is still there, then check the renewal produced a second sale in Referly. If it didn’t, you can set the metadata on the subscription in Polar so future renewals carry it.Refunds
When an order is refunded in Polar, Referly finds the matching sale and marks it as refunded, so no commission is owed on money you gave back. This only applies while the commission is still within your payout hold period. Once that has passed and the affiliate has been cleared for payout, the sale is left alone — adjust it by hand if you want it reversed. See Refunds and Reward holds.Disconnecting
There are two parts:- To stop tracking, delete the Referly endpoint in your Polar dashboard under Settings, then Webhooks. Nothing reaches Referly after that.
- To remove your token, open Connect Integration in Referly, select Polar, and choose Disconnect. You can also revoke the token in Polar.
Troubleshooting
Nothing is appearing in Referly
Nothing is appearing in Referly
The reference isn't on my checkout links
The reference isn't on my checkout links
Orders are tracked but discount code sales aren't
Orders are tracked but discount code sales aren't
Connecting fails or the token is rejected
Connecting fails or the token is rejected
Everything stopped working after a while
Everything stopped working after a while
A sale is showing as zero
A sale is showing as zero
order.paid is one of the selected events on your webhook.