Wix Blocks: Creating a free trial for your app

4 min read
When you set up your app's pricing in the Wix Developers Center, you can choose to provide users with a free trial. This is recommended especially if you don't provide a free version of your app, so you can let users experience your app's value before they decide whether to upgrade.
free trial in the dev center
Once you choose to add a free trial, your app market listing will show how many days of free trial the app offers. This is the only thing you get out of the box. You are responsible to take care of all the other aspects of your free trial, as described in this article. 
app listings in the app market

Free trial user experience: best practices

When providing a free trial, you should cover the experience of site creators who install your app and their site visitors - in all stages of the free trial. This means what happens during the trial, after the trial, for the entire app, or for specific features. 

During the trial: site creator experience

  • The app should work fully.
  • Tell site creators how many days they have left in the trial. Indicate this, for example, in a message in your app's settings panel, or in your app's Dashboard page. 
  • Provide entry points to upgrade your app  in case someone wants to upgrade before the trial ends.
settings panel during free trial

After the trial: site creator experience

When the free trial is over, the app should behave as follows:
  • In the site editor, display a notification in a central, visible place in the app, and prevent the app (or specific features) from working. Note the difference between a premium app, which does not work at all unless it's paid for, and a freemium app, where you should block only the premium features. 
  • Provide entry points to upgrade your app. This can be done in the widget's action bar, settings panel, or in the app Dashboard.
settings panel after free trial

After the trial: site visitor experience

Your direct user is the site creator who installed your app. However, you should also think about the user of your user, the site visitor. 

When the free trial is over, lock the app (or its premium features) from working. If it's a premium only app, we recommend to collapse (delete) it, so it's not seen on the site. If you cannot collapse it, present an indication, such as: "This app / feature is currently unavailable, contact the site owner for details". This is also true for Dashboard apps - collapse the app or present a proper message. 
Here is a code example for collapsing the widget after the trial: 
1import wixApplication from 'wix-application';
2let plan, instance;
3
4$w.onReady(async function () {
5    instance = await wixApplication.getDecodedAppInstance();
6    plan = instance.vendorProductId;
7    if (plan == null) {
8        $w('#box1').delete(); //remove the widget's container from the stage
9    }
10});
11

Tracking the free trial dates

Currently, there is no out-of-the-box solution for tracking an app's free trial (however, there is an open feature request for it). So, each developer might choose to implement this differently. 
To provide a free trial, you must save the instanceId (returned by the getDecodedAppinstance() Velo function), together with the installation date, in your own external database. This database can also hold information of who your users are, what are their website's URL, etc.
Your app's business logic should look something like the following. This is only a recommendation. 
  1. When the widget is ready, check whether or not this instance of the app was upgraded. If  getDecodedAppInstance().vendorProductId is null, then this app was never upgraded on this site. 
  2. If the app was not upgraded, compare its instanceId to your external database.
  3. If you find the instanceId in your database, check the install date you stored with it, to see whether it is eligible for a free trial. 
  4. If the instanceId is not in the database, save it, together with the date. 
Note
The same app on the same site will always have the same instanceId (even if it's deleted and installed again). This means that the site creator will not be able to do another free trial on the same site.

Did this help?

|