Building Subscription Based Service With Erpnext

Greetings.

I was wondering how I can build a subscription based application around Erpnext. I already know of the Subscription doctype but how can I make it that the system stops giving them services when they haven’t paid and resumes when they pay. I would also like for the users to have a free trial.

Thanks in advance for any help.

Hi there,

Without knowing how your service is delivered, there’s really no way to answer this question. ERPNext has a full API, which you can poll externally at any time, but that process needs to be coded into your service mechanism.

Yeah makes sense, I think I was a bit abstract.

The system currently fetches news and events from a custom doctype in the system and shows some them depending on if the article if free or paid. So the logic is, if a person has a paid, they can see the articles which are paid then if the person hasn’t paid they can’t see the articles and they get a notification to pay again.

Does that help @peterg?

I understand the goal, but you’re still glossing over all the important stuff. When you say “the system” fetches the article, what is the system? Is this a separate server? The ERPNext website module? Some kind of feed?

Frappe has a full permissions, API, and RPC architecture, so what you are wanting is almost certainly possible.

By the system, I mean Frappe via a controller fetches the articles and displays them on a custom designed webpage using Jinja.

I assume you’re talking about a Web Page served by the Website module and not, for example, an external page or a custom desk page. I also assume you’re using the built in authentication system for Website Users with the role “Customer”.

Under those circumstances, it’s all just a matter of how you set up the jinja template. You can check the variable frappe.session.user to identify the customer, use that as a filter to identify the current period’s invoice, and check the outstanding balance field. If it’s zero, show the content; otherwise, direct them to payment options.

That’s actually a very interesting way of doing it, so you wouldn’t go through the hustle of using the Subscription Doctype?

But also, all your assumptions are spot on.

Are you understanding what the Subscription doctype does? All it does is generate Invoices at fixed intervals (with some handy features). It does not itself represent a financial transaction.

That’s makes a lot of sense then, so I can check if the latest invoice has been paid, else I redirect them to the Dashboard with the invoices prompting them to pay?

When you say “Dashboard”, I assume you mean the portal page (a dashboard is something else in ERPNext), but yes that would be one way to do it.

Yes, that is the one.

Another other way you think would be better?