Referral program

How it works

A referral program is a tool designed to attract new users, when existing users invite others via a referral link. The program can be integrated into a website or a game. As a result, all program participants receive rewards:

  • The invitee receives a reward only once, after making the first purchase.
  • The inviting user receives a reward for each invitee who has made a purchase in the store.
A referral program can be integrated into:

Regardless of where the referral program is used – on a website or in a game – its mechanics and reward conditions remain the same.

Referral program configuration is available for the following scenarios:

  • selling in-game items — virtual items, virtual currency packages, and bundles
  • selling games and DLC via game keys
Key features:
  • Providing one or several items of the following types as a reward:
    • virtual currency
    • virtual item
    • bundle with items
  • Customization of the referral program widget.
  • Generation of referral links.
  • Ability for a user to change the referral program before making their first purchase.
Limitations:
  • There can only be one referral program in the project.
  • Users can’t invite themselves.

User flows

Inviting user flow

  1. The user logs in or registers on the site or in the game.
  2. The user opens the referral program widget and reads the program conditions.
  3. The user gets the referral link in the widget.
  4. The user shares the referral link with another user.
  5. The user opens the referral program widget and receives a reward if the invitee followed the referral link and fulfilled the program conditions.

Invitee flow

  1. The user receives a referral link with a description of the program conditions and rewards.
  2. The user follows the referral link.
  3. The user registers on the website or in the game.
  4. The user makes the first purchase.
  5. The user receives the reward.
Note
The invitee can join only one referral program associated with a specific website or game. The invitee joins the referral program when making the first purchase. Before that, they can follow another referral link and choose a different user’s referral program.

How to set up

Create referral program

Note

Before creating a referral program, you need to set up the items that will be granted to the inviting user and the invitee as rewards, and then proceed with configuring the program.

To create items manually, open your project in Publisher Account and go to the Items catalog > All items section. For detailed information about this and other ways to create items, refer to the Items catalog section.

  1. Open your project in Publisher Account and go to the LiveOps > Referral program section.
  1. Click Create referral program.
  2. Set the necessary parameters:
    • Specify the referral program name.
    • Enter the description.
  1. Click Next.
  2. Add rewards that users will receive:
    • To add a reward for the inviting user, in the Reward for inviting players section, specify the item SKUs and their quantity.
    • To add a reward for the invitees, in the Reward for invitees section, specify the items SKUs and their quantity.
Note
The inviting user receives a reward for each invitee who has made a purchase in the store. Therefore, we recommend providing a reward that can be granted multiple times. For example, don’t use a unique character as a reward, as it can’t be unlocked more than once.
  1. Click Next.
  2. Review the settings of the referral program and click Create.
The created referral program is enabled by default and is displayed in the Referral program section.
Note
To hide the referral program on the website or in the game, turn off the Referral program toggle. The program will still be available for editing, and you can continue configuring its widget.
To show the created referral program on the website or in the game, configure the widget display.

Edit referral program

You can make changes to the active referral program:

  • change the list of items that are provided as rewards
  • change conditions
To make changes:
  1. Go to the created referral program.
  2. Click Edit.
  1. Update text and/or users item list.
  2. Click Next.
  3. Review the referral program settings and click Create.

The edited referral program is enabled by default and is displayed in the Referral program section. After you save the changes, users will see the updated program conditions and receive new rewards.

Rewards that users have already received before the conditions update will not change.

Re-publishing the widget is not required after updating the conditions.

How to display

The referral program is displayed via a widget. To allow users to view the program conditions and participate, add the widget to your website or the game.

Set up widget

  1. On the created referral program page, click Go to customizer.
  1. Set up widget components for each state. To make the widget match the design of the game and site, you can customize it and configure the following features:
    • a set of UI elements
    • colors of UI elements
    • button texts and headers including localization
    • font type, color, and size
In the widget settings, you can also customize the content of the FAQ block for the referral program in accordance with the specifics of your game.
  1. Set up localization. All widget texts are translated into the project languages specified in Publisher Account in the Project settings > General settings > Project languages section. To change the default translations, click on the text twice and enter your own text.
  2. Publish the changes
  3. Copy the widget code in the opened window and add it to your website.
After adding the widget code to the site, the button to open the widget will be displayed on the page.

After publishing the widget you can always return to the widget settings and make changes. To apply the changes, re-publish the widget.

