Dynamic Coupon

Dynamic Coupon Schema

Data Model

The dynamic coupon schema defines the structure of a coupon that can be dynamically generated by the system. The schema includes the following fields:

AttributeTypeDescription
couponCodeStringA unique code for the coupon.
customerIdStringThe customer ID associated with the coupon.
creationDateStringThe date on which the coupon was created.
expiryDateStringThe date on which the coupon expires.
discountTypeStringThe type of discount offered by the coupon (e.g., percentage, fixed amount).
discountNumberThe value of the discount offered by the coupon.
discountPectNumberThe percentage of discount offered by the coupon.
discountItemNumberThe number of items that are eligible for the discount.
freeItemStringThe item that is eligible for a free offer.
skuIdsArrayAn array of SKU IDs that the coupon is applicable for.
conditionsArrayAn array of conditions that must be met to use the coupon.
campaignStringThe name of the campaign that the coupon belongs to.
titleStringThe title of the coupon.
descStringA description of the coupon.
enabledBooleanA flag indicating whether the coupon is enabled or disabled.
redeemedBooleanA flag indicating whether the coupon has been redeemed or not.
formatStringThe format of the coupon code.
timestampsObjectA flag that indicates whether to include timestamp fields (createdAt, updatedAt) in the schema.

Example

{
  couponCode: "ABC123",
  customerId: "123456",
  creationDate: "2023-03-11",
  expiryDate: "2023-04-11",
  discountType: "percentage",
  discount: 20,
  discountPect: 0,
  discountItem: 0,
  freeItem: "",
  skuIds: ["sku123", "sku456"],
  conditions: [{parameter:"payment.amount", compare:"greater", value:"1000"],
  campaign: "MarchPromotion",
  title: "Get 20% off on your order",
  desc: "Use coupon code ABC123 to get a discount of 20% on your order",
  enabled: true,
  redeemed: false,
  format: "COUPON-$*$",
  createdAt: "2023-03-11T09:22:00.000Z",
  updatedAt: "2023-03-11T09:22:00.000Z"
}

Summary

In this example, the coupon offers a discount of 20% on orders containing SKUs sku123 and sku456. The coupon can only be used if the order value is equal to or greater than 1000. The coupon code is ABC123, and it is valid from March 11, 2023, to April 11, 2023. The coupon belongs to the MarchPromotion campaign, and the title and description provide information on how to use the coupon. The coupon is currently enabled and has not yet been redeemed.