Documentation Index
Fetch the complete documentation index at: https://docs.builderbox.ai/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- go to sandbox.polar.sh and create an organization.
- go to your organization and create a product.
- get the product id and set it in the environment variables.
- Required environment variables: in
apps/server/.env
Installation
Install the required dependencies:Server-Side Configuration
- Initialize the Polar client: in
apps/server/src/lib/polar.ts
- Configure BetterAuth with Polar plugin:
Webhook Handling
Client-Side Configuration
Set up the auth client with Polar support:Product Configuration
Define your products in a configuration file: inapps/web/src/src/products.ts
apps/server/src/utils/products-list.ts
Webhook Handling
Set up webhook handling for Polar events:Subscription Management
Starting a Checkout
Common Issues
-
Webhook Signature Verification
- Ensure the webhook secret is correctly set
- Verify the signature in the webhook handler
-
Subscription Status Sync
- Implement proper webhook handling
- Update the database on subscription changes
-
Checkout Session
- Set correct success and cancel URLs
- Handle failed payments gracefully