Returns Tiers
and ProgramSettings
in a single response.
If TiersProgramSettings
doesn't exist, default TiersProgramSettings
are created.
function getTiersProgram(): Promise<GetTiersProgramResponse>;
import { tiers } from "wix-loyalty.v2";
import { webMethod, Permissions } from "wix-web-module";
export const getTiersProgram = webMethod(Permissions.Anyone, async () => {
try {
const result = await tiers.getTiersProgram();
return result;
} catch (error) {
console.error(error);
// Handle the error
}
});
/* Promise resolves to:
*
* {
* "programSettings": {
* "_createdDate": "2024-06-05T20:27:19.147Z",
* "_updatedDate": "2024-06-06T10:30:05.261Z",
* "baseTierDefinition": {
* "icon": "shapes/11062b_0a8e17936d5b4d46971649be036c781b.svg",
* "name": "Basic",
* "description": ""
* },
* "revision": "2",
* "status": "ACTIVE",
* "rollingWindow": {
* "durationInMonths": 12
* }
* },
* "tiers": [
* {
* "_createdDate": "2024-06-06T10:33:19.121Z",
* "_id": "7e26e41b-3bb6-40c9-bb7e-855b9f4f69e2",
* "_updatedDate": "2024-06-11T12:17:05.000Z",
* "requiredPoints": 100,
* "revision": "6",
* "tierDefinition": {
* "icon": "shapes/11062b_667183149f4c40809fd860a1d7109296.svg",
* "name": "Silver Tier",
* "description": "Silver Tier Benefits"
* }
* },
* {
* "_createdDate": "2024-06-06T10:33:56.430Z",
* "_id": "b8501f07-a34f-4608-b9b0-168e6c6c505a",
* "_updatedDate": "2024-06-11T12:17:12.382Z",
* "requiredPoints": 200,
* "revision": "4",
* "tierDefinition": {
* "icon": "shapes/c0bec42304a6414990bfd882f637ac0a.svg",
* "name": "Gold",
* "description": "Gold Tier Benefits"
* }
* },
* {
* "_createdDate": "2024-06-11T12:14:14.809Z",
* "_id": "a9fc3669-1cf4-4dff-8f4c-d6a22c62eadb",
* "_updatedDate": "2024-06-11T12:17:24.724Z",
* "requiredPoints": 500,
* "revision": "2",
* "tierDefinition": {
* "icon": "shapes/43e4c49bed6b47e8a85bc1dd5fbcfd71.svg",
* "name": "Diamond",
* "description": "Diamond Tier Benefits"
* }
* },
* {
* "_createdDate": "2024-06-11T12:38:35.490Z",
* "_id": "8edeea05-2c90-43fa-bd15-b2352620fd51",
* "_updatedDate": "2024-06-11T12:38:35.490Z",
* "requiredPoints": 1000,
* "revision": "1",
* "tierDefinition": {
* "icon": "shapes/cca51dde12d348379113f2201cbe4e6c.svg",
* "name": "Jadeite Tier",
* "description": "Jadeite Tier Benefits"
* }
* }
* ]
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.