Integration/Credits

From aMember Pro Documentation
Revision as of 07:36, 20 September 2012 by Alex-scott (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

  1. Code to deduct "credits" must be implemented by your system!
  2. Credits are not expiring with subscription (!). aMember does not take account of subscription dates at all when accounting credits
  3. Once accounted, credit records are not updated if product setting changed
// 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();