API Endpoints

The application exposes several API endpoints for handling payments and webhooks.

Payments

GET /api/checkout

Creates a checkout session with Polar.sh.

  • Query Parameters: None
  • Response: Redirects to Polar checkout page.

GET /api/portal

Redirects the user to the Polar Customer Portal.

  • Query Parameters: None
  • Response: Redirects to Polar portal.

Webhooks

POST /api/webhook/polar

Handles incoming webhooks from Polar.sh.

  • Body: JSON payload from Polar.
  • Headers: Must include Polar-Webhook-Signature for verification.

Authentication

Authentication endpoints are handled by Better Auth and are generally not called directly by the client application code, but rather through the Better Auth client SDK.

Common endpoints include:

  • /api/auth/signin
  • /api/auth/signup
  • /api/auth/signout
  • /api/auth/session