-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I want to contribute a minimal example showing how to handle the full license key lifecycle: activation, validation, and deactivation; using the official Polar Go SDK.
Why this is needed
While the repo has basic checkout examples, it lacks a clear reference for "Product Entitlement." This example will show Go developers how to gate features and secure APIs using Polar’s license key system, unlocking monetization for self-hosted software and restricted tools.
Implementation Details
I’ll use the polar-go SDK to implement a standard service-protection pattern:
- License Activation Endpoint: A route allowing users to link their purchased license key to their current environment or machine.
- Validation Middleware: A custom middleware that intercepts requests to protected routes, validating the provided license key using the Polar Go SDK.
- Deactivation Flow: An endpoint to release an active seat, providing a way for users to migrate their license to a different instance.
- Webhook Synchronization: Integration that listens for Polar events to automatically track when new licenses are issued or benefits are granted.
- Configurable Environment: A clear setup for sandbox and production modes via environment variables.
Tech Stack: Go 1.22+, Gin/Echo, Polar Go SDK
Metadata
Metadata
Assignees
Labels
No labels