Credits
This plugin allows to sell "credits" - count of credits will be configured in product billing plan settings, and added to user account after purchase. This module does not have any consumer-visible part, it just provides API that developers may use to implement its own "credits" billing system base on aMember.
Sample Usage
Section titled “Sample Usage”- Sell limited count of downloads from big files catalog
- Sell time-based access to website or software
- Sell service tickets
Warnings
Section titled “Warnings”- Code to deduct "credits" must be implemented by your system!
- Credits are not expiring with subscription (!). aMember does not take account of subscription dates at all when accounting credits
- Once accounted, credit records are not updated if product setting changed
Sample source code
Section titled “Sample source code”require_once '/var/www/html/amember/bootstrap.php';
// following code checks that it is running from an authenticated user// context - if user session is checked and user is logged-in to aMember// if user is not logged-in, user will be redirected to login page firstAm_Di::getInstance()->auth->requireLogin();
// now when user is checked, play with credits$creditsModule = Am_Di::getInstance()->plugins_misc->loadGet('credits');// without comment$creditsModule->debit(120);// with comment$creditsModule->debit(120, "Used 120 credits");
// debit 120 credits from user# 1234$creditsModule->debit(120, "Used 120 credits", 1234);
// balance - get current number of creditsecho $creditsModule->balance();Copyright © 2002–2026 www.amember.com. All Rights Reserved.