Integration/Credits
From aMember Pro Documentation
Revision as of 07:37, 20 September 2012 by Alex-scott (Talk | contribs)
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
- Sell limited count of downloads from big files catalog
- Sell time-based access to website or software
- Sell service tickets
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
require_once 'path/to/amember/bootstrap.php'; // no comment Am_Di::getInstance()->plugins_misc->loadGet('credits')->debit(120); // with comment Am_Di::getInstance()->plugins_misc->loadGet('credits')->debit(120, "Used 120 credits"); // debit 120 credits from user# 1234 Am_Di::getInstance()->plugins_misc->loadGet('credits')->debit(120, "Used 120 credits", 1234); // balance - get current number of credits Am_Di::getInstance()->plugins_misc->loadGet('credits')->balance();