> 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 # ActivateLoyaltyProgram # Package: loyaltyProgramManagement # Namespace: LoyaltyPrograms # Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/loyalty-program-management/program/activate-loyalty-program.md ## Permission Scopes: Manage Loyalty: SCOPE.DC-LOYALTY.MANAGE-LOYALTY ## Introduction Activates a loyalty program. Initially, when a loyalty program is installed, the status is set to `"DRAFT"`. You can change the program's status to `"ACTIVE"` with this method or through the [dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Floyalty-accounts/wizard/). A site's customers can only earn or redeem points while the program is `"ACTIVE"`. This method only updates the status of a loyalty program. To make other updates to the program, call Update Loyalty Program. To temporarily pause your loyalty program, call Pause Loyalty Program and see [Pausing Your Loyalty Program](https://support.wix.com/en/article/wix-loyalty-program-pausing-your-loyalty-program) for more information. --- ## REST API ### Schema ``` Method: activateLoyaltyProgram Description: Activates a loyalty program. Initially, when a loyalty program is installed, the status is set to `"DRAFT"`. You can change the program's status to `"ACTIVE"` with this method or through the [dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Floyalty-accounts/wizard/). A site's customers can only earn or redeem points while the program is `"ACTIVE"`. This method only updates the status of a loyalty program. To make other updates to the program, call Update Loyalty Program. To temporarily pause your loyalty program, call Pause Loyalty Program and see [Pausing Your Loyalty Program](https://support.wix.com/en/article/wix-loyalty-program-pausing-your-loyalty-program) for more information. URL: https://www.wixapis.com/v1/program/activate Method: POST Return type: ActivateLoyaltyProgramResponse - name: loyaltyProgram | type: LoyaltyProgram | description: Activated loyalty program. - name: name | type: string | description: Program name. - name: pointDefinition | type: PointDefinition | description: Details about the program's collectible unit. - name: customName | type: string | description: Display name for the program's collectible unit. It's recommended to use a plural, for example `"Stars"`. In contrast to a custom name, the default `"Points"` name is translated and adjusted to singular based on circumstances. Default: `"Points"`. - name: icon | type: Image | description: Details about the points 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: status | type: ProgramStatus | description: Program status. Customers can only earn or redeem points while the program is `"ACTIVE"`. Default: `"DRAFT"` - enum: - UNKNOWN: Unknown program status. - DRAFT: Program is in draft mode. Customers can't earn or redeem points. - ACTIVE: Program is active. Customers can earn and redeem points. - PAUSED: Program is paused. Customers can't earn or redeem points while the program is paused. Set the program to `"ACTIVE"` to resume earning and redeeming points. - name: createdDate | type: string | description: Date and time the program was created. - name: updatedDate | type: string | description: Date and time the program was updated. - name: pointsExpiration | type: PointsExpiration | description: Configuration for the points expiration feature. - name: status | type: Status | description: Status of the points expiration feature. - enum: - DISABLED: Points expiration feature is disabled. - ENABLED: Points expiration feature is enabled. - name: monthsOfInactivity | type: integer | description: How many months a member should be inactive to lose the collected points. - name: expiringPointsPercentage | type: integer | description: Percentage of points that a member loses after being inactive. - name: premiumFeatures | type: PremiumFeatures | description: Information about the available program premium features. - name: loyaltyProgram | type: boolean | description: Whether there are any loyalty program premium features. - name: tiers | type: boolean | description: Whether this loyalty program includes tiers. - name: pointsExpiration | type: boolean | description: Whether this loyalty program includes point expiration. ``` ### Examples ### Activate loyalty program ```curl curl -X POST \ 'https://www.wixapis.com/loyalty-programs/v1/program/activate' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.loyaltyProgramManagement.LoyaltyPrograms.activateLoyaltyProgram() Description: Activates a loyalty program. Initially, when a loyalty program is installed, the status is set to `"DRAFT"`. You can change the program's status to `"ACTIVE"` with this method or through the [dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Floyalty-accounts/wizard/). A site's customers can only earn or redeem points while the program is `"ACTIVE"`. This method only updates the status of a loyalty program. To make other updates to the program, call Update Loyalty Program. To temporarily pause your loyalty program, call Pause Loyalty Program and see [Pausing Your Loyalty Program](https://support.wix.com/en/article/wix-loyalty-program-pausing-your-loyalty-program) for more information. Return type: PROMISE - name: loyaltyProgram | type: LoyaltyProgram | description: Activated loyalty program. - name: name | type: string | description: Program name. - name: pointDefinition | type: PointDefinition | description: Details about the program's collectible unit. - name: customName | type: string | description: Display name for the program's collectible unit. It's recommended to use a plural, for example `"Stars"`. In contrast to a custom name, the default `"Points"` name is translated and adjusted to singular based on circumstances. Default: `"Points"`. - name: icon | type: string | description: Details about the points icon. - name: status | type: ProgramStatus | description: Program status. Customers can only earn or redeem points while the program is `"ACTIVE"`. Default: `"DRAFT"` - enum: - UNKNOWN: Unknown program status. - DRAFT: Program is in draft mode. Customers can't earn or redeem points. - ACTIVE: Program is active. Customers can earn and redeem points. - PAUSED: Program is paused. Customers can't earn or redeem points while the program is paused. Set the program to `"ACTIVE"` to resume earning and redeeming points. - name: _createdDate | type: Date | description: Date and time the program was created. - name: _updatedDate | type: Date | description: Date and time the program was updated. - name: pointsExpiration | type: PointsExpiration | description: Configuration for the points expiration feature. - name: status | type: Status | description: Status of the points expiration feature. - enum: - DISABLED: Points expiration feature is disabled. - ENABLED: Points expiration feature is enabled. - name: monthsOfInactivity | type: integer | description: How many months a member should be inactive to lose the collected points. - name: expiringPointsPercentage | type: integer | description: Percentage of points that a member loses after being inactive. - name: premiumFeatures | type: PremiumFeatures | description: Information about the available program premium features. - name: loyaltyProgram | type: boolean | description: Whether there are any loyalty program premium features. - name: tiers | type: boolean | description: Whether this loyalty program includes tiers. - name: pointsExpiration | type: boolean | description: Whether this loyalty program includes point expiration. ``` ### Examples ### Activate loyalty program (with elevated permissions) ```javascript import { programs } from '@wix/loyalty'; import { auth } from '@wix/essentials'; export async function myActivateLoyaltyProgramFunction() { const elevatedActivateProgram = auth.elevate(programs.activateLoyaltyProgram) try { const myLoyaltyProgram = await elevatedActivateProgram(); const name = myLoyaltyProgram.loyaltyProgram.name; const status = myLoyaltyProgram.loyaltyProgram.status; console.log('Success! The status of your loyalty program is:', status); return myLoyaltyProgram; } catch (error) { console.error(error); } } /* Promise resolves to: * { * "loyaltyProgram": { * "name": "Star Loyalty Program", * "pointDefinition": { * "customName": "Stars", * "icon": "shapes/39dce0a5d1ce498f95526b1390eaf585.svg", * }, * "status": "ACTIVE", * "_createdDate": "2022-05-22T08:18:32.186Z", * "_updatedDate": "2022-05-25T10:36:32.430Z" * } * } */ ``` ### Activate loyalty program ```javascript import { programs } from '@wix/loyalty'; export async function myActivateLoyaltyProgramFunction() { try { const myLoyaltyProgram = await programs.activateLoyaltyProgram(); const name = myLoyaltyProgram.loyaltyProgram.name; const status = myLoyaltyProgram.loyaltyProgram.status; console.log('Success! The status of your loyalty program is:', status); return myLoyaltyProgram; } catch (error) { console.error(error); } } /* Promise resolves to: * { * "loyaltyProgram": { * "name": "Star Loyalty Program", * "pointDefinition": { * "customName": "Stars", * "icon": "shapes/39dce0a5d1ce498f95526b1390eaf585.svg", * }, * "status": "ACTIVE", * "_createdDate": "2022-05-22T08:18:32.186Z", * "_updatedDate": "2022-05-25T10:36:32.430Z" * } * } */ ``` ### activateLoyaltyProgram (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 { programs } from '@wix/loyalty'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { programs }, // Include the auth strategy and host as relevant }); async function activateLoyaltyProgram() { const response = await myWixClient.programs.activateLoyaltyProgram(); }; ``` ---