Docs Polar Integration

Polar Integration

Automatically sync subscriptions and entitlements from Polar.

Polar is a merchant of record for developers. When you connect Polar to Holdify, subscription changes are automatically synced so your API key verifications always reflect the customer's current plan.

Subscriptions

Plan changes via checkout or Customer Portal sync in real-time.

Entitlements

Benefits from Polar products map to entitlements in Holdify.

Limits

Quota and rate limits update based on the customer's plan tier.

Setup

1

Connect in dashboard

Go to Settings → Integrations → Polar in the Holdify dashboard and click "Connect Polar". You'll be redirected to authorize Holdify.

2

Configure webhook in Polar

In your Polar dashboard, add a webhook endpoint pointing to Holdify:

https://api.holdify.io/v1/integrations/polar/webhook

Select the following events:

yaml
# Events Holdify listens for:
- order.created
- subscription.created
- subscription.updated
- subscription.canceled
- subscription.revoked
- benefit.granted
- benefit.revoked
3

Map products to plans

In the Holdify dashboard, map your Polar products to Holdify plans. This determines the limits and entitlements for each subscription tier.

How it works

  1. 1 Customer subscribes or upgrades via Polar Checkout or Customer Portal
  2. 2 Polar sends a webhook to Holdify with the subscription details
  3. 3 Holdify verifies the webhook signature and dedupes by event ID
  4. 4 Entitlements and limits are updated for the tenant
  5. 5 The next /v1/verify call reflects the new plan

Entitlement mapping

Polar Benefits map directly to Holdify entitlements. Create Benefits in Polar and they'll appear in the entitlements array when you verify a key.

Product → Benefit → Entitlement
text
// In Polar, create Products with Benefits
// Holdify maps these to entitlements:

Product: "Pro Plan" ($29/mo)
├── Benefit: "API Access"      → entitlement: "api"
├── Benefit: "Chat Feature"    → entitlement: "chat"
└── Benefit: "Embeddings"      → entitlement: "embeddings"

Product: "Business Plan" ($99/mo)
├── Benefit: "API Access"      → entitlement: "api"
├── Benefit: "Chat Feature"    → entitlement: "chat"
├── Benefit: "Embeddings"      → entitlement: "embeddings"
├── Benefit: "Fine-tuning"     → entitlement: "fine-tuning"
└── Benefit: "Priority Support"→ entitlement: "priority-support"

Webhook payload

Holdify receives webhook payloads from Polar and processes them automatically. For reference, here's an example payload:

subscription.created
json
// Example: subscription.created webhook
{
  "type": "subscription.created",
  "data": {
    "id": "sub_123",
    "customer_id": "cust_456",
    "product_id": "prod_789",
    "status": "active",
    "current_period_start": "2025-01-01T00:00:00Z",
    "current_period_end": "2025-02-01T00:00:00Z"
  }
}

Handling cancellations

When a subscription is canceled or revoked:

  • Entitlements are removed immediately
  • Existing API keys can optionally be disabled
  • The change is logged in the audit trail

Configure cancellation behavior in Settings → Integrations → Polar → On Cancel.

Usage-based billing

Holdify tracks usage for rate limiting and analytics, but does not handle billing. If you use Polar's usage-based billing:

  1. 1 Track usage in Holdify via /v1/usage/events
  2. 2 Forward usage events to Polar from your backend for billing
  3. 3 Polar generates invoices based on the usage you report

Next steps