Discount Object
A discount contains the following information:Discount Types
| Type | Description | Example |
|---|---|---|
percentage | Percentage off the price | 20% off |
fixed | Fixed amount off | $10 off |
Discount Statuses
| Status | Description |
|---|---|
active | Discount is valid and can be used (within date range and under usage limit) |
expired | Discount has passed its end date or usage limit has been reached |
Listing Discounts
Retrieve all discounts for your store:Query Parameters
| Parameter | Type | Description |
|---|---|---|
per_page | integer | Number of discounts per page (max 100, default 15) |
cursor | string | Pagination cursor from previous response |
status | string | Filter by status (active, expired) |
search | string | Search by discount code, name, or public ID |
start_date | string | Filter discounts created from this date (Y-m-d format) |
end_date | string | Filter discounts created until this date (Y-m-d format) |
Filtering Examples
Example Response
Getting a Single Discount
Retrieve a specific discount by its public ID:Applying Discounts at Checkout
Use a discount code when initiating checkout:Discount Restrictions
Discounts can have various restrictions:Usage Limits
Usage Limits
Limit how many times a discount can be used:When
usage_count reaches usage_limit, the discount becomes invalid.Date Restrictions
Date Restrictions
Set start and end dates for the discount:The discount is only valid between these dates.
Product Restrictions
Product Restrictions
Limit the discount to specific products:If
products is empty, the discount applies to all products.Customer Restrictions
Customer Restrictions
Limit the discount to a specific customer:Only the specified customer can use this discount.
Discount Validation
When applying a discount at checkout, it’s automatically validated against these criteria:- Status - Must be
active - Date range - Current date must be within
start_dateandend_date(if specified) - Usage limit -
usage_countmust not have reachedusage_limit(if specified) - Product eligibility - Product must be in the
productsarray (if not empty, applies to all products) - Customer eligibility - Customer email must match
customer_email(if specified)
expired when:
- The
end_datehas passed - The current date is before
start_date - The
usage_limithas been reached
Common Use Cases
Promotional Campaigns
Promotional Campaigns
Track discount performance for marketing campaigns:
Affiliate Codes
Affiliate Codes
Create unique discount codes for affiliates and track usage:
VIP Customers
VIP Customers
Create single-use discounts for VIP customers: