novinzodevelopers
Your store's APIApps referenceCoupons

Add Coupon

POST/admin/coupon

A new coupon. A "percentage" discount's amount is a percent from 0 to 100, so 15 takes 15% off, not 0.15. A "fixed" discount's amountInMinorUnits comes off the cart's subtotal, and never more than it. Its code must be one no other live coupon of the store has. scope {"_tag":"store"} takes the discount off the whole cart; {"_tag":"chosen","productIds":[...],"variantIds":[...]} (ids from ListStoreVariants, at least one and at most 100 together) takes it off only the cart lines of those products and variants: a percentage off each such line, a fixed amount shared between them and never more than they cost, and a cart holding none of them is refused the coupon.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

name*string
Length1 <= length
code*string
Length3 <= length <= 12
description*string
Length1 <= length
usageLimit*|null
discount*|
scope?||

What the discount is taken off; without it, the whole cart

active?|null

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/admin/coupon" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "code": "string",    "description": "string",    "usageLimit": 1,    "discount": {      "variant": "fixed",      "amountInMinorUnits": "string"    }  }'
{  "name": "string",  "code": "string",  "description": "string",  "usageLimit": 1,  "discount": {    "variant": "fixed",    "amountInMinorUnits": "string"  },  "scope": {    "_tag": "store"  },  "active": {    "from": "string",    "to": "string"  },  "id": "string"}