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.
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.
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.
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.
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.
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?