Introduction

The Referred Friend API allows you to manage referred friends in your referral program on your Wix site. With this API, you can create, retrieve, update, and delete referred friends, as well as query for specific referred friends based on various criteria.

With the Referred Friend API, you can:

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.
  • You must have at least one of these apps installed: Wix Stores, Wix Bookings, Wix Events, Wix Pricing Plans, or the new Wix Restaurants ordering app.

Terminology

  • Referred Friend: A new customer who was referred to your site or business by an existing customer.
  • Referring Customer: An existing customer who refers others to your site or business.
  • Referral Code: A unique code assigned to a referring customer, used to track referrals.
  • Referral Program: A marketing strategy that incentivizes existing customers to refer new customers.
  • Status: The current state of a referred friend in the referral program (for example, SIGN_UP_COMPLETED, ACTIONS_COMPLETED).
Did this help?

Setup

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

Copy
npm install @wix/referral

or

Copy
yarn add @wix/referral

Then import { friends } from @wix/referral:

Copy
import { friends } from "@wix/referral";
Did this help?

createReferredFriend( )


Developer Preview

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

Creates a new referred friend or returns an existing entity if it already exists.

This method must be called with a member identity.

A referral code must be provided either in the request or via scope.

The member must be eligible to become a referred friend.

Method Declaration
Copy
function createReferredFriend(
  options: CreateReferredFriendOptions,
): Promise<CreateReferredFriendResponse>;
Method Parameters
optionsCreateReferredFriendOptions
Returns
Return Type:Promise<CreateReferredFriendResponse>
JavaScript
import { friends } from "@wix/referral"; async function createReferredFriend(options) { const response = await friends.createReferredFriend(options); }
Errors
428Failed Precondition

There is 1 error with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Did this help?