> 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: getLoyaltyCoupon(loyaltyCouponId: string) # Method package: wixLoyaltyV2 # Method menu location: wixLoyaltyV2 --> coupons --> getLoyaltyCoupon # Method Link: https://dev.wix.com/docs/velo/apis/wix-loyalty-v2/coupons/get-loyalty-coupon.md # Method Description: Retrieves a loyalty coupon. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Get loyalty coupon ```javascript import { coupons } from "wix-loyalty.v2"; import { webMethod, Permissions } from "wix-web-module"; import { elevate } from "wix-auth"; /* Sample loyaltyCouponId value: * * { * "loyaltyCouponId": "6fb2cdc0-863f-4b4b-b76d-a73608654aee" * } */ const elevatedGetLoyaltyCoupon = elevate(coupons.getLoyaltyCoupon); export const getLoyaltyCoupon = webMethod( Permissions.Anyone, async (loyaltyCouponId) => { try { const result = await elevatedGetLoyaltyCoupon(loyaltyCouponId); return result; } catch (error) { console.error(error); // Handle the error } }, ); /* Promise resolves to: * { * "_createdDate": "2024-06-12T08:14:16.884Z", * "_id": "6fb2cdc0-863f-4b4b-b76d-a73608654aee", * "_updatedDate": "2024-06-12T08:14:17.403Z", * "accountId": "d0dc5ba3-4a10-4cfc-b304-c976d8ac7303", * "couponReference": { * "code": "6QLGLVTGVH8A", * "couponId": "27d5d44d-eb61-4533-8f72-01177097e470", * "name": "10% off all events", * "specification": { * "type": "PERCENT_OFF_RATE", * "percentOffRate": 10, * "scope": { * "name": "ticket", * "namespace": "events" * }, * "limitedToOneItem": false * } * }, * "memberId": "7d368843-6f0c-4037-8d0e-b7e36a8a0c32", * "memberIdDeprecated": "7d368843-6f0c-4037-8d0e-b7e36a8a0c32", * "revision": "2", * "rewardName": "10% off all events", * "status": "ACTIVE", * "transactionId": "0b24afeb-2964-4bb2-a5ab-b32e04128c20" * } */ ``` ## Get loyalty coupon (dashboard page code) ```javascript import { coupons } from "wix-loyalty.v2"; /* Sample loyaltyCouponId value: * * { * "loyaltyCouponId": "6fb2cdc0-863f-4b4b-b76d-a73608654aee" * } */ async function getLoyaltyCoupon(loyaltyCouponId) { try { const result = await coupons.getLoyaltyCoupon(loyaltyCouponId); return result; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "_createdDate": "2024-06-12T08:14:16.884Z", * "_id": "6fb2cdc0-863f-4b4b-b76d-a73608654aee", * "_updatedDate": "2024-06-12T08:14:17.403Z", * "accountId": "d0dc5ba3-4a10-4cfc-b304-c976d8ac7303", * "couponReference": { * "code": "6QLGLVTGVH8A", * "couponId": "27d5d44d-eb61-4533-8f72-01177097e470", * "name": "10% off all events", * "specification": { * "type": "PERCENT_OFF_RATE", * "percentOffRate": 10, * "scope": { * "name": "ticket", * "namespace": "events" * }, * "limitedToOneItem": false * } * }, * "memberId": "7d368843-6f0c-4037-8d0e-b7e36a8a0c32", * "memberIdDeprecated": "7d368843-6f0c-4037-8d0e-b7e36a8a0c32", * "revision": "2", * "rewardName": "10% off all events", * "status": "ACTIVE", * "transactionId": "0b24afeb-2964-4bb2-a5ab-b32e04128c20" * } */ ``` ---