Gravity
  • Welcome to Gravity
  • Getting Started
  • Stack
  • Updates
  • Rules For AI
  • Troubleshooting
  • Gravity Server
    • Introduction
    • Installation
      • Install Node.js
      • Database Setup
      • Stripe Setup
      • Mailgun Setup
      • Install Gravity
    • Application Structure
    • REST API
      • API Scopes
      • Webhooks
    • Authentication
      • Email Verification
      • Social Sign On
      • Two-Factor Authentication
    • Authorization
      • Feature Access and Plan Restrictions
      • Permissions (Roles)
    • Config
    • Environment Variables
    • Database Queries
    • Handling Errors
    • Logging
    • Localization
    • Push Notifications
    • Email Notifications
    • User Feedback
    • User Onboarding
    • File Uploads
    • Billing
      • Seat Billing
      • Usage Billing
    • Free Accounts
    • CLI Toolbelt
    • Testing
    • AI Tools
    • Background Jobs
    • Deployment
  • Gravity Web
    • Introduction
    • Tailwind & SCSS
    • Routing
    • Events
    • Authentication
    • Localization
    • Hooks
      • useAPI
      • usePlans
      • usePermissions
    • Components
      • Alert
      • Animate
      • Avatar
      • Badge
      • Breadcrumb
      • Button
      • Calendar
      • Card
      • Chart
      • Checklist
      • Credit Card
      • Detail
      • Dialog
      • Dropdown
      • Feedback
      • Form
      • Grid
      • Header
      • Helper
      • Icon
      • Image
      • Layout
      • Link
      • List
      • Loader
      • Logo
      • Nav
      • Onboarding
      • Pagination
      • Popover
      • Progress
      • Row
      • Search
      • Separator
      • Sheet
      • Social
      • Stat
      • Table
      • Tabs
      • Toast (Notification)
      • Tooltip
      • User
      • View
    • Views
    • Handling Errors
    • Deployment
  • Gravity Native
    • Introduction
    • Prerequisites
    • Installation
    • App Context
    • Authentication
    • Localisation
    • External Linking
    • Handling Errors
    • Navigation
    • Config
    • Events
    • Views
    • Components
      • Badge
      • Blankslate
      • Button
      • Card
      • Chart
      • Form
      • Global
      • Grid
      • Icon
      • List
      • Logo
      • Message
      • Modal
      • Nav
      • Notification
      • Progress Bar
      • Search
      • Separator
      • Social
      • Stat
      • View
    • Push Notifications
    • Payments
    • Building Your App
  • Mission Control
    • Introduction
    • Installation
    • User Management
    • Feedback
    • Events
    • Logs
  • Website Template
    • Introduction
    • Environment Variables
    • Styling
    • Components
      • Article
      • Feature List
      • Footer
      • Hero
      • Layout
      • Pricing
      • Meta Data
      • Nav
      • Testimonial
    • Build and Deploy
Powered by GitBook
On this page
  • Upgrading From Free to Paid
  • Downgrading to Free

Was this helpful?

  1. Gravity Server

Free Accounts

You can offer a free plan to your users' simply by adding a new plan object inside stripe.plans in your config file.

You can name the plan whatever you like, but the id must be set to free

  {
    "id": "free",
    "name": "Hobby",
    "price": 0,
    "interval": 'month',
    "currency": { "name": "usd", "symbol": "$" }
  }

This will bypass the payment and create a user on a free plan. You can then restrict features in your app, if required, based on the user's plan.

Upgrading From Free to Paid

Users on the free plan can upgrade to a paid plan in account/billing If a user is on the free plan and selects a paid plan, the server will return a 402 Payment Required response, which will redirect the user to a payment form.

You can return a 402 status anywhere in your application to force the user to upgrade to a paid plan.

Once the payment has been processed, a new Stripe customer and subscription is created for the user.

The user's plan will be updated in client context so they can immediately access the features for that plan on the front end.

Downgrading to Free

When a user downgrades from a paid to free plan in the billing view, their Stripe subscription will automatically be cancelled at the end of their current billing cycle. They will remain on their paid plan and be able to access the features they paid for until the subscription is cancelled.

PreviousUsage BillingNextCLI Toolbelt

Last updated 1 year ago

Was this helpful?

The cancellation will be handled by a Stripe for customer.subscription.deleted.

webhook