Version 2019-10

You can use the PriceRule DiscountCode resource to create discount codes that enable specific discounts to be redeemed. Merchants can distribute discount codes to their customers using a variety of means, such as an email or URL, and customers can apply these codes at checkout.

Each discount code belongs to a price rule, which holds the logic for the discount. For more information, see the PriceRule resource.

To create multiple discount codes that use the same price rule logic, use the batch endpoint. For example, you might allow merchants to create a batch of discount codes that belong to the same price rule but are each personalized for a different customer.

What you can do with DiscountCode

The Shopify API lets you do the following with the DiscountCode resource. More detailed versions of these general actions may be available:

DiscountCode properties


The case-insensitive discount code that customers use at checkout. (maximum: 255 characters)

Use the same value for code as the title property of the associated price rule.

"created_at": "2017-03-13T16:09:54-04:00"

The date and time (ISO 8601 format) when the discount code was created.