> 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 # Get # Package: coupons # Namespace: CouponsV2 # Method link: https://dev.wix.com/docs/api-reference/business-solutions/coupons/coupons/get-a-coupon.md ## Permission Scopes: Manage Coupons: SCOPE.DC-COUPONS.MANAGE-COUPONS ## Introduction Retrieves a coupon by ID. --- ## REST API ### Schema ``` Method: get Description: Retrieves a coupon by GUID. URL: https://www.wixapis.com/stores/v2/coupons/{id} Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: id Method parameters: param name: id | type: none | required: true Return type: GetCouponResponse - name: coupon | type: Coupon | description: Retrieved coupon. - name: id | type: string | description: Coupon GUID. - name: specification | type: Specification | description: Basic coupon info. - ONE-OF: - name: scope | type: Scope | description: Specifies the type of line items this coupon will apply to. See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values). - name: namespace | type: string | description: Scope namespace (Wix Stores, Wix Bookings, Wix Events, Wix Pricing Plans) - name: group | type: Group | description: Coupon scope's applied group (e.g., event or ticket in Wix Events) - name: name | type: string | description: Coupon scope's group (e.g., product or collection in Wix Stores). See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values). - name: entityId | type: string | description: Item GUID (when the coupon scope is limited to just one item). - name: minimumSubtotal | type: number | description: Limit the coupon to carts with a subtotal above this number. - ONE-OF: - name: moneyOffAmount | type: number | description: Discount as a fixed amount. - name: percentOffRate | type: number | description: Discount as a percentage. - name: freeShipping | type: boolean | description: Free shipping. If `true`, the coupon applies to all items in all `namespaces`. - name: fixedPriceAmount | type: number | description: Fixed sale price. - name: buyXGetY | type: BuyXGetY | description: Receive free products when making a purchase. For example, purchase `x` number of products and receive `y` number of products for free. - name: x | type: integer | description: Number of purchased items required to receive free items. - name: y | type: integer | description: Number of items received for free if required number of items were purchased. - name: name | type: string | description: Name of coupon. - name: code | type: string | description: Coupon code. Must be unique for all coupons on your site. Max: 20 characters - name: startTime | type: string | description: Coupon valid from this date and time, in milliseconds. For example, `"1554066000000"`. - name: expirationTime | type: string | description: Coupon expires at this date and time, in milliseconds. For example, `"1554325199999"`. - name: usageLimit | type: integer | description: Maximum number of times the coupon can be used. >**Note:** Multiple purchases by the same customer or purchases by different customers are both counted toward `usageLimit`. - name: limitPerCustomer | type: integer | description: Maximum number of times the coupon can be used per customer. - name: limitedToOneItem | type: boolean | description: Whether the coupon is limited to one item. If `true` and a customer pays for multiple items, the discount applies to only the lowest priced item. Coupons with a `bookings` `scope.namespace` are always limited to one item. - name: appliesToSubscriptions | type: boolean | description: Whether the coupon applies to subscription products. - name: discountedCycleCount | type: integer | description: Specifies the amount of discounted cycles for a subscription item. + Can only be set when `scope.namespace = pricingPlans`. + If `discountedCycleCount` is empty, the coupon applies to all available cycles. + `discountedCycleCount` is ignored if `appliesToSubscriptions = true`. Max: `999` - name: active | type: boolean | description: Whether the coupon is currently [active](https://support.wix.com/en/article/wix-stores-activating-and-deactivating-coupons). Default: `true` - name: type | type: string | description: Coupon type. Read-only. - name: tags | type: array | description: Tags for categorizing the coupon. - name: dateCreated | type: string | description: Time the coupon was created (UNIX Epoch time in milliseconds). - name: expired | type: boolean | description: Whether the coupon is expired. - name: numberOfUsages | type: integer | description: How many times this coupon has been used. - name: displayData | type: DisplayData | description: Coupon display information. - name: name | type: string | description: Coupon name to be displayed. - name: mediaItem | type: MediaItem | description: Displayed media item information. - name: url | type: string | description: Media item URL. - name: width | type: integer | description: Media item width. - name: height | type: integer | description: Media item height. - name: formattedPrice | type: string | description: Formatted price for display. - name: appId | type: string | description: GUID of the app that created the coupon. Empty if created by the site owner. ``` ### Examples ### Get coupon Get coupon by ID. ```curl curl -X GET \ 'https://www.wixapis.com/stores/v2/coupons/abeb638b-f9f4-4bb8-8fe7-2319504df6d9' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.coupons.CouponsV2.get(_id) Description: Retrieves a coupon by GUID. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: _id Method parameters: param name: _id | type: string | description: GUID of the coupon to retrieve. | required: true Return type: PROMISE - name: _id | type: string | description: Coupon GUID. - name: specification | type: Specification | description: Basic coupon info. - ONE-OF: - name: scope | type: Scope | description: Specifies the type of line items this coupon will apply to. See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values). - name: namespace | type: string | description: Scope namespace (Wix Stores, Wix Bookings, Wix Events, Wix Pricing Plans) - name: group | type: Group | description: Coupon scope's applied group (e.g., event or ticket in Wix Events) - name: name | type: string | description: Coupon scope's group (e.g., product or collection in Wix Stores). See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values). - name: entityId | type: string | description: Item GUID (when the coupon scope is limited to just one item). - name: minimumSubtotal | type: number | description: Limit the coupon to carts with a subtotal above this number. - ONE-OF: - name: moneyOffAmount | type: number | description: Discount as a fixed amount. - name: percentOffRate | type: number | description: Discount as a percentage. - name: freeShipping | type: boolean | description: Free shipping. If `true`, the coupon applies to all items in all `namespaces`. - name: fixedPriceAmount | type: number | description: Fixed sale price. - name: buyXGetY | type: BuyXGetY | description: Receive free products when making a purchase. For example, purchase `x` number of products and receive `y` number of products for free. - name: x | type: integer | description: Number of purchased items required to receive free items. - name: y | type: integer | description: Number of items received for free if required number of items were purchased. - name: name | type: string | description: Name of coupon. - name: code | type: string | description: Coupon code. Must be unique for all coupons on your site. Max: 20 characters - name: startTime | type: string | description: Coupon valid from this date and time, in milliseconds. For example, `"1554066000000"`. - name: expirationTime | type: string | description: Coupon expires at this date and time, in milliseconds. For example, `"1554325199999"`. - name: usageLimit | type: integer | description: Maximum number of times the coupon can be used. >**Note:** Multiple purchases by the same customer or purchases by different customers are both counted toward `usageLimit`. - name: limitPerCustomer | type: integer | description: Maximum number of times the coupon can be used per customer. - name: limitedToOneItem | type: boolean | description: Whether the coupon is limited to one item. If `true` and a customer pays for multiple items, the discount applies to only the lowest priced item. Coupons with a `bookings` `scope.namespace` are always limited to one item. - name: appliesToSubscriptions | type: boolean | description: Whether the coupon applies to subscription products. - name: discountedCycleCount | type: integer | description: Specifies the amount of discounted cycles for a subscription item. + Can only be set when `scope.namespace = pricingPlans`. + If `discountedCycleCount` is empty, the coupon applies to all available cycles. + `discountedCycleCount` is ignored if `appliesToSubscriptions = true`. Max: `999` - name: active | type: boolean | description: Whether the coupon is currently [active](https://support.wix.com/en/article/wix-stores-activating-and-deactivating-coupons). Default: `true` - name: type | type: string | description: Coupon type. Read-only. - name: tags | type: array | description: Tags for categorizing the coupon. - name: dateCreated | type: string | description: Time the coupon was created (UNIX Epoch time in milliseconds). - name: expired | type: boolean | description: Whether the coupon is expired. - name: numberOfUsages | type: integer | description: How many times this coupon has been used. - name: displayData | type: DisplayData | description: Coupon display information. - name: name | type: string | description: Coupon name to be displayed. - name: mediaItem | type: MediaItem | description: Displayed media item information. - name: url | type: string | description: Media item URL. - name: width | type: integer | description: Media item width. - name: height | type: integer | description: Media item height. - name: formattedPrice | type: string | description: Formatted price for display. - name: appId | type: string | description: GUID of the app that created the coupon. Empty if created by the site owner. ``` ### Examples ### getCoupon ```javascript import { coupons } from '@wix/marketing'; async function getCoupon(_id) { const response = await coupons.getCoupon(_id); }; ``` ### getCoupon (with elevated permissions) ```javascript import { coupons } from '@wix/marketing'; import { auth } from '@wix/essentials'; async function myGetCouponMethod(_id) { const elevatedGetCoupon = auth.elevate(coupons.getCoupon); const response = await elevatedGetCoupon(_id); } ``` ### getCoupon (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { coupons } from '@wix/marketing'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { coupons }, // Include the auth strategy and host as relevant }); async function getCoupon(_id) { const response = await myWixClient.coupons.getCoupon(_id); }; ``` ---