To monetize a side project, I'd expect to need a payment platform (covered by stripe or paypal), and a license server. The latter would need a flexible configuration, in my case generate and later validate a license key for:
- up to 100 transactions for free
- up to 500 transactions for say $100
- anything exceeding that for say $500
(the numbers are random). There must be good license server freeware out there, but I can't find it. What should I google for?
What's your project implemented in? Do you have a server component already?
I'm considering a Firebase solution for a project that doesn't have an online component yet. The payment success webhook would trigger a Firebase cloud function that adds the user's email address to e.g. a Firestore database. You would then make the user login with their email in your app using Firebase and you could check if their email address was in the database before you allowed access.
This way you don't have to muck around with license keys, licenses are tied to email addresses so they're less likely to get shared, Firebase's servers will easily cope with the traffic and the Firebase login library functions deal with most of the hard work for you. Firebase's free tier is also very generous so it would be free for large number of users.
Thanks for your reply. I foresee a Spring Boot application, either batch or jetty. Ideally, the customer would aquire a license (and pay) on a third-party system, and my API could validate the key against that system. https://netlicensing.io might be something to look at.
What does netlicensing or something similar give you if you're running your own server anyway? Couldn't you generate your own license key when a payment is received and store this in a table on your server?
The product would be a JAR downloaded and run by the customer. Part of the setup process would involve getting and configuring a license key. That customer-side code would verify license on startup. The component "my own server" is exactly the part I'm hoping to avoid needing.
I was thinking about a possible solution to this problem at one point. I think it wouldn't be that hard to do it by yourself.
If you're expecting low amount of traffic (= all requests can hit your origin), you could do a simple-ish express.js middleware, which does the following (in pseudocode):
Right? I think it would be few extra lines to add counting of the requests to that middleware too with its own memcache key.
If you have a ton of requests, then I'd just make this its own scaleable microservice that can act as a gateway between your origin and the end user.
There's a "stripe" in your pseudo code. Is that coincidence, or does Stripe provide a licensing feature? If it does I didn't find it...
As far as I know, Stripe can tell you which of your items are purchased by which user. So that pseudocode would check from stripe that is the user a paid user (= ongoing subscription), or not.
I think it should be fairly straightforward to add support for multiple different tiers too: You would need to get the name of ongoing subscription of the user from Stripe, and map it to number of requests per day. Then you could check if the user has exceeded that amount of requests to your API.