Skip to main content

Take payments with Polar

This guide explains how to let users pay for your Casdoor products with Polar, a checkout for developers and creators with subscriptions, one-time payments, and licensing.


Learning outcomes​

  • Create a Polar access token.
  • Add Polar as a payment provider and add it to a product.

What you need​

  • A Polar account
  • A product in Casdoor

Create an access token​

In Polar, open Settings > Personal Access Tokens, create a token with permissions for checkouts and payments, and copy it.

Add the provider in Casdoor​

  1. In the Casdoor admin console, go to Identity > Providers and add a provider.
  2. Set Category to Payment and Type to Polar.
  3. Enter the access token as the Client secret. Polar doesn't use Client ID.
  4. Leave Host empty to use the live Polar API (https://api.polar.sh). To test against the Polar sandbox, set Host to https://sandbox-api.polar.sh and use an access token created in the sandbox at sandbox.polar.sh.
  5. Save the provider.

Add the provider to a product​

Add the provider to the Payment providers of the product and save it. At checkout, users go to Polar and return to your application when the payment completes or is canceled.

note

The Polar API that Casdoor calls depends only on Host, not on the runmode in conf/app.conf. Sandbox tokens don't work against the live API and live tokens don't work against the sandbox. For local testing without Polar, use the Dummy provider.

See also​