Search.../

getLoyaltyProgram( )

Developer Preview

Retrieves the site's loyalty program.

Description

The getLoyaltyProgram() function returns a Promise that resolves to the site's loyalty program.

Syntax

function getLoyaltyProgram(): Promise<GetLoyaltyProgramResponse>

getLoyaltyProgram Parameters

This function does not take any parameters.

Returns

Return Type:

Promise<
GetLoyaltyProgramResponse
>
NAME
TYPE
DESCRIPTION
loyaltyProgram
LoyaltyProgram

Retrieved loyalty program.

Was this helpful?

Get loyalty program

Copy Code
1import { programs } from 'wix-loyalty.v2';
2
3export async function myGetLoyaltyProgramFunction() {
4 try {
5 const myLoyaltyProgram = await programs.getLoyaltyProgram();
6
7 const name = myLoyaltyProgram.loyaltyProgram.name;
8 const status = myLoyaltyProgram.loyaltyProgram.status;
9
10 console.log('Success! The status of your loyalty program is:', status);
11 return myLoyaltyProgram;
12 } catch (error) {
13 console.error(error);
14 }
15}
16
17/* Promise resolves to:
18 * {
19 * "loyaltyProgram": {
20 * "name": "Frequent Flower Program",
21 * "pointDefinition": {
22 * "customName": "Petals",
23 * "icon": "shapes/8de38e8fe76f4e9f937ae23e9ba1eb04.svg"
24 * },
25 * "status": "ACTIVE",
26 * "_createdDate": "2022-11-07T15:26:12.798Z",
27 * "_updatedDate": "2022-11-09T10:00:42.018Z"
28 * }
29 * }
30 */
31