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

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.