Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Polar + Encore Starter

Accept payments and subscriptions with Polar and Encore. Polar handles monetization as your Merchant of Record. Encore handles infrastructure.

What's included

  • Polar SDK initialized with an Encore secret
  • Checkout endpoint that creates Polar checkout sessions
  • Webhook handler that validates signatures and processes subscription events
  • Frontend at / with a checkout form

Prerequisites

You'll need a Polar account. For development, use the sandbox dashboard:

  1. Create a product. Go to Products and create a product. Copy the product ID, you'll paste it in the checkout form.
  2. Create an access token. Go to Settings > Developers > Personal Access Tokens.
  3. Create a webhook (optional). Go to Settings > Webhooks. Point it to your API URL followed by /webhook/polar. For local dev, use ngrok or similar to expose your local server.

Get started

  1. Install Encore if you haven't already:

    curl -L https://encore.dev/install.sh | bash
  2. Create a new app from this example:

    encore app create --example=ts/polar
  3. Set your Polar access token:

    encore secret set --type local PolarAccessToken
  4. Run the app:

    encore run
  5. Open http://localhost:4000 to create a test checkout. Paste your product ID and enter a test email.

Learn more