Setup

To use the Programs API, install the @wix/loyalty package using npm or Yarn:

Copy
1
npm install @wix/loyalty

or

Copy
1
yarn add @wix/loyalty

Then import { programs } from @wix/loyalty:

Copy
1
import { programs } from '@wix/loyalty'
Was this helpful?
Yes
No

activateLoyaltyProgram( )

Developer Preview

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

Activates a loyalty program.

The activateLoyaltyProgram() function returns a Promise that resolves when the status of the loyalty program is successfully changed to "ACTIVE".

Before you begin, a Wix Loyalty Program must first be installed through your dashboard or through the Wix App Market. Initially when a loyalty program is installed, the status is set to "DRAFT". You can change the program's status to "ACTIVE" with this function or through your dashboard. A site's customers can only earn or redeem points while the program status is "ACTIVE".

This function updates only the status of a loyalty program, to make other updates to the program, use the updateLoyaltyProgram() function.

To temporarily pause your loyalty program you must follow three steps:

  1. Remove all earnPoints() functions and switch off all the "Earn Points" and "Rewards" toggles in the Loyalty Program dashboard.
  2. Hide the loyalty page from your site.
  3. Delete the My Rewards page from the Member pages. See Pausing Your Loyalty Program for more information.

Note: Only visitors with Manage Loyalty permissions can activate a loyalty program. You can override the permissions with the wix-auth elevate() function.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Loyalty
Learn more about permission scopes.
Copy
function activateLoyaltyProgram(): Promise<ActivateLoyaltyProgramResponse>
Request
This method does not take any parameters
Returns
Return Type:Promise<ActivateLoyaltyProgramResponse>
Was this helpful?
Yes
No

disablePointsExpiration( )

Developer Preview

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

Disable points expiration

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Loyalty
Learn more about permission scopes.
Copy
function disablePointsExpiration(): Promise<DisablePointsExpirationResponse>
Request
This method does not take any parameters
Returns
Return Type:Promise<DisablePointsExpirationResponse>
Was this helpful?
Yes
No

enablePointsExpiration( )

Developer Preview

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

Enable points expiration

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Loyalty
Learn more about permission scopes.
Copy
function enablePointsExpiration(): Promise<EnablePointsExpirationResponse>
Request
This method does not take any parameters
Returns
Return Type:Promise<EnablePointsExpirationResponse>
Was this helpful?
Yes
No

getLoyaltyProgram( )

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 the site's loyalty program.

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

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Loyalty
Manage Loyalty
Learn more about permission scopes.
Copy
function getLoyaltyProgram(): Promise<GetLoyaltyProgramResponse>
Request
This method does not take any parameters
Returns
Return Type:Promise<GetLoyaltyProgramResponse>
Was this helpful?
Yes
No

pauseLoyaltyProgram( )

Developer Preview

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

Changes the program status to PAUSED.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Loyalty
Learn more about permission scopes.
Copy
function pauseLoyaltyProgram(): Promise<PauseLoyaltyProgramResponse>
Request
This method does not take any parameters
Returns
Return Type:Promise<PauseLoyaltyProgramResponse>
Was this helpful?
Yes
No

updateLoyaltyProgram( )

Developer Preview

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

Updates the site's loyalty program.

The updateLoyaltyProgram() function returns a Promise that resolves when the loyalty program is updated.

With the updateLoyaltyProgram() function you can update the name of the loyalty program and the details of the collectible points unit. To activate the loyalty program use the activateLoyaltyProgram() function.

Note: Only visitors with Manage Loyalty permissions can update a loyalty program. You can override the permissions with the wix-auth elevate() function.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Loyalty
Learn more about permission scopes.
Copy
function updateLoyaltyProgram(loyaltyProgram: LoyaltyProgram): Promise<UpdateLoyaltyProgramResponse>
Method Parameters
loyaltyProgramLoyaltyProgramRequired

Loyalty program fields to update.

Returns
Return Type:Promise<UpdateLoyaltyProgramResponse>
Was this helpful?
Yes
No