Billing

Gravity comes with subscription payments out-of-the box using Stripe.

Users enter their credit card when they sign up and will be billed each month. To allow users to sign up without a credit card, please see the section on free accounts.

Seat billing and usage billing are also supported out-of-the-box.

Trials

If you'd like to offer a trial period before a user's card is charged, add a trial_period_days value to the Stripe plan in config.

trial_period_days: 5

This is only applied when a user first signs up and selects a plan, not when they upgrade to a paid plan. You can enable this functionality by passing trial_period_days to the stripe.customer.subscribe method.

Failed Payments

If a card payment fails, Stripe will retry 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: https://yourdomain.com/account/billing 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 create a new subscription or choose the free plan.

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.

Last updated