Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Do not reset remaining days from trial on uninstall #958

Closed
geiszla opened this issue Aug 3, 2023 · 4 comments · Fixed by #979
Closed

Do not reset remaining days from trial on uninstall #958

geiszla opened this issue Aug 3, 2023 · 4 comments · Fixed by #979

Comments

@geiszla
Copy link

geiszla commented Aug 3, 2023

Overview

We have a problem, where the trial period always resets when the user reinstalls the app. I've also read that this can be a feature, however for us it's definitely a bug, since anyone can just reinstall our app to use it for free forever.

There are a few community answers to solve this, however all of them includes changing the trialDays when requesting the recurring application charge. As far as I can see, the current implementation takes the trial days from the billing config, which can only be specified when creating the shopifyApp instance.

One option would be copying the config object with the new trial days, then using validateConfig manually on in, then passing it to the request factory function to create a request function. However, this does not seem like an intended way to use this library.

Is there any other way to do this that I missed? Otherwise, I think it would be great if we could pass the trialDays in when using the shopify.api.billing.request function to implement protection against indefinite free use of an app.

@daviareias
Copy link

You should handle this in your database by saving the first install date. Shopify seems to be using cookies for everything in this example, but I don't think it's a good approach for this case since you can have several users/browsers reinstalling the app.

@geiszla
Copy link
Author

geiszla commented Aug 12, 2023

@daviareias Thanks for your answer. My problem is not how I track the trial, it's how I enforce it. As far as I know Shopify will charge the merchant as soon as the trial ends. My issue is that I cannot find an obvious way of setting different trial days for different users (e.g. the user who uses my app for 2 days, then reinstalls it should have 2 less days of trials than a completely new user).

I see 3 solutions (all of them looks somewhat or completely hacky):

  1. Create a new shopifyApp instance when a new user comes to set the proper trial days (sounds error prone, and I don't think it was intended to be used this way).
  2. Create a new config, validate it manually, then create a request function (as described in the OP) to use to request a subscription for the current user.
  3. Create as many billing plans as there are trial days and pass them all in the initial config to one instance of shopifyApp. This seems to be the most "innocent" solution, but also the ugliest.

Let me know if I missed something or misunderstood how this should be done.

@paulomarg
Copy link
Contributor

Hey folks, thanks for reporting this. I think we can help remedy this by allowing an optional override for trialDays when you're calling request!

@geiszla
Copy link
Author

geiszla commented Sep 4, 2023

Hey folks, thanks for reporting this. I think we can help remedy this by allowing an optional override for trialDays when you're calling request!

That would be perfect, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants