Skip to main content

Coupons

A discount coupon is a promotional tool that allows a store to offer savings to its customers. There are three types of coupons available:

  • Percentage: Applies a discount based on a percentage of the cart total.
  • Absolute Value: Reduces the cart total by a specific, fixed amount.
  • Free Shipping: Eliminates the shipping cost without affecting the value of the products in the cart.

Properties

PropertyExplanation
idThe unique numeric identifier for the coupon.
codeString that identifies the coupon.
typeType of the coupon. Can take the following values: percentage, absolute or shipping.
validIndicates if the coupon is valid (true) or not (false).
start_dateDate from which the coupon is valid.
end_dateDate of overdue of the coupon.
deleted_atDate when the coupon was deleted. The value is NULL if the coupon is still valid.
max_usesMax number of times the coupon can be used.
valueValue of the discount.
includes_shippingIndicates if the coupon also applies to shipping costs (true) or not (false).
first_consumer_purchaseIndicates if the coupon applies only to the first purchase of a consumer based on the email and/or personal ID.
min_priceIndicates the minimum value of the bill for applying the discount.
categoriesList of Category objects representing the categories of the store to which the discount applies.
productsList of Product objects representing the products of the store to which the discount applies.
combines_with_other_discountsIndicates if the coupon is combinable with other promotions or discounts.

Endpoints

GET /coupons

Retrieve the list of all coupons.

Filtering Properties

ParameterExplanation
qThe coupon's code to filter.
min_start_dateThe minimum start_date to filter.
min_end_dateThe minimum end_date to filter.
max_start_dateThe maximum start_date to filter.
max_end_dateThe maximum end_date to filter.
validFlag (true of false) for filtering valid coupons.
statusCoupon's status for filtering coupons. One of: activated, deactivated.
limitation_typeCoupon's limitation for filtering coupons. One of: quantity, cart_value, categories.
term_typeCoupon's term limitation for filtering coupons. One of: unlimited, limited.
discount_typeCoupon's discount type for filtering coupons. One of: percentage, absolute, shipping.
includes_shippingCoupon that apply to shipping costs for filtering coupons.
sort_byAttribute for ordering coupons. One of: created-at-ascending, created-at-descending, alpha-ascending, alpha-descending, uses-ascending, uses-descending.
created_at_minShow Products created after date (ISO 8601 format).
created_at_maxShow Products created before date (ISO 8601 format).
updated_at_minShow Products last updated after date (ISO 8601 format).
updated_at_maxShow Products last updated before date (ISO 8601 format).
pagePage to show.
per_pageAmount of results.
fieldsComma-separated list of fields to include in the response.

GET /coupons

HTTP/1.1 200 OK

Response

E.g.

[
{
"id": 32965,
"code": "PR2",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"includes_shipping": false,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"first_consumer_purchase": false,
"combines_with_other_discounts": true,
"categories": [
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"parent": 0
}
]
},
{
"id": 32966,
"code": "PR23",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"includes_shipping": false,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"first_consumer_purchase": false,
"combines_with_other_discounts": false,
"categories": null
},
{
"id": 32964,
"code": "PR4",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"includes_shipping": false,
"start_date": "2014-06-07",
"end_date": "2014-06-08",
"min_price": 10,
"first_consumer_purchase": false,
"combines_with_other_discounts": true,
"products": [
{
"id": 173107,
"name": {
"es": "Remera manga corta",
"en": "Short sleeve T-shirt"
}
},
{
"id": 173108,
"name": {
"es": "Remera manga larga",
"en": "Long sleeve T-shirt"
}
}
]
},
{
"id": 32963,
"code": "PR5",
"type": "percentage",
"value": "30.00",
"valid": false,
"used": 0,
"max_uses": null,
"includes_shipping": false,
"start_date": null,
"end_date": null,
"min_price": 100,
"first_consumer_purchase": false,
"combines_with_other_discounts": true,
"categories": [
{
"id": 105190,
"name": {
"es": "Pantalones",
"en": "Pantalones"
},
"parent": 0
},
{
"id": 105191,
"name": {
"es": "Camisas",
"en": "Camisas"
},
"parent": 0
},
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"parent": 0
}
]
}
]

GET /coupons?valid=true

HTTP/1.1 200 OK

Response

E.g.

[
{
"id": 32965,
"code": "PR2",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"includes_shipping": false,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"first_consumer_purchase": false,
"combines_with_other_discounts": false,
"categories": [
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"parent": 0
}
]
},
{
"id": 32966,
"code": "PR23",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"includes_shipping": false,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"first_consumer_purchase": false,
"combines_with_other_discounts": true,
"categories": null
},
{
"id": 32964,
"code": "PR4",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"includes_shipping": false,
"start_date": "2014-06-07",
"end_date": "2014-06-08",
"min_price": 10,
"first_consumer_purchase": false,
"combines_with_other_discounts": false,
"categories": [
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"parent": 0
}
]
}
]

GET /coupons/{id}

Retrieve a single coupon.

GET /coupons/32964

HTTP/1.1 200 OK

Response

E.g.

{
"id": 32964,
"code": "PR4",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"includes_shipping": false,
"start_date": "2014-06-07",
"end_date": "2014-06-08",
"min_price": 10,
"first_consumer_purchase": false,
"combines_with_other_discounts": true,
"categories": [
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"parent": 0
}
]
}

POST /coupons

Create a new coupon.

Properties

ParameterExplanationRequired
codeMust be unique and can contain only alphanumeric characters.True
typeOne of: percentage, absolute, shipping.True
valueThe value is mandatory if the type is percentage or absolute.False
start_dateMust be a datetime.False
end_dateMust be a datetime.False
categoriesA List of Category IDs. Cannot be combined with products.False
productsA List of Product IDs. Cannot be combined with categories.False
min_priceMust be a numeric value with greater than or equal to zero.False
validMust be a boolean.False
includes_shippingMust be a boolean.False
first_consumer_purchaseMust be a boolean.False
combines_with_other_discountsMust be a boolean. Defaults to true.False
Payload

E.g.

{
"code": "PRUEBA",
"type": "percentage",
"value": "30.00",
"max_uses": 100,
"includes_shipping": false,
"min_price": 10,
"first_consumer_purchase": true,
"categories": null,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"combines_with_other_discounts": true
}

HTTP/1.1 201 Created

Response

E.g.

{
"id": 32967,
"code": "PRUEBA",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": null,
"max_uses": 100,
"includes_shipping": false,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"first_consumer_purchase": true,
"categories": null,
"combines_with_other_discounts": true
}

PUT /coupons/{id}

Modify an existing coupon.

PUT /coupons/32967

Payload

E.g.

{
"code": "OTRAPRUEBA",
"type": "absolute",
"value": 50
}

HTTP/1.1 200 OK

Response

E.g.

{
"id": 32967,
"code": "OTRAPRUEBA",
"type": "absolute",
"value": 50,
"valid": true,
"used": 0,
"max_uses": 100,
"includes_shipping": false,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"first_consumer_purchase": true,
"categories": null,
"combines_with_other_discounts": false
}

DELETE /coupons/{id}

Delete an existing coupon.

DELETE /coupons/32967

HTTP/1.1 200 OK

{}