Add widget code to your site via Xsolla site builder

If you implement your own site interface, add the widget code into your site’s code. If you use Xsolla site builder, follow the steps to add a referral program widget to your site:

  1. Open your project in Publisher Account and go to the Storefronts > Websites section.
  2. In the Sites section, select your site and click Open Site Builder.
  3. Click Add Block.
  4. Select the Custom code block.
  5. Add the referral program widget code.
  6. To apply the changes, publish the website:
    1. In the upper-right corner of the Site Builder click Publish.
    1. Select the checkboxes next to the pages you want to publish.
    1. Confirm that the website is ready for publishing and click Publish.

Integrate into game or your own site

To integrate the referral program into a game or a website created without Xsolla site builder, follow these steps:

  1. Implement user authentication in the widget on your side. User authentication in the referral program widget is performed through authentication on the website where the widget is embedded. There are 2 user authentication scenarios — on the website or in the widget:
    • If the user logs into the site, you need to pass the user’s authorization token to the widget using the onTokenChange() method. When the user logs out of the system, pass null as the method parameter.
    • If the user logs in through the widget, the widget will call the requestAuth function passed to it during initialization. In response, the site should return the user’s authorization token.

Example code for initializing the widget:

Copy
Full screen
Small screen
1window.XESApi.init({
2requestAuth: requestAuth,
3token: getToken()
4})
  1. Ensure that referral data is passed correctly.
  2. Embed the referral program widget code into the game or website interface.

Widget API

The widget API provides a set of functions and methods for authenticating a user in the widget:

ParameterTypeDescription
init
(config: Config) => voidMethod used for initializing the widget.
The init() method is passed the widget configuration:
ParameterTypeDescription
requestAuth
()=> Promise Function that the widget calls when authenticating the user.
token
string or nullThe current user’s authorization token. If the token is unknown at the time of widget initialization, pass the null value.
ParameterTypeDescription
onTokenChange
(token: string/null) => voidMethod to pass the current user’s token to the widget. Pass the null value when the user logs out of the system.

Widget states

The referral program widget can have different states depending on the type of user (inviting or invitee), user’s authorization status, and fulfillment of program conditions.

The set of widget components includes UI elements for different states. You can configure components when setting up the widget.

Button to open the widget:

StateDescriptionWho it’s displayed toComponents that can be editedImage
View detailsEngaging the user to participate in the program.Authorized users who are not yet participating in the program.Background and text colours. Text of the widget open button and view details button text.Widget state 1
Waiting for authorizationEncouraging the user to log in through the widget.Unauthorised users who have followed the referral link.Background and text colours. Button texts.Widget state 2
Waiting for the first purchaseEncouraging the user to make the first purchase.Users who have followed the referral link and logged in to the site.Background and text colours. Button texts.Widget state 3
Receiving a rewardEncouraging the user to receive a reward.Inviting users whose friends have met the program conditions, and they can receive a reward.Background and text colours. Button texts.Widget state 4
Closing the widgetThe widget is open, the button is displayed as the × icon.Authorized users who have opened the widget details.Background and text colours. Button colour.Widget state 5
DefaultThe widget is closed.Users who have closed the widget.Background and text colours. Button text.Widget state 6

Widget page for the inviting user:

DescriptionWho it’s displayed toComponents that can be editedImage
  • Referral program details.
  • Button for sending the referral link.
  • List of rewards with statuses:
    • Claimed — reward for the invitee has been received.
    • In progress — invitee has logged in to the site, but has not yet made a purchase.
    • Claim — invitee has logged in to the site and made the first purchase. The inviting user can receive a reward.
An authorized inviting user, whose friend followed the referral link and logged in to the site.Background and text colours. Widget text, button texts.Crystal
FAQ sectionAn authorized inviting user who clicked the program information button.Adding and removing blocks with questions. Background and text colors. Content of questions and answers.Crystal

Widget page for the invitee:

DescriptionWho it’s displayed toComponents that can be editedImage
The widget text encourages to make a purchase on the site. After making a purchase, the user is shown a notification about receiving a bonus.Users who have followed the referral link and logged in.Background and text colors. Widget text, button texts.Crystal
Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Last updated: February 13, 2026

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!
We couldn't send your feedback
Try again later or contact us at doc_feedback@xsolla.com.