> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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?apiView=SDK.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/loyalty-checkout-exchange/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.  | validation: minimum 0, maximum 100, format int32
        - 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.  | validation: maxLength 16000
        - 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<Sorting> | description: Sort object.  Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting).  | validation: maxItems 5
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
           - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
              - name: latitude | type: number | description: Address latitude.  | validation: format double
              - name: longitude | type: number | description: Address longitude.  | validation: format double
 Query fields:
   - field: checkoutId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: status | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: QueryLoyaltyCheckoutDiscountsResponse
  - name: loyaltyCheckoutDiscounts | type: array<LoyaltyCheckoutDiscount> | 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.  | validation: format GUID
        - name: loyaltyCouponId | type: string | description: GUID of the loyalty coupon used for this discount.  | validation: format GUID
        - name: referralRewardId | type: string | description: GUID of the referral reward used for this discount.  | validation: format GUID
     - name: id | type: string | description: Loyalty checkout discount GUID.  | read-only: true | validation: format GUID
     - name: checkoutId | type: string | description: GUID of the checkout this discount is applied to.  | validation: format GUID
     - name: status | type: DiscountStatus | description: Current status of the discount.  | read-only: true 
         - 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.  | read-only: true 
         - 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.  | validation: format int32
     - 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.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - 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: <AUTH>' \
  -H 'Content-Type: application/json' \
  -d '{
        "query": {}
    }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.loyalty.checkoutExchange.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.  | validation: minimum 0, maximum 100, format int32
        - 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.  | validation: maxLength 16000
        - 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<Sorting> | description: Sort object.  Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting).  | validation: maxItems 5
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
           - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
              - name: latitude | type: number | description: Address latitude.  
              - name: longitude | type: number | description: Address longitude.  
 Query fields:
   - field: checkoutId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: status | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QueryLoyaltyCheckoutDiscountsResponse>
  - name: loyaltyCheckoutDiscounts | type: array<LoyaltyCheckoutDiscount> | 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.  | validation: format GUID
        - name: loyaltyCouponId | type: string | description: GUID of the loyalty coupon used for this discount.  | validation: format GUID
        - name: referralRewardId | type: string | description: GUID of the referral reward used for this discount.  | validation: format GUID
     - name: _id | type: string | description: Loyalty checkout discount GUID.  | read-only: true | validation: format GUID
     - name: checkoutId | type: string | description: GUID of the checkout this discount is applied to.  | validation: format GUID
     - name: status | type: DiscountStatus | description: Current status of the discount.  | read-only: true 
         - 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.  | read-only: true 
         - 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.  | validation: format int32
     - 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.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - 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-managed)
Self-managed 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);
};
```

---