> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # CreateTiersProgramSettings # Package: loyaltyProgramManagement # Namespace: LoyaltyTiers # Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/loyalty-program-management/tiers/create-tiers-program-settings.md ## Permission Scopes: Manage Loyalty: SCOPE.DC-LOYALTY.MANAGE-LOYALTY ## Introduction Create tiers program settings. Tiers program settings apply globally to all tiers in the program. --- ## REST API ### Schema ``` Method: createTiersProgramSettings Description: Create tiers program settings. Tiers program settings apply globally to all tiers in the program. URL: https://www.wixapis.com/v1/tiers/program-settings Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: programSettings Method parameters: param name: programSettings | type: TiersProgramSettings | description: Tiers program settings apply globally to all tiers in the program. A site can only have 1 set of program settings. | required: true - name: rollingWindow | type: RollingWindow | description: **Required.** Period of time used to calculate loyalty points for tier assignment. The loyalty points accumulated during this period determine if the account meets a tier's required point threshold. - name: durationInMonths | type: integer | description: Number of months to use for the rolling window period. Min: `12` Max: `36` - name: status | type: Status | description: Tiers program status. - enum: - UNKNOWN: Unknown status. - DISABLED: Tiers are disabled. - DRAFT: Tiers are enabled but not yet active. - ACTIVE: Tiers are active. - PAUSED: Tiers are paused. - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tiers settings are updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tiers settings. - name: baseTierDefinition | type: TierDefinition | description: Information about the base loyalty tier. The base tier is the default tier for any account that's unassigned for not meeting the required points threshold of any other tier. - name: icon | type: Image | description: Details about the tier icon. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: Image URL. - name: altText | type: string | description: Image alt text. - name: name | type: string | description: Tier name. - name: description | type: string | description: Tier description. Return type: CreateTiersProgramSettingsResponse - name: programSettings | type: TiersProgramSettings | description: Created tiers program settings. - ONE-OF: - name: rollingWindow | type: RollingWindow | description: **Required.** Period of time used to calculate loyalty points for tier assignment. The loyalty points accumulated during this period determine if the account meets a tier's required point threshold. - name: durationInMonths | type: integer | description: Number of months to use for the rolling window period. Min: `12` Max: `36` - name: status | type: Status | description: Tiers program status. - enum: - UNKNOWN: Unknown status. - DISABLED: Tiers are disabled. - DRAFT: Tiers are enabled but not yet active. - ACTIVE: Tiers are active. - PAUSED: Tiers are paused. - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tiers settings are updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tiers settings. - name: createdDate | type: string | description: Date and time the loyalty tiers program was created. - name: updatedDate | type: string | description: Date and time the loyalty tiers program was last updated. - name: baseTierDefinition | type: TierDefinition | description: Information about the base loyalty tier. The base tier is the default tier for any account that's unassigned for not meeting the required points threshold of any other tier. - name: icon | type: Image | description: Details about the tier icon. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: Image URL. - name: height | type: integer | description: Original image height. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. - name: filename | type: string | description: Image filename. - name: name | type: string | description: Tier name. - name: description | type: string | description: Tier description. ``` ### Examples ### Create tiers program settings ```curl curl -X POST \ 'https://www.wixapis.com/loyalty-tiers/v1/tiers/program-settings' \ -H 'Authorization: ' -H 'Content-Type: application/json' \ --data-raw '{ "programSettings": { "status": "ACTIVE", "baseTierDefinition": { "name": "Basic", "description": "Basic tier", "icon": { "url": "shapes/11062b_0a8e17936d5b4d46971649be036c781b.svg" } }, "rollingWindow": { "durationInMonths": 12 } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.loyaltyProgramManagement.LoyaltyTiers.createTiersProgramSettings(programSettings) Description: Create tiers program settings. Tiers program settings apply globally to all tiers in the program. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: programSettings Method parameters: param name: programSettings | type: TiersProgramSettings | description: Tiers program settings apply globally to all tiers in the program. A site can only have 1 set of program settings. | required: true - name: rollingWindow | type: RollingWindow | description: **Required.** Period of time used to calculate loyalty points for tier assignment. The loyalty points accumulated during this period determine if the account meets a tier's required point threshold. - name: durationInMonths | type: integer | description: Number of months to use for the rolling window period. Min: `12` Max: `36` - name: status | type: Status | description: Tiers program status. - enum: - UNKNOWN: Unknown status. - DISABLED: Tiers are disabled. - DRAFT: Tiers are enabled but not yet active. - ACTIVE: Tiers are active. - PAUSED: Tiers are paused. - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tiers settings are updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tiers settings. - name: baseTierDefinition | type: TierDefinition | description: Information about the base loyalty tier. The base tier is the default tier for any account that's unassigned for not meeting the required points threshold of any other tier. - name: icon | type: string | description: Details about the tier icon. - name: name | type: string | description: Tier name. - name: description | type: string | description: Tier description. Return type: PROMISE - name: programSettings | type: TiersProgramSettings | description: Created tiers program settings. - ONE-OF: - name: rollingWindow | type: RollingWindow | description: **Required.** Period of time used to calculate loyalty points for tier assignment. The loyalty points accumulated during this period determine if the account meets a tier's required point threshold. - name: durationInMonths | type: integer | description: Number of months to use for the rolling window period. Min: `12` Max: `36` - name: status | type: Status | description: Tiers program status. - enum: - UNKNOWN: Unknown status. - DISABLED: Tiers are disabled. - DRAFT: Tiers are enabled but not yet active. - ACTIVE: Tiers are active. - PAUSED: Tiers are paused. - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tiers settings are updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tiers settings. - name: _createdDate | type: Date | description: Date and time the loyalty tiers program was created. - name: _updatedDate | type: Date | description: Date and time the loyalty tiers program was last updated. - name: baseTierDefinition | type: TierDefinition | description: Information about the base loyalty tier. The base tier is the default tier for any account that's unassigned for not meeting the required points threshold of any other tier. - name: icon | type: string | description: Details about the tier icon. - name: name | type: string | description: Tier name. - name: description | type: string | description: Tier description. ``` ### Examples ### createTiersProgramSettings ```javascript import { tiers } from '@wix/loyalty'; async function createTiersProgramSettings(programSettings) { const response = await tiers.createTiersProgramSettings(programSettings); }; ``` ### createTiersProgramSettings (with elevated permissions) ```javascript import { tiers } from '@wix/loyalty'; import { auth } from '@wix/essentials'; async function myCreateTiersProgramSettingsMethod(programSettings) { const elevatedCreateTiersProgramSettings = auth.elevate(tiers.createTiersProgramSettings); const response = await elevatedCreateTiersProgramSettings(programSettings); } ``` ### createTiersProgramSettings (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { tiers } from '@wix/loyalty'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { tiers }, // Include the auth strategy and host as relevant }); async function createTiersProgramSettings(programSettings) { const response = await myWixClient.tiers.createTiersProgramSettings(programSettings); }; ``` ---