New Shopify Certification now available: Liquid Storefronts for Theme Developers

Shopify App Billing Trial

Solved
geobertz
Shopify Partner
22 0 20

Hello shopify community,

I am building a simple app, but I am having a problem with setting up the trial days.. I am using the latest node boilerplate where in i have to setup billing config upon installation.

const billingConfig = {
  "Premium": {
    interval: BillingInterval.Every30Days,
    amount: 1.99,
    currencyCode: "USD",
    trialDays: 21,
    replacementBehavior: BillingReplacementBehavior.ApplyImmediately,
    test: true,
  }
};

THE PROBLEM:

When a merchant has lets say 10days left.. after uninstalling and re-installing the app, the trial days resets to 21 days. Upon checking all the charges, upon uninstall status updates to "cancelled", if merchant re-installs the app, a new charge is being created with status 'active' upon confirming and trial days resets to 21 days. I dont want this to happen because they can have unlimited trial.

What is the best approach here, shall i not include billing config and leave undefined, when app loads shall i check database if the merchant has a charge record if not create a charge with 21 days trial then save to database, then if it uninstall the app i can use that data from my database to compute remaining days?

Im not really sure how this works.
20daysleft.png

after re-installl

21daysleft.png
Thank you. Appreciate help
geobertz
Accepted Solution (1)
oscprofessional
Shopify Partner
15736 2353 3051

This is an accepted solution.

Hi @geobertz ,

You can achieve this by saving the shop id or unique id to your database. That means, when any users install your app you should save users shop id or unique id to your database table and create some more field for status(active/inactive), start date(installed date) and end date(date after 21 days). 

For example : 

Suppose person A install the app, same time you have to save user's(person A) shop id with status 'Active' and start date + end date(21 days).

 

After installation he notified with 21 trial days.

 

Next after some days like 10th day he uninstall the app status should change to 'Inactive' and update start date(current date) you will get remaining days and save these days(ex: 11 days)

 

Next time when he reinstall app again then check for shop id if it is true then update start date and calculate end date with remaining days which you already having.  

 

Hope you get an idea, if you have any queries you can post here again.

Thanks....

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Custom Pricing Wholesale App : Free | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing

View solution in original post

Replies 5 (5)
oscprofessional
Shopify Partner
15736 2353 3051

This is an accepted solution.

Hi @geobertz ,

You can achieve this by saving the shop id or unique id to your database. That means, when any users install your app you should save users shop id or unique id to your database table and create some more field for status(active/inactive), start date(installed date) and end date(date after 21 days). 

For example : 

Suppose person A install the app, same time you have to save user's(person A) shop id with status 'Active' and start date + end date(21 days).

 

After installation he notified with 21 trial days.

 

Next after some days like 10th day he uninstall the app status should change to 'Inactive' and update start date(current date) you will get remaining days and save these days(ex: 11 days)

 

Next time when he reinstall app again then check for shop id if it is true then update start date and calculate end date with remaining days which you already having.  

 

Hope you get an idea, if you have any queries you can post here again.

Thanks....

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Custom Pricing Wholesale App : Free | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing
geobertz
Shopify Partner
22 0 20

Hi thank you for your response.

I get the idea, so my theory is correct.. Ill definitely try this..
I have another question though, how do we make an app 100% FREE?

There is no option in billing API to make it FREE.. cant set 0$ as price. and more than 1000 days as trial days.

geobertz
oscprofessional
Shopify Partner
15736 2353 3051

Hello @geobertz ,

Recently we launched custom pricing app and its free.

Login to your shopify partner account go to your app and select the option.

Please refer screen shot: 

oscprofessional_0-1677501010265.png

You can manage your app pricing here.

 

Thanks ......

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Custom Pricing Wholesale App : Free | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing
geobertz
Shopify Partner
22 0 20

Oh i see and just set billing to undefined right? 
Thank you so much

geobertz
AndyHung
Shopify Partner
59 0 15

Hi @oscprofessional ,

I also setup 14-days trial, but I don't know when trial ends, how can I update remain trial days in database? Do you have solution for this?