Polar in Moodle: sell courses with tax handled for you

How to take Moodle course payments with Polar as merchant of record: cards, Apple Pay and Google Pay, sales tax and VAT handled by Polar. Sandbox first, then live. With a free plugin.

Where
Worldwide
Currency
USD, EUR, GBP, and 27 more
Pay with
Cards, Apple Pay, Google Pay

Short answer: install the free Polar plugin for Moodle, add a Polar organization access token and webhook secret to a payment account, and price your course in a currency such as USD or EUR. Learners pay on Polar’s checkout with their card, Apple Pay or Google Pay, and Moodle enrols them once Polar reports the order as paid.

Why Polar for course payments?

Polar is a merchant of record. It sells to your learner on your behalf, takes the payment, sends the receipt, and calculates, collects and remits sales tax and VAT in the learner’s country. You get paid out by Polar.

That matters most when you sell to learners in many countries. Without a merchant of record, selling a course to someone in the EU, the UK or a US state with digital sales tax can mean registering for tax there yourself. With Polar, that is Polar’s job.

Two things to check before you choose it:

  • Fees. A merchant of record charges more than a plain card processor, because it carries the tax work and the chargebacks. See Polar’s pricing for the current rate.
  • Payouts. Polar pays out through Stripe Connect, so your organization needs a payout account in a country Polar supports. Check Polar’s documentation for your country before you build on it. If Polar cannot pay you out, Whop is the other merchant of record we support.

What do you need?

You needWhere to get it
Moodle 4.5 to 5.3Your site, as administrator
A Polar organizationpolar.sh, plus the sandbox for testing
The Polar plugin for Moodlegithub.com/devlms/moodle-paygw_polar, free and open source (GPL)

Step 1: get your keys from Polar

Start in the sandbox at sandbox.polar.sh. It is a separate copy of Polar with its own organization and keys, where no money moves.

  1. Access token: Settings > Access Tokens, create an organization access token with the scopes products:write, checkouts:write and orders:read. The plugin needs nothing more.
  2. Webhook secret: Settings > Webhooks, add an endpoint with the address https://your-moodle-site/payment/gateway/polar/webhook.php and the format Raw. Choose the events order.paid, order.updated, order.refunded, checkout.updated and checkout.expired, then copy the secret. It starts with whsec_.

Step 2: install the plugin

  1. Download the latest release from the plugin’s releases page and unzip it into payment/gateway/polar, or upload the zip in Site administration > Plugins > Install plugins. With the DevLMS payment hub, press Activate next to Polar instead.
  2. Visit Site administration > Notifications to finish the upgrade.
  3. Enable Polar in Site administration > Plugins > Payment gateways > Manage payment gateways.

Step 3: add the keys to a payment account

In Site administration > Payments > Payment accounts, open an account and choose Polar. Choose Sandbox, paste the access token and the webhook secret, then enable it.

Once saved, the token and the secret are never shown again, not even masked. Leaving the fields empty keeps the saved values; typing a new value replaces them.

Leave Product ID empty. The plugin then creates one private Polar product per course on its first sale, named after the course, so receipts show what the learner bought. Fill it in only if you want every course sold under one product you made yourself.

Step 4: price a course

Enable Enrolment on payment, add it to the course, choose the payment account and set the price. The plugin offers USD, EUR, GBP and 27 more currencies. Pricing in your Polar organization’s default currency is the safest choice.

Polar charges the Moodle price exactly. If Polar adds sales tax or VAT on top, the learner pays it at checkout, and it does not count against your price.

Step 5: test, then go live

As a test learner, open the course, choose Pay, then Polar. On Polar’s sandbox checkout, pay with the card number 4242 4242 4242 4242, any future date and any CVC. Back in Moodle, the learner is enrolled and the payment appears in Site administration > Reports > Payments.

To go live, create the same token and webhook in your live Polar organization, then switch the payment account to Live with the live values.

How is each payment checked?

  • Card details stay on Polar’s page; your Moodle never sees them.
  • A webhook only makes the plugin ask Polar’s API for the order of that checkout. The webhook itself must carry a valid signature and a timestamp no more than five minutes old.
  • The order must be paid, belong to the checkout the plugin created, be in the course currency, and total at least the course price.
  • Each payment is delivered once, whether the webhook or the learner’s return arrives first, and however often Polar resends the webhook.

Selling locally and internationally

If you also take local payments, such as EDAHABIA and CIB cards in Algeria with Chargily Pay, the DevLMS payment hub shows both at one checkout, each with its own price and currency.

Common problems

ProblemWhat to check
Polar is not in the payment windowPolar is enabled in Manage payment gateways and in the payment account, and the course price is in a supported currency
The learner paid but is not enrolledThe webhook is in the same Polar environment (sandbox or live) as the token, points to your site, uses the Raw format and includes order.paid
The checkout fails to openThe token belongs to an organization in the same environment you chose (a sandbox token does not work on Live), and has the three scopes
You deleted the course’s product in PolarNothing to do: the plugin makes a new one on the next sale

The plugin is new (version 0.1.0) and tested against Polar’s published API. If something does not work on your site, open an issue.

Need subscriptions, bundles or a different provider? See all payment guides or ask us for a fixed price.