Introduction

The Referral Program API allows you to create and manage a referral program for a site. With this API, you can incentivize a business's existing customers to bring in new ones, helping to grow a business through word-of-mouth marketing.

With the Referral Program API, you can:

See Wix Referral Program: Adding and Setting Up Your Referral Program for more information on setting up and managing referral program on a Wix site.

Types of referral rewards

The Referral Rewards API supports the following types of rewards:

  • Coupon: A discount or promotional offer that can be applied to a purchase.
  • Loyalty Points: Points awarded to a customer's loyalty account.

Before you begin

It's important to note the following points before starting to code:

  • The Referral Program API requires a Business or higher plan for Wix Editor, or a Plus or higher plan for Wix Studio.
  • A site must have at least one of these apps installed: Wix Stores, Wix Bookings, Wix Events, Wix Pricing Plans, or Wix Restaurants Orders.
  • There can only be 1 referral program per site.

Terminology

  • Referral program: A feature that allows a site's members to refer friends to a business by sharing referral URLs. There is an option to reward both the customer doing the referring and the friend being referred.
  • Referring customer: A site member who shares a referral URL with potential new customers.
  • Referred friend: A person who clicks on a referral URL shared by a referring customer.
  • Reward: An incentive given to both the referring customer and the referred friend for participating in the program.
  • Successful referral action: An action taken by the referred friend that triggers a reward for the referring customer. For example, placing an order or booking a session.
  • Referral URL: A unique link generated for each site member that can be shared with potential new customers. The member copies and shares this link with potential customers. When clicked, it brings the referred friend to the site, where they can sign up and redeem their reward.
Did this help?

Setup

@wix/referral

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

Copy

or

Copy

Then import { programs } from @wix/referral:

Copy
Did this help?

activateReferralProgram( )


Activates the referral program, changing its status to ACTIVE.

Method Declaration
Copy
function activateReferralProgram(): Promise<ActivateReferralProgramResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<ActivateReferralProgramResponse>
JavaScript
import { programs } from "@wix/referral"; async function activateReferralProgram() { const response = await programs.activateReferralProgram(); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

generateAiSocialMediaPostsSuggestions( )


Creates new AI-generated social media post suggestions for promoting the referral program.

This method generates new AI-powered social media post suggestions for promoting the referral program. Use it to refresh content or create alternatives to existing suggestions.

Note: This method generates new suggestions each time it's called. To retrieve existing suggestions without generating new ones, use Get AI Social Media Posts Suggestions.

Method Declaration
Copy
function generateAiSocialMediaPostsSuggestions(
  options: GenerateAiSocialMediaPostsSuggestionsOptions,
): Promise<GenerateAISocialMediaPostsSuggestionsResponse>;
Method Parameters
optionsGenerateAiSocialMediaPostsSuggestionsOptions
Returns
Return Type:Promise<GenerateAISocialMediaPostsSuggestionsResponse>
JavaScript
import { programs } from "@wix/referral"; async function generateAiSocialMediaPostsSuggestions(options) { const response = await programs.generateAiSocialMediaPostsSuggestions(options); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

getAiSocialMediaPostsSuggestions( )


Retrieves pre-generated AI social media post suggestions for promoting the referral program.

This method returns a list of AI-generated social media post suggestions that site owners or members can use to promote the referral program. You can display these suggestions to allow referring customers to easily copy and share them on their preferred social media platforms.

Note: This method retrieves existing suggestions. To generate new ones, use Generate AI Social Media Posts Suggestions.

Method Declaration
Copy
function getAiSocialMediaPostsSuggestions(
  options: GetAiSocialMediaPostsSuggestionsOptions,
): Promise<GetAISocialMediaPostsSuggestionsResponse>;
Method Parameters
optionsGetAiSocialMediaPostsSuggestionsOptions
Returns
Return Type:Promise<GetAISocialMediaPostsSuggestionsResponse>
JavaScript
import { programs } from "@wix/referral"; async function getAiSocialMediaPostsSuggestions(options) { const response = await programs.getAiSocialMediaPostsSuggestions(options); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

getReferralProgram( )


Retrieves the referral program.

Method Declaration
Copy
function getReferralProgram(): Promise<GetReferralProgramResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<GetReferralProgramResponse>
JavaScript
import { programs } from "@wix/referral"; async function getReferralProgram() { const response = await programs.getReferralProgram(); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

getReferralProgramPremiumFeatures( )


Retrieves information about the enabled premium features for the referral program.

Method Declaration
Copy
function getReferralProgramPremiumFeatures(): Promise<GetReferralProgramPremiumFeaturesResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<GetReferralProgramPremiumFeaturesResponse>
JavaScript
import { programs } from "@wix/referral"; async function getReferralProgramPremiumFeatures() { const response = await programs.getReferralProgramPremiumFeatures(); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?