getTier( )


Retrieves a loyalty tier.

To retrieve a list of all of a site's tiers, use listTiers().

Permissions
Read Loyalty
Manage Loyalty
Learn more about app permissions.
Method Declaration
Copy
function getTier(tierId: string): Promise<Tier>;
Method Parameters
tierIdstringRequired

ID of the tier to retrieve.

Returns
Return Type:Promise<Tier>
JavaScript
import { tiers } from "wix-loyalty.v2"; import { webMethod, Permissions } from "wix-web-module"; /* Sample tierId value: * * { * "tierId": "f882b4b5-44c4-42b4-a380-9662b55bbe71" * } */ export const getTier = webMethod(Permissions.Anyone, async (tierId) => { try { const result = await tiers.getTier(tierId); return result; } catch (error) { console.error(error); // Handle the error } }); /* Promise resolves to: * * { * "_createdDate": "2024-06-10T07:07:35.686Z", * "_id": "f882b4b5-44c4-42b4-a380-9662b55bbe71", * "_updatedDate": "2024-06-10T07:07:35.686Z", * "requiredPoints": 40, * "revision": "1", * "tierDefinition": { * "name": "Super API Tier", * "description": "Tiers created from API" * } * } */
Errors

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

Did this help?