> 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 # 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. - 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 the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section). - name: sort | type: array | 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). - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: QueryGiftCardTransactionsResponse - name: transactions | type: array | description: The retrieved transactions matching the query criteria, ordered by creation date. - name: id | type: string | description: Transaction GUID. - name: createdDate | type: string | description: Date and time the transaction was created. - name: type | type: TransactionType | description: Type of transaction indicating the reason for the balance change. - 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. - name: amount | type: Amount | description: Monetary amount of the transaction. Positive values represent credits, negative values represent debits. - 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. - name: formattedAmount | type: string | description: Amount formatted with currency symbol for display purposes. For example: `"$10.50"` or `"€25.00"`. - name: updatedBalance | type: Amount | description: Gift card balance after this transaction was applied. - name: operationType | type: OperationType | description: Whether the transaction adds to or subtracts from the gift card balance. - 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. - name: orderNumber | type: string | description: Human-readable order number displayed to customers. For example, `"1001"`. - 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. - 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 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: ' \ -H 'Content-Type: application/json' \ -d '{ "query": { "sort": [ { "fieldName": "createdDate", "order":"DESC", } ] } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.giftCards.TransactionQueryService.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: options | type: QueryGiftCardTransactionsOptions none | required: true - name: giftCardId | type: string | description: Gift card GUID to retrieve transactions for. | required: true 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. - 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 the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#the-filter-section). - name: sort | type: array | 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). - 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: transactions | type: array | description: The retrieved transactions matching the query criteria, ordered by creation date. - name: _id | type: string | description: Transaction GUID. - name: _createdDate | type: Date | description: Date and time the transaction was created. - name: type | type: TransactionType | description: Type of transaction indicating the reason for the balance change. - 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. - name: amount | type: Amount | description: Monetary amount of the transaction. Positive values represent credits, negative values represent debits. - 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. - name: formattedAmount | type: string | description: Amount formatted with currency symbol for display purposes. For example: `"$10.50"` or `"€25.00"`. - name: updatedBalance | type: Amount | description: Gift card balance after this transaction was applied. - name: operationType | type: OperationType | description: Whether the transaction adds to or subtracts from the gift card balance. - 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. - name: orderNumber | type: string | description: Human-readable order number displayed to customers. For example, `"1001"`. - 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. - 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 ### 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-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 { 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); }; ``` ---