queryLoyaltyTransactions( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a list of loyalty transactions, given the provided paging, filtering, and sorting.

Supported fields for filtering and sorting: id, accountId, idempotencyKey, transactionType, amount, description

To learn how to query Loyalty Transactions, see API Query Language.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
accountIdeq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
amounteq(),ne(),exists(),in(),hasSome(),lt(),le(),gt(),ge(),ascending(),descending()
transactionTypeeq(),ne(),exists(),in(),hasSome(),ascending(),descending()
descriptioneq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
idempotencyKeyeq(),ne(),exists(),in(),hasSome(),startsWith(),ascending(),descending()
Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Loyalty
Read Loyalty
Learn more about app permissions.
Method Declaration
Copy
function queryLoyaltyTransactions(): LoyaltyTransactionsQueryBuilder;
Request
This method does not take any parameters
JavaScript
import { transactions } from "wix-loyalty.v2"; import { webMethod, Permissions } from "wix-web-module"; import { elevate } from "wix-auth"; const elevatedQueryLoyaltyTransactions = elevate( transactions.queryLoyaltyTransactions, ); export const queryLoyaltyTransactions = webMethod( Permissions.Anyone, async () => { try { const { items } = await elevatedQueryLoyaltyTransactions().find(); return items; } catch (error) { console.error(error); // Handle the error } }, ); /* Promise resolves to: * * { * "_createdDate": "2024-06-10T14:55:26.916Z", * "_id": "1d0d1159-f578-4f37-98df-f988fa728ff9", * "accountId": "ec8a038b-aefb-4bed-bd15-635906cc6a60", * "transactionType": "ADJUST", * "amount": -70, * "description": "", * "idempotencyKey": "1d0d1159-f578-4f37-98df-f988fa728ff9", * "adjustInfo": { * "appId": "553c79f3-5625-4f38-b14b-ef7c0d1e87df", * "amountBefore": 70, * "amountAfter": 0 * } * }, * { * "_createdDate": "2024-06-10T15:27:31.073Z", * "_id": "318563e8-ebca-4531-b284-27cec8807b5e", * "accountId": "d0dc5ba3-4a10-4cfc-b304-c976d8ac7303", * "transactionType": "ADJUST", * "amount": 50, * "description": "", * "idempotencyKey": "318563e8-ebca-4531-b284-27cec8807b5e", * "adjustInfo": { * "appId": "553c79f3-5625-4f38-b14b-ef7c0d1e87df", * "amountBefore": 0, * "amountAfter": 50 * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?