Skip to main content
A webhook endpoint is a URL on your server that Polar sends events to, such as order.paid or customer.state_changed. Polar posts each event as soon as it happens, so you don’t have to poll the API. Every request is signed with the endpoint’s secret. The TypeScript and Python SDKs verify the signature and return a typed payload. See Handle deliveries.
Build against the sandbox first. Test purchases, renewals, cancellations and refunds there trigger the same events without real money.

Create an endpoint

The URL must use https:// and be publicly reachable. Polar rejects localhost and private IP addresses. To receive events on your machine, use polar webhook listen instead.
  • Open Settings → Webhooks
  • Click Add Endpoint
  • Enter the URL, and an optional Name
  • Choose a Format: Raw for your own code, or Discord or Slack
  • Choose the API Version of the payloads
  • Select the Events you want to receive
  • Click Create webhook
To create endpoints from code, for example when you provision environments:
The examples use the sandbox client from Authentication, on API version 2026-10. See Create Webhook Endpoint.

Format

  • Raw sends the event as JSON. Use it for your own handlers.
  • Discord and Slack turn the event into a chat message for a channel. Paste the channel’s incoming webhook URL. When the URL starts with https://discord.com/api/webhooks or https://hooks.slack.com/services/, the dashboard selects the format for you.

API version

Each endpoint has an API version, which sets the shape of its payloads. It defaults to the current version, 2026-10. Use the same version as your SDK import (@polar-sh/sdk/2026-10, polar.v2026_10), so the SDK parses the payloads it receives. Every delivery carries the version in the webhook-api-version header.

Events

Subscribe only to the events your handler acts on. For access control, customer.state_changed alone is often enough. See Webhook events for the full list.

Copy the secret

Polar generates the secret when it creates the endpoint. You can’t set your own.
  • Open the endpoint in Settings → Webhooks
  • Click Copy Secret
  • Store it on your server as POLAR_WEBHOOK_SECRET
To rotate it, click Reset Secret, or run polar webhooks reset_webhook_endpoint_secret <id>. The old secret stops working immediately, so update your server right away. Secrets generated on or after 8 September 2026, 00:00 UTC are signed with Standard Webhooks. Older secrets use Polar’s original HMAC scheme. The endpoint page shows which one applies. See Custom validation.

Verify signature

Verify every request before you trust it. The SDKs do it in one call:
body is the raw request body, before any JSON parsing. See Handle deliveries for full handlers and error handling.

Test locally

The Polar CLI forwards your organization’s webhooks to a URL on your machine, so you can test handlers before you deploy them:
Terminal
The CLI prints the secret it signs events with. Use it as POLAR_WEBHOOK_SECRET while you develop. To send a sample event on demand, run polar webhook trigger order.created in another terminal.

From the CLI or your agent

See the CLI reference and MCP operations.

Learn more