# Software as a service

In application it is possible to sell the subscriptions and get recurring revenue from the customers. Before starting with the subscription is is required to enable them in the **/admin** area under **Settings** page.

{% hint style="info" %}
When enabling subscription in settings, fill all organisation options so it will be possible to generate full fledged invoices.
{% endhint %}

Before customers can subscribe to a plan it is required to create a plans. Plan can be created in admin. It is possible to set the price, duration and per user options for the plan. After creating the subscription from the plan it is possible to change these options in subscription for particular users if needed.

{% hint style="info" %}
In plans it is **NOT** possible to set more granular options like which modules will be enable in the current plan.
{% endhint %}

**The flow of buying a subscription for a customer looks like:**

1. Under the organisation setting customer selects a plan
2. After selecting the plan customer is asked to select the payment gateway
3. If the payment gateway is Stripe, user is redirected to Stripe checkout
4. The background cron job is scheduling new Stripe payments if they are needed
5. After successful payment invoice is created

In case of selecting **offline payment**, customer is not charged immediately but the transfer must be made in for example by using wire transfer. Then the administrator must manually check the bank account and approve the subscriptions. This must be repeated each interval which is set for subscription because the subscription will expire. For extending the subscription in admin just click on **Pay** link.

Below you can find all additional configuration settings for .env file. After setting these parameter customers will be able to use Stripe for recurring payments. Otherwise only the offline payments will be available.

{% code title=".env" %}

```
STRIPE_PUBLISHABLE_KEY=key
STRIPE_SECRET_KEY=secret
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codevision.gitbook.io/craft/saas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
