Developers

Coupons

Markdown

Create a coupon

Creates a discount coupon with its code, value and rules.

POST/stores/{storeId}/v1/coupons

code is up to 64 characters and is saved in capitals. value is a number: a percentage from 0 to 100 when type is percent (the default), or an amount in SAR when type is fixed. scope limits the coupon to the category or product IDs in scope_ids. discounted_policy decides what happens on discounted products: all applies, exclude skips them, and block refuses the coupon with them. See Marketing and customer messages.

Headers

Idempotency-Keystringrequired

Request body

codestringrequired
namestring | null
valuenumberrequired
The percentage from 0 to 100, or the amount in SAR.
typestring
percent fixed
activeboolean
start_datestring | null (date)
expirystring | null (date)
The last day the coupon works.
usage_limitinteger | null
scopestring
all category product
scope_idsarray<integer>
discounted_policystring
On discounted products: all applies, exclude skips them, block refuses the coupon with them.all exclude block

Response

dataobjectrequired
idstring
codestring
namestring | null
typestring
percent fixed
valuestring
Discount percentage or amount.
usageinteger
Number of uses.
usage_limitinteger | null
start_datestring | null (date)
expirystring | null (date)
activeboolean
scopestring
all category product
scope_idsarray | null
discounted_policystring
all exclude block
executionobject
Who executed the request: the app, version, installation and store. Field names here are camelCase.
appIdstring (uuid)
versionIdstring (uuid)
installationIdstring (uuid)
storeIdstring (uuid)
requestIdstring (uuid)
generationinteger
routeEpochinteger
appAuthEpochinteger
grantRevisioninteger
metaobjectrequired
request_idstring (uuid)
The request ID; include it in any support request.

Errors

HTTPCodeMeaning
400IDEMPOTENCY_KEY_REQUIREDNo Idempotency-Key header.
409STORE_RULE_REFUSEDA store rule refused the command. Read the resource before you try again.
422INVALID_INPUTThe store refused a value. Check the limits on this page.
422UNKNOWN_FIELDUnknown field.
403SCOPE_REQUIREDThe token does not carry the required scope.
503APPS_SCOPE_RUNTIME_NOT_READYThe resource is not enabled on this merchant's store yet.

Shared codes are listed in Errors.

    ↑↓ moveEnter openEsc close