Gravity comes with subscription payments out-of-the box using Stripe. Users can enter their credit card when they sign up and will be charged each month. To allow users to signup without a credit card, please see the section on free accounts.
The Stripe model is located in /model directory.


If you'd like to offer a trial period before a user's card is charged, you can configure the Trial days parameter in your Stripe dashboard. See the section on Stripe setup for more details.

Failed Payments

If a card payment fails, Stripe will re-try to charge the card as per your subscription settings and email the customer. If a customer needs to update their card details, Stripe will include a link to your billing settings.
Configure your billing link in Stripe to: so the customer can log into your app and update their card.

Handling Cancelled Subscriptions

If all retries have failed then the subscription is marked as cancelled.
The default behaviour is to inform the user the next time they sign in and prompt them to upgrade (they will need to create a new subscription or choose the free plan).
However, it's totally up to you how you want to handle this – you may want to close the customers account completely or automatically move them onto your free plan with the option to upgrade and create a new subscription later.
When a user opens into your app, the subscription status is checked using the accountController.subscription method. You can add custom logic in here for handling a cancelled subscription.

3D Secure Authentication

Strong Customer Authentication (SCA) is included with Gravity - you don't need to do anything to activate it.
When charging a European card, the customer's bank may ask for further verification. If this happens a 3D secure pop-up will be displayed and the user can perform the validation in-app.
If a subscription payment requires verification while the user is off-app you should enable the Send a Stripe-hosted link for cardholders to authenticate when required option in your Stripe settings.
This will send an email to the customer to complete the verification. They will also be directed to the billing view the next time they log into your app and will see a message to check their email and verify the payment.

Per-Seat Billing

Gravity supports per-seat (or per-user) billing so you can charge an account owner based on the number of users on their account.
When a new user accepts an invite, they will be added to the subscription for that account. If they are removed from the account they will be removed from the subscription.
It's disabled by default. You can toggle this behaviour on or off in the config file:
"seat_billing": false,
You should also enable it in the Mission Control config file too.

Enabling Volume Billing in Stripe

Per-seat billing using the volume pricing in Stripe. You need to create a new price and set the pricing model to volume pricing.
Then, set the price per unit to whatever you want to charge per seat. Gravity will add or subtract a unit from the subscription when a new user is added or deleted.