Flowglad: The Revolutionary Payment Tool Every Developer Needs
Webhooks are the silent killer of developer productivity. Every engineer who's integrated Stripe, Paddle, or PayPal knows the pain—endless endpoint configurations, idempotency nightmares, failed retry logic, and state synchronization issues that keep you up at 3 AM. What if you could eliminate this entire class of problems overnight? Enter Flowglad, the open-source payment provider that's redefining how we think about billing infrastructure. With its bold "zero webhooks" philosophy and stateless architecture, Flowglad isn't just another payment wrapper—it's a fundamental reimagining of payment integration. Backed by Y Combinator and built for modern full-stack frameworks, this tool promises to turn hours of webhook debugging into minutes of seamless setup. In this deep dive, we'll explore how Flowglad works, why developers are abandoning traditional providers, and how you can implement it in your Next.js application today with real code examples pulled directly from the repository.
What Is Flowglad?
Flowglad is an open-source, zero webhooks payment provider designed to be the easiest way to make internet money. Founded by a Y Combinator-backed team, this revolutionary tool addresses the most painful aspects of payment integration: state management, webhook handling, and customer ID synchronization. Unlike traditional providers that force you to maintain complex webhook endpoints and duplicate subscription data in your database, Flowglad operates on a stateless-by-default principle. This means you never have to create "subscriptions" database tables, add customer_id columns to your users table, or manage environment variables full of PRICE_ID strings.
The core innovation lies in its single source of truth architecture. Instead of listening for webhook events and updating your local state, you query Flowglad directly for the latest customer billing state, including feature access and usage meter credits. This approach eliminates the risk of your database falling out of sync with your payment provider—a common source of billing disputes and revenue leakage. Flowglad integrates seamlessly with your existing authentication system, using your user IDs, organization IDs, or team IDs rather than forcing you to manage yet another identifier scheme.
What makes Flowglad particularly compelling in 2024 is its full-stack SDK that works identically on backend and frontend. Whether you're calling flowgladServer.getBilling() in your API route or using the useBilling() hook in your React component, the API remains consistent and intuitive. The framework currently offers first-class support for Next.js, React + Express, and other React + Node.js combinations, with more frameworks planned. Developers are flocking to Flowglad because it transforms pricing model iteration from a multi-day deployment nightmare into a single-click dashboard operation, allowing you to test new plans in testmode and push to production instantly without redeploying your application.
Key Features That Eliminate Payment Headaches
Default Stateless Architecture
The webhook elimination is Flowglad's killer feature. Traditional payment integration requires you to maintain at least 5-7 webhook handlers for events like invoice.paid, customer.subscription.updated, and payment_intent.succeeded. Each handler needs idempotency protection, error handling, and retry logic. Flowglad throws this complexity out the window. Your application reads billing state on-demand instead of maintaining it through event streams. This means no more debugging why a webhook failed to fire, no more queueing systems to handle webhook bursts, and no more data inconsistencies when a webhook gets lost in transit.
Single Source of Truth
With Flowglad, you query customer state directly from the source whenever you need it. The getBilling() method returns a comprehensive object containing subscription status, feature access, usage balances, and payment methods—all in real-time. This eliminates the classic problem of stale subscription data in your database. When a customer's payment fails and their subscription cancels, you don't need to wait for a webhook to update your users table. The next time you check billing.checkFeatureAccess(), it automatically reflects the current state. This architecture is particularly powerful for usage-based billing, where metered credits need to be absolutely accurate.
Your IDs, Your Control
Flowglad never requires you to manage its customer IDs. Every method accepts your existing authentication identifiers. For B2C applications, you pass user.id from your database. For B2B SaaS, you use organization.id or team.id. This design principle extends to pricing as well—you reference prices, features, and usage meters via slugs you define rather than cryptic provider IDs. Your code stays readable and maintainable: checkFeatureAccess('premium_ai_features') is infinitely more understandable than checking against price_1HnXyZABC123.
Full-Stack SDK Symmetry
The SDK provides identical APIs across server and client. The server-side FlowgladServer class and client-side useBilling() hook share the same method signatures for checking feature access, creating checkout sessions, and retrieving pricing models. This symmetry drastically reduces context switching and allows you to write billing logic once and use it everywhere. The React hooks are built with performance in mind, providing loaded states and error boundaries to ensure smooth user experiences.
Adaptable Pricing Without Code Changes
Iterate on pricing models in testmode and deploy to production with a single click. Flowglad's dashboard lets you create complex pricing structures—tiered subscriptions, usage-based meters, one-time purchases—and activate them instantly. Your application code references features by slug, so changing which features belong to which plan requires zero code deployment. This agility is game-changing for startups experimenting with pricing or enterprises running A/B tests on plan structures.
Real-World Use Cases Where Flowglad Shines
SaaS Subscription Management
Imagine you're building a project management tool with Starter, Pro, and Enterprise tiers. Traditional integration would require webhook handlers to update subscription status, sync feature flags, and manage seat counts. With Flowglad, you simply wrap your features in the FeatureGate component. When a user upgrades from Starter to Pro, the change is immediately reflected the next time they load a page—no webhook processing delay, no database updates. Your backend can check billing.checkFeatureAccess('unlimited_projects') on every request, ensuring consistent enforcement across your entire stack.
AI Platform Usage-Based Billing
Consider an AI image generation platform where users buy credits for GPU time. This is historically complex: you need to decrement credits, handle overages, and prevent race conditions. Flowglad's usage meter system handles this elegantly. When a user submits a generation request, you call billing.checkUsageBalance('gpu_credits'). If they have sufficient balance, you process the request and Flowglad automatically tracks consumption. The meter updates in real-time, so users see their remaining credits instantly. No custom credit tracking tables, no atomic decrement operations, no billing disputes from inconsistent state.
B2B Multi-Tenant Feature Flagging
For B2B SaaS applications where organizations (not individual users) are the customers, Flowglad's external ID system is perfect. Each organization has its own subscription, but multiple users belong to that organization. You pass organization.id as the customer external ID, and all users in that organization inherit the same feature access. When the organization upgrades, every team member sees new features immediately. This model also supports per-seat billing—Flowglad can track how many active users belong to an organization and enforce seat limits without you writing custom logic.
Marketplace Commission Structures
Building a marketplace where you take a percentage of seller revenue? Flowglad's adaptable pricing models can handle complex commission tiers. Create usage meters for gross_merchant_volume and define different commission rates based on volume thresholds. The platform automatically calculates your commission, and sellers can see their current tier and next-tier benefits in real-time. When they cross a volume threshold, Flowglad automatically applies the new commission rate—no manual intervention, no proration headaches.
Step-by-Step Installation & Setup Guide
Initial Package Installation
Flowglad offers framework-specific packages to ensure optimal integration. Choose the combination that matches your stack:
# For Next.js 13+ with App Router
bun add @flowglad/nextjs
# For React + Express.js applications
bun add @flowglad/react @flowglad/express
# For other React + Node.js frameworks
bun add @flowglad/react @flowglad/server
The Next.js package is the most comprehensive, providing both server and client utilities in one dependency. The modular approach for other frameworks keeps bundle sizes minimal by only including what you need.
Server Client Configuration
Create a utility file that generates your Flowglad server instance. This is the core configuration that bridges your authentication system with Flowglad's billing engine:
// lib/flowglad.ts
import { FlowgladServer } from '@flowglad/nextjs/server'
export const flowglad = (customerExternalId: string) => {
return new FlowgladServer({
customerExternalId,
getCustomerDetails: async (externalId) => {
// Query your database using YOUR user/org ID
const user = await db.users.findOne({ id: externalId })
if (!user) throw new Error('User not found')
// Return customer info Flowglad needs for billing
return {
email: user.email,
name: user.name
}
},
})
}
The customerExternalId parameter is your identifier—this could be a user ID, organization ID, or team ID. The getCustomerDetails callback lets you fetch customer information from your database on-demand, keeping Flowglad's records in sync without webhooks.
API Route Handler Setup
Flowglad requires a secure communication channel between its SDK and your backend. Create a catch-all API route that handles these requests:
// app/api/flowglad/[...path]/route.ts
import { nextRouteHandler } from '@flowglad/nextjs/server'
import { flowglad } from '@/utils/flowglad'
export const { GET, POST } = nextRouteHandler({
flowglad,
getCustomerExternalId: async (req) => {
// Extract authenticated user from session/token
const userId = await getUserIdFromRequest(req)
if (!userId) throw new Error('User not authenticated')
// Return YOUR ID—Flowglad handles the rest
return userId
},
})
The getCustomerExternalId function is critical for security—it ensures only authenticated users can access their own billing data. This is where you integrate with your JWT validation, session management, or auth provider.
Provider Component Integration
Wrap your application with the FlowgladProvider to enable client-side billing hooks:
// app/layout.tsx (App Router)
import { FlowgladProvider } from '@flowglad/nextjs'
export default function RootLayout({ children }) {
return (
<html>
<body>
<FlowgladProvider>
{children}
</FlowgladProvider>
</body>
</html>
)
}
This provider manages billing state synchronization across your component tree, caching responses and handling revalidation automatically. Place it as high as possible in your component hierarchy to ensure all child components can access billing data.
Environment Configuration
Add your Flowglad API keys to your environment file:
# .env.local
FLOWGLAD_SECRET_KEY=sk_live_...
FLOWGLAD_PUBLISHABLE_KEY=pk_live_...
FLOWGLAD_WEBHOOK_SECRET=whsec_... # Only needed if you opt into webhooks
Note: While Flowglad is zero-webhooks by design, you can still receive webhooks for custom integrations if needed. The secret is optional and only required for advanced scenarios.
REAL Code Examples from the Repository
Frontend Feature Access Control
This production-ready component demonstrates how to gate features based on subscription tiers:
'use client'
import { useBilling } from '@flowglad/nextjs'
export function FeatureGate({ featureSlug, children }) {
const { loaded, errors, checkFeatureAccess } = useBilling()
// Show loading state while billing data fetches
if (!loaded || !checkFeatureAccess) {
return <p>Loading billing state…</p>
}
// Gracefully handle API errors
if (errors?.length) {
return <p>Unable to load billing data right now.</p>
}
// Check feature access and render accordingly
return checkFeatureAccess(featureSlug)
? children // User has access—render children
: <p>You need to upgrade to unlock this feature.</p> // Show upgrade prompt
}
Implementation Pattern: Use this component anywhere you need feature gating. The featureSlug prop should match the slug you defined in your Flowglad dashboard (e.g., 'advanced_analytics', 'unlimited_storage'). The component handles all loading and error states, preventing flash-of-unauthorized-content issues.
Dynamic Pricing Page with Checkout
Build a self-updating pricing page that stays in sync with your dashboard changes:
import { useBilling, usePricing } from '@flowglad/nextjs'
export function PricingCards() {
const pricingModel = usePricing()
const { createCheckoutSession } = useBilling()
// Wait for pricing data to load
if (!pricingModel) {
return <p>Loading pricing…</p>
}
return (
<div>
{pricingModel.products.map((product) => {
// Use default price or first available price
const defaultPrice = product.defaultPrice ?? product.prices?.[0]
if (!defaultPrice) return null
return (
<div key={product.id}>
<h3>{product.name}</h3>
<p>{product.description}</p>
<button
onClick={() =>
createCheckoutSession({
priceSlug: defaultPrice.slug, // Reference by slug, not ID
successUrl: window.location.href,
cancelUrl: window.location.href,
autoRedirect: true, // Immediately redirect to checkout
})
}
>
Choose {defaultPrice.name ?? product.name}
</button>
</div>
)
})}
</div>
)
}
Key Advantage: When you add a new product or change prices in the Flowglad dashboard, this page updates automatically—no code deployment needed. The priceSlug reference decouples your frontend from specific price IDs.
Backend Feature Access Check
Server-side enforcement ensures users can't bypass frontend gating:
import { NextResponse } from 'next/server'
import { flowglad } from '@/utils/flowglad'
const hasFastGenerations = async () => {
const user = await getUser() // Your auth logic
// Get real-time billing state for this user
const billing = await flowglad(user.id).getBilling()
// Check feature access with current data
const hasAccess = billing.checkFeatureAccess('fast_generations')
if (hasAccess) {
// Execute premium feature
return runFastGenerations()
} else {
// Fallback to standard feature
return runNormalGenerations()
}
}
Security Note: Always verify feature access on the backend. Frontend gating improves UX but backend checks prevent API abuse. The getBilling() call is fast and cached, so it won't slow down your endpoints.
Usage Meter Consumption
Implement usage-based billing without custom tracking logic:
import { flowglad } from '@/utils/flowglad'
const processChatMessage = async (params: { chat: string }) => {
const user = await getUser()
// Get billing state with usage meters
const billing = await flowglad(user.id).getBilling()
// Check available credits in real-time
const usage = billing.checkUsageBalance('chat_messages')
if (usage.availableBalance > 0) {
// Process the chat request
return await runChatCompletion(params.chat)
} else {
// Throw clear error for frontend handling
throw Error(`User ${user.id} does not have sufficient usage credits`)
}
}
Usage Pattern: This pattern works for any metered resource—API calls, storage space, AI tokens, or compute minutes. Flowglad automatically tracks consumption and resets meters according to your billing cycle configuration.
Advanced Usage & Best Practices
Leverage Testmode for Pricing Experiments
Never test pricing changes in production again. Flowglad's testmode lets you clone your live pricing model and experiment freely. Create new plans, adjust feature allocations, and test the entire checkout flow using test cards. When you're satisfied, promote testmode changes to live with one click. This workflow eliminates the risk of breaking live subscriptions during pricing iteration.
Implement Progressive Feature Rollouts
Use Flowglad's feature flags for gradual feature releases. Create a new feature in your dashboard, assign it to a small subset of users (e.g., beta testers), then gradually roll it out by updating which plans include it. Since your code references features by slug, you can change rollout strategy instantly without deployments.
Optimize Performance with Smart Caching
While getBilling() is fast, high-traffic applications should cache billing state per request. In Next.js, cache the result in your API route handler and pass it down to components via props. For client-side hooks, the FlowgladProvider automatically caches responses for 30 seconds by default. Adjust this TTL based on your tolerance for stale data versus API call volume.
Handle Webhook Fallbacks (If Needed)
Though Flowglad is zero-webhooks, you can optionally listen to events for external integrations. For example, sync subscription data to your CRM or trigger onboarding emails. The repository includes webhook verification utilities, ensuring you only process legitimate events. This hybrid approach gives you the best of both worlds: stateless architecture for your app, with optional event-driven workflows for external systems.
Comparison: Flowglad vs Traditional Providers
| Feature | Flowglad | Stripe | Paddle | Lemon Squeezy |
|---|---|---|---|---|
| Webhook Requirement | ❌ Zero webhooks | ✅ Required | ✅ Required | ✅ Required |
| Setup Time | < 5 minutes | 2-4 hours | 1-2 hours | 30-60 minutes |
| Customer ID Management | Your IDs only | Flowglad IDs | Paddle IDs | Lemon Squeezy IDs |
| Open Source | ✅ Yes | ❌ No | ❌ No | ❌ No |
| Pricing Iteration | Dashboard only | Code + Dashboard | Dashboard only | Dashboard only |
| Full-Stack SDK | ✅ Unified API | ⚠️ Separate libs | ⚠️ Limited | ⚠️ Limited |
| Usage-Based Billing | ✅ Built-in | ⚠️ Complex | ✅ Yes | ⚠️ Limited |
| Self-Hosted Option | ✅ Yes | ❌ No | ❌ No | ❌ No |
Why Flowglad Wins: The zero-webhooks architecture alone saves weeks of development time. But combined with open-source flexibility, your-ID mapping, and instant pricing iteration, it becomes the clear choice for modern applications. Traditional providers lock you into their ecosystem; Flowglad adapts to yours.
Frequently Asked Questions
Q: How does Flowglad really work without webhooks?
A: Instead of pushing state changes to your app via webhooks, Flowglad operates on a pull-based model. When you call getBilling(), it queries the current state directly. This is faster than webhook processing and guarantees data consistency. Your app treats Flowglad as the authoritative source, not a secondary sync target.
Q: Can I migrate from Stripe without losing customers? A: Yes. Flowglad provides migration tools that import customers, subscriptions, and payment methods from Stripe. Your customers won't need to re-enter payment details, and you can maintain existing subscription cycles. The migration typically takes under an hour for most applications.
Q: Is Flowglad production-ready for high-volume applications? A: Absolutely. The infrastructure handles thousands of requests per second with sub-100ms response times. The stateless architecture actually improves reliability—there's no webhook queue to back up or fail. Companies processing millions in annual revenue already trust Flowglad.
Q: What happens if Flowglad's API is down? A: The SDK includes graceful degradation. You can configure fallback behavior: cache last-known billing state, allow read-only access, or use circuit breakers to prevent blocking requests. Since you control the integration code, you decide the failover strategy.
Q: How does authentication work with my existing auth system? A: Flowglad never touches your authentication. You pass authenticated user IDs to the SDK, and Flowglad trusts your verification. This means it works with any auth provider—Clerk, Auth0, Firebase, custom JWT, or session cookies. No OAuth flows or token exchanges required.
Q: Can I use Flowglad for one-time payments only?
A: Yes. While Flowglad excels at subscriptions and usage-based billing, it fully supports one-time purchases. Create products with single-payment prices in the dashboard, then use createCheckoutSession() with the price slug. The same feature access patterns apply.
Conclusion: The Future of Payments Is Stateless
Flowglad represents a paradigm shift in how developers integrate payments. By eliminating webhooks, embracing your existing authentication, and providing a unified full-stack SDK, it reduces payment integration from a week-long project to a 5-minute setup. The open-source nature means you're never locked in, and the Y Combinator backing ensures long-term development. Whether you're building a solo SaaS project or scaling a multi-million dollar platform, Flowglad's stateless architecture eliminates entire classes of bugs while giving you unprecedented pricing flexibility.
The repository is actively maintained with weekly releases, a growing community on Discord, and comprehensive examples for every framework. Stop debugging webhooks and start shipping features. Visit the Flowglad GitHub repository today to clone the examples, join the community, and experience the future of payment integration. Your future self will thank you for every hour saved not troubleshooting webhook failures.