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.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
_id | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() ,ascending() ,descending() |
accountId | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() ,ascending() ,descending() |
amount | eq() ,ne() ,exists() ,in() ,hasSome() ,lt() ,le() ,gt() ,ge() ,ascending() ,descending() |
transactionType | eq() ,ne() ,exists() ,in() ,hasSome() ,ascending() ,descending() |
description | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() ,ascending() ,descending() |
idempotencyKey | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() ,ascending() ,descending() |
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function queryLoyaltyTransactions(): LoyaltyTransactionsQueryBuilder;
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
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.