> 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

# QueryGiftCardTransactions

# Package: giftCards

# Namespace: TransactionQueryService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/transactions/query-gift-card-transactions.md

## Permission Scopes:
Manage eCommerce - all permissions: SCOPE.DC-ECOM-MEGA.MANAGE-ECOM

## Introduction

Retrieves the transaction history for a specific gift card with filtering, sorting, and paging options.

Use this method to implement transaction history displays, generate audit reports,
or investigate gift card balance changes. Transactions are automatically created
for all gift card activities including redemptions, refunds, and manual adjustments.

To learn about working with _Query_ endpoints, see
[API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md),
and [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md).

---

## REST API

### Schema

```
 Method: queryGiftCardTransactions
 Description: Retrieves the transaction history for a specific gift card with filtering, sorting, and paging options.  Use this method to implement transaction history displays, generate audit reports, or investigate gift card balance changes. Transactions are automatically created for all gift card activities including redemptions, refunds, and manual adjustments.  To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), and [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md).
 URL: https://www.wixapis.com/gift-cards/v1/gift-cards/{giftCardId}/transactions/query
 Method: POST
 Method parameters:
   param name: query | type: CursorQuery    
     - 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 the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section).  
        - name: sort | type: array<Sorting> | description: Sort object.  Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-sort-section).  | 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
 Query fields:
   - field: id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: type | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: createdDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: operationType | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: QueryGiftCardTransactionsResponse
  - name: transactions | type: array<Transaction> | description: The retrieved transactions matching the query criteria, ordered by creation date.  
     - name: id | type: string | description: Transaction GUID.  | read-only: true | validation: format GUID
     - name: createdDate | type: string | description: Date and time the transaction was created.  | read-only: true | validation: format date-time
     - name: type | type: TransactionType | description: Type of transaction indicating the reason for the balance change.  | read-only: true 
         - enum:
         -     REDEEM: Gift card was used to pay for a purchase.
         -     VOID: Previous redemption was cancelled, restoring the gift card balance.
         -     INITIAL: Initial value was assigned when the gift card was created.
         -     PAYMENT_METHOD_REFUND: Refund was processed, adding value back to the gift card.
         -     MANUAL: Manual adjustment.
     - name: giftCardId | type: string | description: Gift card GUID associated with this transaction.  | read-only: true | validation: format GUID
     - name: amount | type: Amount | description: Monetary amount of the transaction. Positive values represent credits, negative values represent debits.  | read-only: true 
        - name: amount | type: string | description: Monetary amount in the specified currency as a decimal string. For example, `"10.50"` for $10.50, or `"100"` for $100.00.  | validation: format DECIMAL_VALUE, decimalValue {"gte":"0","maxScale":2}
        - name: formattedAmount | type: string | description: Amount formatted with currency symbol for display purposes. For example: `"$10.50"` or `"€25.00"`.  | read-only: true | validation: maxLength 20
     - name: updatedBalance | type: Amount | description: Gift card balance after this transaction was applied.  | read-only: true 
     - name: operationType | type: OperationType | description: Whether the transaction adds to or subtracts from the gift card balance.  | read-only: true 
         - enum:
         -     ADD: Transaction adds value to the gift card balance.
         -     SUBTRACT: Transaction subtracts value from the gift card balance.
     - name: orderInfo | type: OrderInfo | description: Order details when the transaction is related to an eCommerce purchase or refund.  
        - name: orderId | type: string | description: Order GUID associated with the gift card purchase.  | validation: format GUID, immutable
        - name: orderNumber | type: string | description: Human-readable order number displayed to customers. For example, `"1001"`.  | validation: maxLength 100, format DECIMAL_VALUE, immutable, decimalValue {"gt":"0","maxScale":0}
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging information for navigating through large transaction histories.  
     - name: count | type: integer | description: Number of items returned in the response.  | 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 Gift Card Transactions
Queries existing gift card transactions sorted by created date in descending order

```curl
curl -X POST \
  'https://www.wixapis.com/gift-cards/v1/gift-cards/4923b8be-fdcb-4f35-ad69-2e6508cba5b6/transactions/query' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": {
      "sort": [
        {
          "fieldName": "createdDate",
          "order":"DESC"
        }
      ]
    }
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.giftVouchers.transactions.queryGiftCardTransactions(query, options)
 Description: Retrieves the transaction history for a specific gift card with filtering, sorting, and paging options.  Use this method to implement transaction history displays, generate audit reports, or investigate gift card balance changes. Transactions are automatically created for all gift card activities including redemptions, refunds, and manual adjustments.  To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), and [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  options.giftCardId, query, options
 Method parameters: 
   param name: query | type: TransactionQuery   | 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 the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section).  
        - name: sort | type: array<Sorting> | description: Sort object.  Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-sort-section).  | 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
   param name: options | type: QueryGiftCardTransactionsOptions  none | required: true 
        - name: giftCardId | type: string | description: Gift card GUID to retrieve transactions for. | required: true | validation: format GUID
 Query fields:
   - field: _id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: type | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: _createdDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: operationType | operators: $eq, $ne, $in, $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QueryGiftCardTransactionsResponse>
  - name: transactions | type: array<Transaction> | description: The retrieved transactions matching the query criteria, ordered by creation date.  
     - name: _id | type: string | description: Transaction GUID.  | read-only: true | validation: format GUID
     - name: _createdDate | type: Date | description: Date and time the transaction was created.  | read-only: true 
     - name: type | type: TransactionType | description: Type of transaction indicating the reason for the balance change.  | read-only: true 
         - enum:
         -     REDEEM: Gift card was used to pay for a purchase.
         -     VOID: Previous redemption was cancelled, restoring the gift card balance.
         -     INITIAL: Initial value was assigned when the gift card was created.
         -     PAYMENT_METHOD_REFUND: Refund was processed, adding value back to the gift card.
         -     MANUAL: Manual adjustment.
     - name: giftCardId | type: string | description: Gift card GUID associated with this transaction.  | read-only: true | validation: format GUID
     - name: amount | type: Amount | description: Monetary amount of the transaction. Positive values represent credits, negative values represent debits.  | read-only: true 
        - name: amount | type: string | description: Monetary amount in the specified currency as a decimal string. For example, `"10.50"` for $10.50, or `"100"` for $100.00.  | validation: format DECIMAL_VALUE, decimalValue {"gte":"0","maxScale":2}
        - name: formattedAmount | type: string | description: Amount formatted with currency symbol for display purposes. For example: `"$10.50"` or `"€25.00"`.  | read-only: true | validation: maxLength 20
     - name: updatedBalance | type: Amount | description: Gift card balance after this transaction was applied.  | read-only: true 
     - name: operationType | type: OperationType | description: Whether the transaction adds to or subtracts from the gift card balance.  | read-only: true 
         - enum:
         -     ADD: Transaction adds value to the gift card balance.
         -     SUBTRACT: Transaction subtracts value from the gift card balance.
     - name: orderInfo | type: OrderInfo | description: Order details when the transaction is related to an eCommerce purchase or refund.  
        - name: orderId | type: string | description: Order GUID associated with the gift card purchase.  | validation: format GUID, immutable
        - name: orderNumber | type: string | description: Human-readable order number displayed to customers. For example, `"1001"`.  | validation: maxLength 100, format DECIMAL_VALUE, immutable, decimalValue {"gt":"0","maxScale":0}
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging information for navigating through large transaction histories.  
     - name: count | type: integer | description: Number of items returned in the response.  | 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

### queryGiftCardTransactions
```javascript
import { transactions } from '@wix/gift-vouchers';

async function queryGiftCardTransactions(query,options) {
  const response = await transactions.queryGiftCardTransactions(query,options);
};
```

### queryGiftCardTransactions (with elevated permissions)
```javascript
import { transactions } from '@wix/gift-vouchers';
import { auth } from '@wix/essentials';

async function myQueryGiftCardTransactionsMethod(query,options) {
  const elevatedQueryGiftCardTransactions = auth.elevate(transactions.queryGiftCardTransactions);
  const response = await elevatedQueryGiftCardTransactions(query,options);
}
```

### queryGiftCardTransactions (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 { transactions } from '@wix/gift-vouchers';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { transactions },
  // Include the auth strategy and host as relevant
});


async function queryGiftCardTransactions(query,options) {
  const response = await myWixClient.transactions.queryGiftCardTransactions(query,options);
};
```

---