Benefits are perks automatically granted when customers purchase products or subscribe. Polar handles the complete lifecycle: granting access when purchases occur, managing ongoing access, and revoking when subscriptions end.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/polarsource/polar/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Benefits enable you to:- Grant access to GitHub repositories
- Invite customers to Discord servers
- Generate and distribute license keys
- Provide file downloads
- Issue usage credits for metered billing
- Control feature flags
- Trigger custom webhooks
Benefit Types
- License Keys
- File Downloads
- GitHub Repository
- Discord Access
- Meter Credit
- Feature Flag
- Custom
Generate unique license keys for software activation.Use cases: Software licenses, API keys, activation codes
Creating Benefits
Create benefits through the API:Attaching Benefits to Products
Benefits are granted by attaching them to products:- Order/subscription is created
- Benefits are automatically granted
- Customer receives confirmation with benefit details
Benefit Grants
Benefit grants track individual customer access.Viewing Grants
List grants for a benefit:Grant Properties
Each grant type has specific properties:- License Keys
- File Downloads
- GitHub Repository
- Discord Access
Benefit Lifecycle
Access Provided
- License keys generated
- GitHub invitations sent
- Discord roles assigned
- Files made available
License Keys
Configuration
License keys support several configuration options:Prefix
Prefix
Optional prefix for generated keys (e.g., “PRO-XXXX-XXXX-XXXX”).
Expiration
Expiration
Set automatic expiration:
ttl: Number of time unitstimeframe: year, month, or day
Activations
Activations
Limit how many devices can use a key:
limit: Max simultaneous activations (1-50)enable_customer_admin: Allow customers to manage activations
Usage Limit
Usage Limit
Limit total number of uses (validations) across all activations.
Customer Management
Withenable_customer_admin, customers can:
- View active devices
- Deactivate devices
- See remaining activations
- Access via customer portal
Key Validation
Validate license keys via API:File Downloads
Upload Files
Upload files through the dashboard or API:Manage Files
Update benefit to add/remove files:GitHub Repository Access
Setup
Permission Levels
- pull: Read-only access
- triage: Read + manage issues/PRs
- push: Read + write access
- maintain: Push + manage settings
- admin: Full control
How It Works
- Customer purchases product
- Polar sends GitHub invitation
- Customer accepts invitation via email
- Access granted with specified permission
- On cancellation, access is revoked
Discord Access
Setup
How It Works
- Customer purchases product
- Polar generates Discord invitation
- Customer joins via invitation link
- Role automatically assigned
- On cancellation:
- Role removed
- Optionally kicked from server
Meter Credits
Grant usage credits as a benefit:- Granted when subscription starts
- Replenished each billing cycle
- Consumed by usage events
Feature Flags
Control feature access in your application:Custom Webhooks
Custom benefits trigger webhooks for your own fulfillment:Webhooks
Listen for benefit events:benefit.granted
Benefit granted to customer
benefit.revoked
Benefit revoked from customer
benefit.updated
Benefit configuration updated
Updating Benefits
Update benefit configuration:Deleting Benefits
Delete benefits to revoke all grants:Best Practices
License Keys
License Keys
- Set reasonable activation limits (3-5 for most software)
- Enable customer admin for better experience
- Use prefixes to identify product tiers
- Set expiration for time-limited licenses
File Downloads
File Downloads
- Use versioning in file names
- Archive old files instead of deleting
- Keep file sizes reasonable (under 100MB)
- Provide multiple formats when possible
GitHub Access
GitHub Access
- Use minimum required permission level
- Create dedicated repos for customers
- Document access in README
- Monitor repository access logs
Discord Access
Discord Access
- Create dedicated customer roles
- Set up proper channel permissions
- Choose kick settings carefully
- Welcome new members automatically
Benefit Design
Benefit Design
- Keep benefit names clear and descriptive
- Test fulfillment before attaching to products
- Group related benefits on the same product
- Document benefit usage for customers
API Reference
Create Benefit
Create a new benefit
List Benefits
Query benefits with filters
Update Benefit
Modify benefit configuration
Delete Benefit
Remove benefit and revoke grants
List Grants
View benefit grants