AlmondTill/G3N API

Coupon

object type

A Coupon — the CODE-GATED entry to the discount engines: a normalized code (trim+UPPERCASE, stored normalized-only, IMMUTABLE at birth — re-code = a new coupon) that either UNLOCKS a couponGated Promotion (trigger flavor — the reduction is source=promo at position 3) or CARRIES its own simple effect (discount flavor — source=coupon at position 2, BEFORE promotions). Attach to an OPEN order via applyOrderCoupon (HARD 1 coupon/order — the strict default); redemption counts per ORDER in the place transaction — a capped-out coupon refuses CONFLICT/COUPON_EXHAUSTED. NAMED deferrals: CouponBatch (unique single-use child codes) · per-customer caps.

Fields

FieldTypeNotes
idID ID!The record’s id — a UUID the platform assigned when the record was created; every reference to this record uses it.
sysIdString String!The group-scoped human-facing system id (CP-…).
typeString String!The kind of record — always Coupon here.
captionString String!The record’s display name — what people see it called.
statusString String!The FSM state: active | inactive | doomed.
parentIdID ID!The parent org group; for a Coupon parentId === rootId.
rootIdID ID!The org-group family root.
createdAtString String!When the record was created, as a UTC timestamp.
updatedAtString String!When the record last changed, as a UTC timestamp.
revisionNumInt Int!How many times this record has been edited; the first save is 0.
revisionID ID!The OCC revision token — supply it on every mutation of this record; rotates on every write.
refCaptionsRefCaption [RefCaption!]!The server-composed captions of this record's declared references (the referenced-caption rule) — one row per referenced id; see RefCaption.
flavorCouponFlavor CouponFlavor!The canned flavor (SPEC_REGISTRY row 106) — IMMUTABLE at birth.
codeString String!No further notes.
promotionIdIDtrigger flavor ONLY: the unlocked couponGated Promotion (same-tenant + ACTIVE at create) — IMMUTABLE (re-point = a new coupon).
effectCouponEffectdiscount flavor ONLY: the carried effect — wholesale-replace on edit (refused on trigger, the cross-flavor gate).
startAtString String!The half-open window start (kit-stamped NOW when omitted at create).
endAtStringThe half-open window end — ABSENT = evergreen; out-of-window redemption refuses CONFLICT/COUPON_EXPIRED.
totalUsesCapIntTotal-use cap.

Used by