onCouponCreated
Purpose
Triggered when a new coupon is created for a shop. Use this hook to log coupon creation and track promotional activity.
When It Triggers
Owner or authorized employee creates a new coupon
Coupon is saved to the database
Parameters
data.source
number
Server ID of creator
data.shopId
string
Unique shop identifier
data.shopName
string
Display name of the shop
data.couponCode
string
The coupon code
data.discount
number
Discount percentage
data.description
string
Coupon description
data.isActive
boolean
Whether coupon is active
data.startsAt
string
Start date/time
data.expiresAt
string
Expiry date/time
data.maxUses
number
Maximum total uses (0 = unlimited)
data.maxUsesPerPerson
number
Max uses per customer (0 = unlimited)
data.minPurchaseAmount
number
Minimum cart total required
data.maxDiscountAmount
number
Maximum discount cap
data.applicableProducts
table
Array of applicable item names (empty = all)
data.applicableCategories
table
Array of applicable categories (empty = all)
data.restrictions
table
Access restrictions
data.restrictions.type
string
'none', 'identifier', 'job', 'gang', 'combined'
data.restrictions.identifier
string
Specific identifier (if type = 'identifier')
data.restrictions.jobs
table
Array of job names
data.restrictions.gangs
table
Array of gang names
data.createdBy
string
Name of creator
data.createdByIdentifier
string
Identifier of creator
data.timestamp
number
Server timestamp
Example
Last updated