cart

cart.coupon.add

Use this method to create a coupon with specified conditions.

post/cart.coupon.add.json

Request

  • Base URL: https://api.api2cart.com/v1.1
  • URL: https://api.api2cart.com/v1.1/cart.coupon.add.json
  • Auth: API key in header x-api-key and API key in header x-store-key

Request body

codestring required

Coupon code

action_type'percent' | 'fixed' required

Coupon discount type

action_apply_to'order_total' | 'item_price' | 'shipping' required

Defines where discount should be applied

action_scope'order' | 'matching_items' required

Specify how discount should be applied. If scope=matching_items, then discount will be applied to each of the items that match action conditions. Scope order means that discount will be applied once.

action_amountnumber required

Defines the discount amount value.

codesstring[]

Entity codes

namestring

Coupon name

date_startstring

Date start

date_endstring

Defines when discount code will be expired.

usage_limitinteger

Usage limit for coupon.

usage_limit_per_customerinteger

Usage limit per customer.

action_condition_entitystring

Defines entity for action condition.

action_condition_keystring

Defines entity attribute code for action condition.

action_condition_operatorstring

Defines condition operator.

action_condition_valuestring

Defines condition attribute value/s. Can be comma separated string.

include_taxboolean

Indicates whether to apply a discount for taxes.

store_idstring

Store Id

free_cash_on_deliveryboolean

Defines whether the coupon provides free cash on delivery

customer_idstring

Retrieves orders specified by customer id

idempotency_keystring

A unique identifier associated with a specific request. Repeated requests with the same <strong>idempotency_key</strong> return a cached response without re-executing the business logic. <strong>Please note that the cache lifetime is 15 minutes.</strong>

Example request

{
  "code": "000_BIG_SALE_000",
  "action_type": "percent",
  "action_apply_to": "order_total",
  "action_scope": "matching_items",
  "action_amount": 15.5,
  "name": "Sale! -30%",
  "date_start": "2019-12-29 06:44:30",
  "date_end": "2020-01-05 01:00:00",
  "usage_limit": 99,
  "usage_limit_per_customer": 1,
  "action_condition_entity": "order",
  "action_condition_key": "product_id",
  "action_condition_operator": "ONE_OF",
  "action_condition_value": "17834222,45466663",
  "include_tax": true,
  "store_id": "1",
  "free_cash_on_delivery": true,
  "customer_id": "5",
  "idempotency_key": "098f6bcd4621d373cade4e832627b4f6"
}

Response

successful operation

return_codeinteger
return_messagestring

Changes

No recorded changes to this operation across all 1 revision of this API.