Skip to main content

Overview

Discounts allow you to offer promotional pricing to customers through discount codes or automatic discounts.

The Discount Object

id
string
required
Unique identifier for the discount
name
string
required
Discount name
code
string
Discount code (for code-based discounts)
type
enum
required
Type: percentage or fixed
amount
integer
required
Discount amount (percentage or cents based on type)
currency
string
Currency (for fixed discounts)
redemptions_limit
integer
Maximum number of redemptions (null for unlimited)
redemptions_count
integer
required
Current number of redemptions
max_redemptions_per_customer
integer
Max uses per customer (null for unlimited)
starts_at
string
When discount becomes active
ends_at
string
When discount expires
organization_id
string
required
Organization ID
products
array
Applicable products (empty for all)
created_at
string
required
Creation timestamp

List Discounts

cURL
curl -X GET "https://api.polar.sh/v1/discounts" \
  -H "Authorization: Bearer polar_pat_..."

Query Parameters

organization_id
string
Filter by organization
query
string
Filter by name

Get Discount

cURL
curl -X GET "https://api.polar.sh/v1/discounts/{id}" \
  -H "Authorization: Bearer polar_pat_..."

Path Parameters

id
string
required
Discount ID

Create Discount

cURL
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

name
string
required
Discount name
code
string
Discount code (leave empty for automatic discount)
type
enum
required
Discount type: percentage or fixed
amount
integer
required
For percentage: 1-100. For fixed: amount in cents
currency
string
Currency (required for fixed discounts)
redemptions_limit
integer
Total redemption limit
max_redemptions_per_customer
integer
Per-customer limit
starts_at
string
Start date (ISO 8601)
ends_at
string
End date (ISO 8601)
products
array
Product IDs (empty for all products)
organization_id
string
Organization ID (required unless using org token)

Update Discount

cURL
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

id
string
required
Discount ID

Request Body

All fields optional.
name
string
Update name
redemptions_limit
integer
Update total limit
ends_at
string
Update expiration date

Delete Discount

cURL
curl -X DELETE "https://api.polar.sh/v1/discounts/{id}" \
  -H "Authorization: Bearer polar_pat_..."

Path Parameters

id
string
required
Discount ID

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"
  }'

Build docs developers (and LLMs) love