post https://app.ecwid.com/api/v3//discount_coupons
Create a new discount coupon in an Ecwid store.
Access scopes
Requires the following access scope: create_discount_coupons
Request
A JSON object of type 'Coupon' with the following fields:
Coupon
Field | Type | Description |
---|---|---|
name | string | Coupon title |
code | string | Unique coupon code, length limit is 128 characters. |
discountType | string | Discount type: ABS , PERCENT , SHIPPING , ABS_AND_SHIPPING , PERCENT_AND_SHIPPING . Default is ABS |
status | string | Discount coupon state: ACTIVE , PAUSED . Discount coupon states EXPIRED and USEDUP are set by Ecwid store only and not available in API |
discount | number | Discount amount . 0 is default |
launchDate | string | The date of coupon launch, e.g. 2014-06-06 08:00:00 +0400 . Any date provided will be corrected to the UTC timezone |
expirationDate | string | Coupon expiration date, e.g. 2014-06-06 08:00:00 +0400 . Any date provided will be corrected to the UTC timezone |
totalLimit | number | The minimum order subtotal the coupon applies to |
usesLimit | string | Number of uses limitation: UNLIMITED , ONCEPERCUSTOMER , SINGLE . UNLIMITED is default |
repeatCustomerOnly | boolean | Deprecated. Use applicationLimit instead. Coupon usage limitation flag identifying whether the coupon works for all customers or only repeat customers |
applicationLimit | string | Application limit for discount coupons. Possible values: "UNLIMITED" , "NEW_CUSTOMER_ONLY" , "REPEAT_CUSTOMER_ONLY" . If you are creating or updating a discount coupon, make sure to use the old repeatCustomerOnly field or the new applicationLimit field only. When both these fields are sent, the priority will be given to the new field – applicationLimit |
orderCount | number | Number of uses |
catalogLimit | <DiscountCouponCatalogLimit> | The products and categories the coupon can be applied to |
shippingLimit | <DiscountCouponShippingLimit> | Shipping methods, the cost of which will be free after applying the coupon (for 'Free shipping' coupons) |
DiscountCouponCatalogLimit
Field | Type | Description |
---|---|---|
products | Array | The list of product IDs the coupon can be applied to |
categories | Array | The list of category IDs the coupon can be applied to |
DiscountCouponShippingLimit
Field | Type | Description |
---|---|---|
shippingMethods | Array | The list of shipping method IDs, the cost of which will be free after applying the coupon |
Response
A JSON object of type 'CreateStatus' with the following fields:
CreateStatus
Field | Type | Description |
---|---|---|
id | number | Internal unique coupon ID |
code | string | Code of the created coupon |
Errors
In case of error, Ecwid responds with an error HTTP status code and, optionally, a JSON-formatted body containing error description.
HTTP codes
HTTP Status | Response JSON | Description |
---|---|---|
400 | Request parameters are malformed | |
403 | Access token doesn't have create_discount_coupons scope | |
409 | The coupon with the given code already exists | |
415 | Unsupported content-type: expected application/json or text/json | |
500 | The creation request failed because of an error on the server |
Error response body (optional)
Field | Type | Description |
---|---|---|
errorMessage | string | Error message |