Coupon Properties

Coupon Properties Fields

FieldTypeDescriptionExample
allocation_limitnumberAllocation limit.10
allocation_limit_amountstringAllocation limit amount."100.00"
allocation_methodstringAllocation method."manual"
buysPrerequisiteValuenumberValue required to meet the prerequisite for the discount.5
codestringCoupon code."SAVE10"
configConfig ObjectCoupon display configuration.See Config interface.
customer_selectionstringCustomer selection."all"
discount_typeDiscountTypeDiscount threshold type (enum)."percentage"
ends_atnumberEnd time. -1 indicates long-term validity.-1
entitled_area_liststring[]List of applicable areas.["US", "CA"]
entitled_collection_idsstring[]IDs of applicable collections.["123", "456"]
entitled_extra_listnullExtra applicable conditions.null
entitled_product_idsstring[]IDs of applicable products.["789", "101"]
entitled_sortstring[]Sorting of entitled products.["price", "popularity"]
entitled_variant_idsstring[]IDs of applicable product variants.["111", "222"]
getsDiscountValuenumberDiscount value received.10
getsMaxOrderUseValuenumberMaximum order use value.100
is_admin_shownumberWhether it is shown in admin view.1
life_cycle_typestringLifecycle type: begin_end or survival."begin_end"
once_per_customernumberLimit per customer.1
only_valid_first_order_customerbooleanWhether it is valid only for the customer's first order.false
prerequisitenumberWhether there is a discount threshold (1: yes, 0: no).1
prerequisite_customer_idsstring[]IDs of applicable customers.["customer1", "customer2"]
prerequisite_customer_rangenullRange of applicable customers.null
prerequisite_customer_segment_idsstring[]IDs of applicable customer segments.["segment1", "segment2"]
prerequisite_quantity_rangeArray of PrerequisiteQuantityRangeThresholds for quantity.See PrerequisiteQuantityRange.
prerequisite_subtotal_rangePrerequisiteSubtotalRange[]Thresholds for subtotal.See PrerequisiteSubtotalRange.
progressstringCoupon status (use this field instead of status).Activity status: ongoing in progress, not_started not started, finished ended,"ongoing"
sortSortProduct sorting.See Sort.
starts_atnumberStart time. Relevant for life_cycle_type=survival.1673246985
statusnumberDeprecated: Internal field for coupon status. Use progress instead.0
stocknumberRemaining stock.50
store_idnumberStore ID.11218
survival_timenumberValid time (in seconds). Relevant for life_cycle_type=survival.86400
target_selectionstringTarget range (e.g., all for all products)."all"
target_typestringType of target."product"
times_usednumberNumber of times the coupon has been used.10
tipsTipsAdditional tips for the coupon.See Tips.
titlestringTitle of the coupon."Spring Sale"
usage_limitnumberUsage limit. -1 indicates no limit.-1
use_with_othernumberWhether it can be used with other discounts (1: yes, 0: no).0
using_statestringCurrent state of usage."active"
valuenumberRule discount value. For thresholds, this is 0.10
value_typeValueTypeType of discount value (enum)."percentage"

Config Interface

FieldTypeDescriptionExample
banner_sizestringSize of the banner."large"
banner_urlstringURL of the banner image."https://example.com/banner.jpg"
count_downCountDownCountdown display configuration.See CountDown.

CountDown Interface

FieldTypeDescriptionExample
background_color_endstringEnd color for the background."#FFFFFF"
background_color_startstringStart color for the background."#000000"
colorstringText color."#FF0000"
count_down_background_colorstringBackground color for the countdown."#333333"
count_down_colorstringCountdown text color."#00FF00"
detail_page_show_codebooleanWhether the code is shown on detail pages.true
formatstringFormat of the countdown."DD:HH:MM"
show_count_downbooleanWhether to display the countdown.true

PrerequisiteQuantityRange Interface

FieldTypeDescriptionExample
greater_than_or_equal_tostringMinimum quantity threshold."5"
valuestringDiscount value (e.g., amount or percentage)."10%"

PrerequisiteSubtotalRange Interface

FieldTypeDescriptionExample
greater_than_or_equal_tostringMinimum subtotal threshold."100"
valuestringDiscount value (e.g., amount or percentage)."15%"

Sort Interface

FieldTypeDescriptionExample
bystringSort by this field."sales"
directionstringSort direction (asc or desc)."desc"

Tips Interface

FieldTypeDescriptionExample
copy_codestringMessage to copy the code."Copy the code!"
countdownstringCountdown message."Limited time!"
countdown_daystringCountdown in days."2 days left"
msgstringGeneral message."Enjoy your discount!"
use_codestringInstructions for using the code."Apply at checkout"

Enums

DiscountType

ValueDescriptionExample
amount_percentageDiscount as a percentage."10%"
fixed_amountFixed discount amount."5.00"
item_fixed_amountFixed discount for items."2.00"
percentagePercentage discount."20%"

ValueType

ValueDescriptionExample
fixed_amountFixed discount amount."5.00"
percentagePercentage discount."15%"

Coupon Example

{
  "title": "新的优惠券",
  "code": "",
  "value": 11,
  "life_cycle_type": "survival",
  "starts_at": 1673335773,
  "ends_at": -1,
  "survival_time": 86400,
  "value_type": "percentage",
  "prerequisite": 0,
  "usage_limit": -1,
  "once_per_customer": 0,
  "target_selection": "all",
  "progress": "",
  "using_state": "",
  "entitled_area_list": [],
  "target_type": "line_item",
  "prerequisite_quantity_range": [
    {
      "greater_than_or_equal_to": "",
      "value": ""
    }
  ],
  "prerequisite_subtotal_range": [
    {
      "greater_than_or_equal_to": "",
      "value": ""
    }
  ],
  "entitled_product_ids": [],
  "entitled_variant_ids": [],
  "entitled_sort": [],
  "times_used": 0,
  "stock": -1,
  "sort": {
    "by": "sales",
    "direction": "desc"
  },
  "use_with_other": 0,
  "prerequisite_customer_ids": [],
  "prerequisite_customer_segment_ids": [],
  "config": {
    "banner_url": "",
    "banner_size": "fill",
    "count_down": {
      "show_count_down": true,
      "format": "HH:mm:ss:SSS",
      "background_color_start": "rgba(255, 248, 232, 1)",
      "background_color_end": "rgba(255, 230, 172, 1)",
      "color": "rgba(249, 103, 69, 1)",
      "count_down_background_color": "rgba(249, 103, 69, 1)",
      "count_down_color": "rgba(255, 255, 255, 1)",
      "detail_page_show_code": false
    }
  },
  "store_id": 180543,
  "status": 0,
  "discount_type": "percentage",
  "is_admin_show": 0,
  "allocation_limit_amount": "0",
  "allocation_method": "",
  "allocation_limit": 0,
  "customer_selection": "",
  "entitled_collection_ids": [],
  "tips": {
    "msg": "",
    "countdown": "",
    "countdown_day": "",
    "use_code": "",
    "copy_code": ""
  },
  "entitled_extra_list": null,
  "prerequisite_customer_range": null,
  "buysPrerequisiteValue": 0,
  "getsMaxOrderUseValue": 0,
  "getsDiscountValue": 0,
  "only_valid_first_order_customer": false
}