Connect Polar
Sell through Polar instead of Stripe, with an organization access token.
A product can sell through Polar instead of Stripe. Polar is a merchant of record, so it handles your sales tax. Available since 0.8.0.
Pick Polar for a product
When you add a product, set Payments to Polar. The choice is made once, when the product is created.
Connect your Polar organization
Create an organization access token in Polar
Give it these scopes:
Paste it in the Payments step
The token starts with
polar_oat_. Supaffi checks it, then creates its webhook in Polar, pointing athttps://<your-subdomain>/api/webhooks/polar. You never set up a webhook yourself.
A token from Polar's sandbox works too, for testing. If Polar rejects the token, the step shows Polar rejected that token. Create a new one and paste it again.
Tag your checkouts
Polar checkout links on your pages need nothing more than the tracking script. It adds the referral to every link to buy.polar.sh, sandbox links included.
If your server creates Polar checkout sessions, pass the __supaffi_referral cookie in the checkout metadata under supaffi_referral, as with Stripe Checkout Sessions:
const referralToken = cookies.get("__supaffi_referral");
await polar.checkouts.create({
// ...your existing options
metadata: {
// ...your existing metadata
...(referralToken && { supaffi_referral: referralToken }),
},
});To stop a payment from earning, set the metadata key supaffi to false on the checkout, the subscription or the customer in Polar.
What earns
- One-time purchases, a subscription's first payment and every renewal, plan changes included.
- Commissions are on what the customer paid after discounts and before tax.
- A free trial starts earning at its first paid order.
- Refunds, partial or full, lower or cancel the commission, including refunds Polar makes on its own to head off a chargeback.
- A subscription earns nothing more once Polar ends it.
Promo codes on Polar
Promo codes work the same way, with a Polar discount in place of a Stripe coupon. The program's Customer discount lists your Polar discounts.
- Each affiliate's code is a new discount copied from the program's one: same amount, duration and products, under their code.
- Polar has no rule for first-time customers, so each code works once per customer instead.
- You can link a discount code that already exists in Polar.
- Turning off a code Supaffi made deletes it in Polar.