Overview
Discounts allow you to offer promotional pricing to customers through discount codes or automatic discounts.
The Discount Object
Unique identifier for the discount
Discount code (for code-based discounts)
Type: percentage or fixed
Discount amount (percentage or cents based on type)
Currency (for fixed discounts)
Maximum number of redemptions (null for unlimited)
Current number of redemptions
max_redemptions_per_customer
Max uses per customer (null for unlimited)
When discount becomes active
Applicable products (empty for all)
List Discounts
curl -X GET "https://api.polar.sh/v1/discounts" \
-H "Authorization: Bearer polar_pat_..."
Query Parameters
Get Discount
curl -X GET "https://api.polar.sh/v1/discounts/{id}" \
-H "Authorization: Bearer polar_pat_..."
Path Parameters
Create Discount
curl -X POST "https://api.polar.sh/v1/discounts" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Summer Sale",
"code": "SUMMER20",
"type": "percentage",
"amount": 20,
"redemptions_limit": 100,
"organization_id": "org_123"
}'
Request Body
Discount code (leave empty for automatic discount)
Discount type: percentage or fixed
For percentage: 1-100. For fixed: amount in cents
Currency (required for fixed discounts)
max_redemptions_per_customer
Per-customer limit
Product IDs (empty for all products)
Organization ID (required unless using org token)
Update Discount
curl -X PATCH "https://api.polar.sh/v1/discounts/{id}" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"redemptions_limit": 200
}'
Path Parameters
Request Body
All fields optional.
Delete Discount
curl -X DELETE "https://api.polar.sh/v1/discounts/{id}" \
-H "Authorization: Bearer polar_pat_..."
Path Parameters
Examples
Create Percentage Discount
curl -X POST "https://api.polar.sh/v1/discounts" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"name": "20% Off",
"code": "SAVE20",
"type": "percentage",
"amount": 20,
"organization_id": "org_123"
}'
Create Fixed Amount Discount
curl -X POST "https://api.polar.sh/v1/discounts" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"name": "$10 Off",
"code": "TEN",
"type": "fixed",
"amount": 1000,
"currency": "USD",
"organization_id": "org_123"
}'
Time-Limited Discount
curl -X POST "https://api.polar.sh/v1/discounts" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Flash Sale",
"code": "FLASH24",
"type": "percentage",
"amount": 30,
"starts_at": "2024-03-01T00:00:00Z",
"ends_at": "2024-03-02T00:00:00Z",
"organization_id": "org_123"
}'
Product-Specific Discount
curl -X POST "https://api.polar.sh/v1/discounts" \
-H "Authorization: Bearer polar_pat_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Premium Only",
"code": "PREMIUM15",
"type": "percentage",
"amount": 15,
"products": ["prod_premium_123"],
"organization_id": "org_123"
}'