© 2025 MkSaaS All Rights Reserved. MkSaaS Credits Module Deep dive into MkSaaS template's credits module, including credit purchases, subscription grants, expiration management, transaction records, and pay-per-use features, helping you build flexible business models
The credits module is an important feature in modern SaaS applications, enabling you to implement flexible pay-per-use models, reward user behavior, and support diverse business models. The MkSaaS template includes a complete, flexible, and modular credits module, providing an out-of-the-box credits management solution for your SaaS application.
This article provides a detailed introduction to the core features of the MkSaaS credits module, helping you fully understand this powerful credits management system.
The MkSaaS credits module is more than just a simple credits counter—it's a complete, flexible, secure, and reliable credits management solution:
💰 Flexible Business Models - Supports multiple models including registration grants, pay-per-use, credit package purchases, and more
🔄 Smart Expiration Management - Supports credit expiration mechanism with FIFO (First In First Out) strategy for automatic credit consumption management
📊 Complete Transaction Records - Detailed records of all credit changes, including purchases, usage, expiration, grants, and more
🎯 Pay-Per-Use - Perfect support for usage-based billing models, users consume credits to use features
🔐 Secure & Reliable - All credit operations are validated and protected through Server Actions
🌍 Internationalization Support - Built-in multi-language support, credit package names and descriptions are translatable The MkSaaS credits module supports multiple credit acquisition methods, allowing you to flexibly configure based on business needs:
Subscription Plan Credit Grants
Each subscription plan can be configured with monthly credit amounts
Supports setting different credit amounts for different subscription plans
Credits can have expiration times, automatically expiring when due
System automatically grants credits when subscriptions renew
Registration Credit Grants
New users can automatically receive initial credits upon registration
Configurable credit amounts and expiration days
Helps new users quickly experience product features
Configurable option to allow free users to purchase credit packages
Supports subscribed users purchasing additional credit packages to increase credits
Supports multiple credit packages, each with different credit amounts and prices
Seamless integration with Stripe payment system, supports secure online payments
Free users can also receive monthly free credits
Supports configuring monthly credit amounts and validity periods for free plans
Helps free users continue using the product
Lifetime Plan Monthly Grants
Lifetime subscription users can receive monthly credits
Supports configuring monthly credit grants for lifetime plans
Credit consumption is one of the core features of the credits module. MkSaaS provides an intelligent and secure credit consumption mechanism:
FIFO Consumption Strategy
Uses First In First Out (FIFO) strategy for credit consumption
Prioritizes consuming credits that are about to expire, avoiding credit waste
Automatically handles credit expiration, ensuring user credit balance is always valid
Automatically checks user credit balance before using features
Prevents operations when credits are insufficient, avoiding credit abuse
Real-time credit balance updates, ensuring accurate credit balance
Each credit consumption records detailed transaction information
Includes consumption time, amount, usage scenario, etc.
Users can view complete credit consumption history
The MkSaaS credits module completely records all credit changes, allowing you and users to clearly understand credit flow:
Package Purchase - Records of users purchasing credit packages
Subscription Renewal - Credits granted when subscription plans renew
Registration Grant - Credits received by new users upon registration
Monthly Refresh - Credits received by free users monthly
Lifetime Monthly - Credits received by lifetime users monthly
Usage Consumption - Credits consumed when users use features
Expiration - Records when credits expire
Each transaction record includes time, type, amount, description, and other information
Supports viewing historical transaction records for reconciliation and auditing
Provides credit statistics, including total earned, total consumed, current balance, etc.
The credit expiration feature allows you to control credit validity periods and promote user engagement:
Flexible Expiration Configuration
Can set different expiration days for each credit package
Can set expiration times for registration grants
Can set expiration times for subscription plan grants
Supports permanently valid credits (no expiration time set)
Automatic Expiration Processing
System automatically detects expired credits
Batch processes expired credits through scheduled tasks
Expired credits are automatically deducted from user balance
Records expiration transactions for tracking
The credit package feature allows users to purchase credits without subscribing, meeting pay-per-use needs:
Supports defining multiple credit packages (Basic, Standard, Premium, Enterprise, etc.)
Each package can have different credit amounts and prices
Supports marking popular packages for highlighting recommendations
Package information supports internationalization translation
Flexible Purchase Strategy
Configurable option to allow free users to purchase credit packages
By default, only paid subscription users can purchase, but can be opened to all users
Integrated with Stripe payment system, supports secure online payments
Beautiful credit package display interface
Clear price and credit amount display
Supports package comparison to help users choose
MkSaaS uses Zustand state management library to globally manage credit status in the application:
Credit balance is managed uniformly in global state
All components can access the latest credit balance in real-time
Global state automatically updates when credits change
Automatic Synchronization
Credits automatically sync to global state after purchase or consumption
No manual refresh needed, smooth user experience
Ensures UI-displayed credit balance is always accurate
All credit operations are performed through Server Actions, ensuring security and data consistency:
All credit operations are executed on the server side
Clients cannot directly modify credit data
Prevents malicious credit tampering
Each credit operation validates parameters
Checks user permissions and credit balance
Ensures operation legality and security
The MkSaaS credits module is suitable for various business scenarios:
Users consume credits to use AI features (such as image generation, text processing, etc.)
Each API call consumes a certain amount of credits
Supports different credit consumption for different features
Content Generation Services
Users use credits to generate content
Credits consumed based on content length or complexity
Supports batch generation features
Provides API services for third-party developers
Credits consumed per API call
Supports different credit prices for different APIs
Use credits to unlock premium features
One-time credit consumption to unlock features
Supports feature packages and single feature purchases
The MkSaaS credits module is a complete, flexible, secure, and reliable credits management solution. It supports multiple credit acquisition methods, intelligent consumption mechanisms, complete transaction records, flexible expiration management, and secure operation protection. Whether you want to implement pay-per-use, reward user behavior, or build complex business models, the MkSaaS credits module can meet your needs.
Through the MkSaaS credits module, you can:
🎯 Implement Flexible Pay-Per-Use Models - Supports usage-based billing, users consume credits to use features
💰 Support Multiple Credit Acquisition and Consumption Methods - Registration grants, subscription grants, package purchases, and more
📊 Complete Records of All Credit Transactions - Detailed records of all credit changes, including purchases, usage, expiration, grants, etc.
🔄 Intelligent Credit Expiration Management - Uses FIFO strategy to automatically manage credit consumption and expiration
🔐 Ensure Credit Operation Security - All operations are validated and protected through Server Actions
🌍 Support Internationalization - Built-in multi-language support, credit package names and descriptions are translatable
Newsletter Join the community
Subscribe to our newsletter for the latest news and updates
View credits usage statistics
MkSaaS Credits Module | MkSaaS - Make Your AI SaaS Product in a Weekend