# Coupons
The coupon is a code you can create to share with your customers to get a discount when they order from your business. Coupons should be linked to predefined order discounts to apply the discount.
You can create coupons and define how many times (orders) the coupon can be used.
# The Coupon Object
# Sample
{
"id": "8cd1956b",
"name": "Coupon",
"code": "4630",
"maximum_uses": 2,
"is_active": true,
"from_date": "2019-04-17",
"to_date": "2019-04-20",
"from_time": 9,
"to_time": 14,
"is_sat": true,
"is_sun": false,
"is_mon": false,
"is_tue": true,
"is_wed": true,
"is_thu": true,
"is_fri": true,
"discount": {
"id": "8d931bf8"
},
"created_at": "2019-02-28 14:48:31",
"updated_at": "2019-02-28 14:48:31",
"deleted_at": null
}
# Attributes
| Field | Type | Rule | Description |
|---|---|---|---|
id | string | Unique identifier for the coupon. | |
name* | string | updatable | Name of the coupon. |
code* | string | updatable | Unique code of the copun. |
maximum_uses* | integer | updatable | Maximum times the coupon can be used. |
is_active | boolean | updatable | True if the coupon is available for usage. |
from_date* | string | updatable | The starting date where the discount can be used. |
to_time* | string | updatable | The last date the discount can be used. |
is_sat | boolean | updatable | True if the discount can be used on Saturday. |
is_sun | boolean | updatable | True if the discount can be used on Sunday. |
is_mon | boolean | updatable | True if the discount can be used on Monday. |
is_tue | boolean | updatable | True if the discount can be used on Tuesday. |
is_wed | boolean | updatable | True if the discount can be used on Wednesday. |
is_thu | boolean | updatable | True if the discount can be used on Thursday. |
is_fri | boolean | updatable | True if the discount can be used on Friday. |
discount* | object | updatable includable | The Discount object attached to the coupon. |
created_at | string | sortable | Time YYYY-MM-DD HH-MM-SS at which the object was created in UTC. |
updated_at | string | sortable | Time YYYY-MM-DD HH-MM-SS at which the object was updated in UTC. |
deleted_at | string | nullable | Time YYYY-MM-DD HH-MM-SS in UTC at which the coupon was deleted. |
# List Coupons
GET /coupons
# Scope
coupons.read
# Filters
idnamename_localizedcodeis_activediscount_idupdated_aftercreated_onupdated_ondeleted_on
# Response
{
"data": [
{
"id": "8cd1956b",
"name": "Coupon",
"code": "4630",
"maximum_uses": 2,
"is_active": true,
"from_date": "2019-04-17",
"to_date": "2019-04-20",
"from_time": 9,
"to_time": 14,
"is_sat": true,
"is_sun": false,
"is_mon": false,
"is_tue": true,
"is_wed": true,
"is_thu": true,
"is_fri": true,
"discount": {
"id": "8d931bf8"
},
"created_at": "2019-02-28 14:48:31",
"updated_at": "2019-02-28 14:48:31",
"deleted_at": null
}
]
}
# Get Coupon
GET /coupons/{couponId}
# Scope
general.read
# Response
{
"data": {
"id": "8cd1956b",
"name": "Coupon",
"code": "4630",
"maximum_uses": 2,
"is_active": true,
"from_date": "2019-04-17",
"to_date": "2019-04-20",
"from_time": 9,
"to_time": 14,
"is_sat": true,
"is_sun": false,
"is_mon": false,
"is_tue": true,
"is_wed": true,
"is_thu": true,
"is_fri": true,
"discount": {
"id": "8d931bf8"
},
"created_at": "2019-02-28 14:48:31",
"updated_at": "2019-02-28 14:48:31",
"deleted_at": null
}
}
# Create Coupon
POST /coupons
# Scope
coupons.write
# Request
{
"name": "Coupon",
"code": "4630",
"discount_id": "8cd1956b",
"maximum_uses": 2,
"is_active": true,
"from_date": "2019-04-17",
"to_date": "2019-05-20",
"from_time": 9,
"to_time": 14,
"is_sat": true,
"is_sun": false,
"is_mon": false,
"is_tue": true,
"is_wed": true,
"is_thu": true,
"is_fri": true
}
# Response
{
"data": {
"id": "8cd1956b",
"name": "Coupon",
"code": "4630",
"maximum_uses": 2,
"is_active": true,
"from_date": "2019-04-17",
"to_date": "2019-04-20",
"from_time": 9,
"to_time": 14,
"is_sat": true,
"is_sun": false,
"is_mon": false,
"is_tue": true,
"is_wed": true,
"is_thu": true,
"is_fri": true,
"discount": {
"id": "8d931bf8"
},
"created_at": "2019-02-28 14:48:31",
"updated_at": "2019-02-28 14:48:31",
"deleted_at": null
}
}
# Update Coupon
PUT /coupons/{couponId}
# Scope
coupons.write
# Request
{
"name": "Coupon",
"code": "4630",
"discount_id": "8cd1956b",
"maximum_uses": 2,
"is_active": true,
"from_date": "2019-04-17",
"to_date": "2019-05-20",
"from_time": 9,
"to_time": 14,
"is_sat": true,
"is_sun": false,
"is_mon": false,
"is_tue": true,
"is_wed": true,
"is_thu": true,
"is_fri": true
}
# Response
{
"data": {
"id": "8cd1956b",
"name": "Coupon",
"code": "4630",
"maximum_uses": 2,
"is_active": true,
"from_date": "2019-04-17",
"to_date": "2019-04-20",
"from_time": 9,
"to_time": 14,
"is_sat": true,
"is_sun": false,
"is_mon": false,
"is_tue": true,
"is_wed": true,
"is_thu": true,
"is_fri": true,
"discount": {
"id": "8d931bf8"
},
"created_at": "2019-02-28 14:48:31",
"updated_at": "2019-02-28 14:48:31",
"deleted_at": null
}
}
# Delete Coupon
DELETE /coupons/{couponId}
# Scope
coupons.write
The API will respond with 200 indicating that the coupon has been deleted.