> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: onCouponCreated(event: CouponEvent) # Method package: wixMarketingBackend # Method menu location: wixMarketingBackend --> Events --> onCouponCreated # Method Link: https://dev.wix.com/docs/velo/apis/wix-marketing-backend/events/on-coupon-created.md # Method Description: An event that is triggered when a coupon is created. The `onCouponCreated()` event handler runs when a new coupon is created. > **Note:** Backend events don't work when previewing your site. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## An event when a coupon is created ```javascript // Place this code in the events.js file // of your site's Backend section. export function wixMarketing_onCouponCreated(event) { const newCouponId = event.entity._id; const newCouponType = event.entity.type; const couponValidFrom = event.entity.startTime; } /* Full event object * * { * "metadata": { * "id": "c4ea2c0a-0952-48ad-9b15-39e660448663", * "entityId": "03a35393-7835-44b0-af53-6019a484b48b", * "eventTime": "2021-01-17T11:40:56.795047Z", * "triggeredByAnonymizeRequest": false * }, * "entity": { * "_id": "03a35393-7835-44b0-af53-6019a484b48b", * "name": "Summer Sale 10% off", * "code": "SummerSale", * "startTime": "Wed Jun 30 2021 21:00:00 GMT+0000 (Coordinated Universal Time)", * "expirationTime": "Tue Aug 31 2021 20:59:59 GMT+0000 (Coordinated Universal Time)", * "limitPerCustomer": 1, * "active": true, * "scope": { * "namespace": "stores" * }, * "_dateCreated": "Sun Jan 17 2021 11:40:56 GMT+0000 (Coordinated Universal Time)", * "expired": false, * "displayData": null, * "limitedToOneItem": true, * "type": "PercentOff", * "percentOffRate": 10 * } * } * */ ``` ---