Setup
To use the Tiers API, install the @wix/loyalty
package using npm or Yarn:
1npm install @wix/loyalty
or
1yarn add @wix/loyalty
Then import { tiers }
from @wix/loyalty
:
1import { tiers } from '@wix/loyalty'
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Creates up to 20 tiers.
The name for a tier and the amount of required points to qualify for a tier can only exist for a single tier.
Attempts to create a tier with a tierDefinition.name
or requiredPoints
that already exists will return an error.
To create a single tier, use createTier()
.
Note: You must have a Business VIP Premium plan or a Scale Premium plan to add tiers.
Permission Scopes
For app development, you must have one of the following permission scopes:function bulkCreateTiers(tiers: Array<Tier>): Promise<BulkCreateTiersResponse>
Tiers to create.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Creates a tier.
The name for a tier and the amount of required points to qualify for a tier can only exist for a single tier.
Attempts to create a tier with a tierDefinition.name
or requiredPoints
that already exists will return an error.
To create up to 20 tiers at once, use bulkCreateTiers()
.
Note: You must have a Business VIP Premium plan or a Scale Premium plan to add tiers.
Permission Scopes
For app development, you must have one of the following permission scopes:function createTier(tier: Tier): Promise<Tier>
Tier to create.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Deletes a loyalty tier.
Note: This endpoint requires visitor or member authentication.
Permission Scopes
For app development, you must have one of the following permission scopes:function deleteTier(tierId: string, revision: string): Promise<void>
ID of the tier to delete.
Current revision of the tier to delete.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a loyalty tier.
To retrieve a list of all of a site's tiers, use listTiers()
.
Permission Scopes
For app development, you must have one of the following permission scopes:function getTier(tierId: string): Promise<Tier>
ID of the tier to retrieve.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves the settings for the tiers program.
Tiers program settings apply globally to all tiers in the program.
Note: This endpoint requires visitor or member authentication.
Permission Scopes
For app development, you must have one of the following permission scopes:function getTiersProgramSettings(): Promise<GetTiersProgramSettingsResponse>
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 a site's tiers.
To retrieve a specific tier, use getTier()
.
Permission Scopes
For app development, you must have one of the following permission scopes:function listTiers(): Promise<ListTiersResponse>
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Updates a loyalty tier.
Use this endpoint to update tier-specific settings, such as the name and the required points
threshold of an individual loyalty tier. To update global settings that apply to all of a site's loyalty tiers,
use updateTiersProgramSettings()
.
Permission Scopes
For app development, you must have one of the following permission scopes:function updateTier(_id: string, tier: UpdateTier): Promise<Tier>
Tier ID.
Tier info to update.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Updates the global settings of a loyalty tier program.
Use this endpoint to update settings that apply to all of a site's loyalty tiers.
To update tier-specific settings for an individual tier, use
updateTier()
.
By default, the status
of a tiers program is set to "DISABLED"
and must be manually updated to "ACTIVE"
using
this endpoint or through a site owner's dashboard.
Note: The status
, revision
, and rollingWindow
parameters must be passed to update the tiers program settings. The baseTierDefinition
fields are not required, however, if you don't pass them they will reset to their default values of empty fields.
Permission Scopes
For app development, you must have one of the following permission scopes:function updateTiersProgramSettings(programSettings: TiersProgramSettings): Promise<UpdateTiersProgramSettingsResponse>
Settings for the tiers program.