{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "#/components/schemas/coupon_Base", "title": "coupon_Base", "required": [ "amount", "applies_to", "code", "name", "type" ], "type": "object", "properties": { "name": { "type": "string", "description": "The name of the coupon. The value must be unique.", "example": "Australia Customers Discount", "maxLength": 100 }, "type": { "type": "string", "enum": [ "per_item_discount", "per_total_discount", "shipping_discount", "free_shipping", "percentage_discount", "promotion" ] }, "amount": { "type": "string", "description": "The discount to apply to an order, as either an amount or a percentage. This field\u2019s usage is determined by the coupon `type`. For example, a `type` of + `percentage_discount` would determine a percentage here.", "example": "5" }, "min_purchase": { "type": "string", "description": "Specifies a minimum value that an order must have before the coupon can be applied to it.", "example": "25" }, "expires": { "type": "string", "description": "Specifies when a coupon expires. Coupons need not have an expiry date \u2013 you can also control expiry via + `max_uses` or `max_uses_per_customer`. If you do use this date field, the value must be in RFC 2822 format." }, "enabled": { "type": "boolean", "description": "If the coupon is enabled, this field\u2019s value is `true`; otherwise, `false`.", "example": true }, "code": { "pattern": "[a-zA-Z0-9_\\ -]", "type": "string", "description": "The coupon code that customers will use to receive their discounts. Value must be unique. Only letters, numbers, white space, underscores, and hyphens are allowed.", "example": "S2549JM0Y", "maxLength": 50 }, "applies_to": { "type": "object", "properties": { "ids": { "type": "array", "description": "ID of either the products or categories", "items": { "type": "integer" } }, "entity": { "type": "string", "description": "What the discount applies to. Can be products or categories." } }, "description": "If it is not included in the PUT request, its existing value on the coupon will be cleared. Also required to be set on the POST request" }, "max_uses": { "type": "integer", "description": "Maximum number of times this coupon can be used.", "example": 25 }, "max_uses_per_customer": { "type": "integer", "description": "Maximum number of times each customer can use this coupon.", "example": 0 }, "restricted_to": { "type": "object", "properties": { "countries": { "type": "string" } } }, "shipping_methods": { "type": "array", "description": "This is a list of shipping-method names. A shipping method must be enabled on the store to use it with a coupon. To check which shipping methods are enabled, please use the [List Shipping Methods](/archive/store-operations/v2-catalog-products/v2-products#list-shipping-methods) endpoint.", "items": { "type": "string" } } }, "example": { "id": 2, "name": "Australia Customers Discount", "type": "per_item_discount", "amount": "5", "min_purchase": "25", "expires": "", "enabled": true, "code": "S2549JM0Y", "applies_to": { "entity": "categories", "ids": [ 0, 3 ] }, "num_uses": 0, "max_uses": 25, "max_uses_per_customer": 0, "restricted_to": { "countries": "AU" }, "shipping_methods": [ "shipping_endicia" ], "date_created": "Tue, 13 Mar 2018 16:18:59 +0000" }, "x-internal": false }