> 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 # QueryLoyaltyCheckoutDiscounts # Package: rewards # Namespace: LoyaltyCheckoutExchange # Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/rewards/checkout-discount/query-loyalty-checkout-discounts.md ## Permission Scopes: Manage Loyalty: SCOPE.DC-LOYALTY.MANAGE-LOYALTY ## Introduction Retrieves a list of loyalty checkout discounts, with the specified paging, filtering, and sorting. Query Loyalty Checkout Discounts runs with these defaults, which you can override: - `"createdDate"` is sorted in `"DESC"` order. - `"paging.limit"` is `50`. To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/docs/rest/articles/get-started/api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/rest/articles/get-started/field-projection.md). --- ## REST API ### Schema ``` Method: queryLoyaltyCheckoutDiscounts Description: Retrieves a list of loyalty checkout discounts, with the specified paging, filtering, and sorting. Query Loyalty Checkout Discounts runs with these defaults, which you can override: - `"createdDate"` is sorted in `"DESC"` order. - `"paging.limit"` is `50`. To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/docs/rest/articles/get-started/api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/rest/articles/get-started/field-projection.md). URL: https://www.wixapis.com/v1/loyalty-checkout-discounts/query Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: query Method parameters: param name: query | type: CursorQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging). - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters). - name: sort | type: array | description: Sort object. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting). - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: QueryLoyaltyCheckoutDiscountsResponse - name: loyaltyCheckoutDiscounts | type: array | description: List of loyalty checkout discounts matching the query. - ONE-OF: - name: rewardId | type: string | description: GUID of the loyalty reward used for this discount. - name: loyaltyCouponId | type: string | description: GUID of the loyalty coupon used for this discount. - name: referralRewardId | type: string | description: GUID of the referral reward used for this discount. - name: id | type: string | description: Loyalty checkout discount GUID. - name: checkoutId | type: string | description: GUID of the checkout this discount is applied to. - name: status | type: DiscountStatus | description: Current status of the discount. - enum: - UNKNOWN: Status is unknown or not specified. - APPLIED: Discount has been applied to the checkout. - IN_PROGRESS: Discount application is in progress. - COMPLETED: Discount has been successfully completed. - REFUNDED: Discount has been refunded. - FAILED_TO_REFUND: Attempt to refund the discount failed. - REFUNDED_DUE_TO_TIMEOUT: Discount was refunded due to a timeout. - REFUNDED_DUE_TO_MANUAL_DISCOUNT_REMOVAL: Discount was refunded due to manual removal. - SCHEDULED_FOR_REFUND: Discount is scheduled for refund. - UNUSED: Discount wasn't used. - name: discountType | type: DiscountType | description: The type of discount applied. - enum: - UNKNOWN: Discount type is unknown or not specified. - DISCOUNT_AMOUNT: A discount from a flexible reward. - LOYALTY_COUPON: A discount from a redeemed loyalty program coupon. - COUPON_REWARD: A discount from a coupon reward that hasn't yet been redeemed. - REFERRAL_REWARD: A discount from a referral reward. - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata for the response. - name: count | type: integer | description: Number of items returned in current page. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### Query Loyalty Checkout Discounts ```curl curl -X POST \ 'https://www.wixapis.com/loyalty-checkout-exchange/v1/loyalty-checkout-discount' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "query": {} }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.rewards.LoyaltyCheckoutExchange.queryLoyaltyCheckoutDiscounts(query) Description: Retrieves a list of loyalty checkout discounts, with the specified paging, filtering, and sorting. Query Loyalty Checkout Discounts runs with these defaults, which you can override: - `"createdDate"` is sorted in `"DESC"` order. - `"paging.limit"` is `50`. To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/docs/rest/articles/get-started/api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/rest/articles/get-started/field-projection.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: query Method parameters: param name: query | type: LoyaltyCheckoutDiscountQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging). - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters). - name: sort | type: array | description: Sort object. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting). - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: PROMISE - name: loyaltyCheckoutDiscounts | type: array | description: List of loyalty checkout discounts matching the query. - ONE-OF: - name: rewardId | type: string | description: GUID of the loyalty reward used for this discount. - name: loyaltyCouponId | type: string | description: GUID of the loyalty coupon used for this discount. - name: referralRewardId | type: string | description: GUID of the referral reward used for this discount. - name: _id | type: string | description: Loyalty checkout discount GUID. - name: checkoutId | type: string | description: GUID of the checkout this discount is applied to. - name: status | type: DiscountStatus | description: Current status of the discount. - enum: - UNKNOWN: Status is unknown or not specified. - APPLIED: Discount has been applied to the checkout. - IN_PROGRESS: Discount application is in progress. - COMPLETED: Discount has been successfully completed. - REFUNDED: Discount has been refunded. - FAILED_TO_REFUND: Attempt to refund the discount failed. - REFUNDED_DUE_TO_TIMEOUT: Discount was refunded due to a timeout. - REFUNDED_DUE_TO_MANUAL_DISCOUNT_REMOVAL: Discount was refunded due to manual removal. - SCHEDULED_FOR_REFUND: Discount is scheduled for refund. - UNUSED: Discount wasn't used. - name: discountType | type: DiscountType | description: The type of discount applied. - enum: - UNKNOWN: Discount type is unknown or not specified. - DISCOUNT_AMOUNT: A discount from a flexible reward. - LOYALTY_COUPON: A discount from a redeemed loyalty program coupon. - COUPON_REWARD: A discount from a coupon reward that hasn't yet been redeemed. - REFERRAL_REWARD: A discount from a referral reward. - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata for the response. - name: count | type: integer | description: Number of items returned in current page. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### queryLoyaltyCheckoutDiscounts ```javascript import { checkoutExchange } from '@wix/loyalty'; async function queryLoyaltyCheckoutDiscounts(query) { const response = await checkoutExchange.queryLoyaltyCheckoutDiscounts(query); }; ``` ### queryLoyaltyCheckoutDiscounts (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 { checkoutExchange } from '@wix/loyalty'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { checkoutExchange }, // Include the auth strategy and host as relevant }); async function queryLoyaltyCheckoutDiscounts(query) { const response = await myWixClient.checkoutExchange.queryLoyaltyCheckoutDiscounts(query); }; ``` ---