Skip to main content
The read-only credit attribute of the AutoBill object holds the array of Credit amount objects available to the AutoBill. Do not set this field directly by calling AutoBill.update. Instead, use AutoBill methods such as grantCredit() and revokeCredit() to alter credits available to the AutoBill, and provide an audit trail in the credit log. Currency-, time-, and token-based credits may be used with AutoBill objects. Subscribe manages credits available to an AutoBill object as follows:
  • Subscribe draws currency- and token-based credits from the AutoBill for each periodic transaction it generates for the AutoBill.
  • If the Account associated with the AutoBill also has currency- or token-based credits available to it, when the AutoBill is billed, AutoBill credits are redeemed before Account credits.
  • If an AutoBill has an associated time credit, Subscribe uses this credit before redeeming any token-based or currency credits.
  • Subscribe uses currency and token-based credit to process an AutoBill’s periodic transaction only if both of the following are true:
    • The payment method specified on the AutoBill is a currency or token-based payment method that specifies a type of applicable token.
    • The billing plan associated with the AutoBill has a price listed in terms of the same token type or currency.
  • When Subscribe applies time-based credit to an AutoBill, it adjusts the next billing date of the AutoBill accordingly. For example, a 15-day credit will postpone an AutoBill object’s next billing date by 15 days. Application of such a credit does not generate a transaction.

Granting Credit to an AutoBill

Some situations may require you to extend a customer’s subscription to your site. For example, if a technical problem at your site prevented a customer from accessing the site for two days, a customer service representative might decide to extend the customer’s subscription by two days, to guarantee customer satisfaction. The grantCredit() method of the AutoBill object allows you to add time credit to an AutoBill object to implement such an extension. Use grantCredit to add time credit to an AutoBill:

Revoking Credit from an AutoBill

Some activities a customer performs at your site might revoke credit from an AutoBill object. For example, an online game company might offer subscriptions that are paid for by points a customer earns in the game. If the customer loses some points in the game, the company might deduct the same number of points from the customer’s subscription. (Note: Time-based credit granted to an AutoBill cannot be revoked.) Use revokeCredit to revoke currency or Token-based credits from an AutoBill:
If the amount of currency or token-based credit to be revoked results in a negative balance, Subscribe sets the balance to 0. Disentitlement (loss of customer access to the product) will occur when Subscribe attempts to process the next billing transaction for the AutoBill, and the transaction fails due to insufficient credit.

Fetching AutoBill Credit Transactions

Subscribe stores token- and currency-based periodic transactions in the same way that it stores AutoBill paid for with currency payment methods. Fetch token-based transactions with API calls such as the Transaction object’s fetchByAutoBill() method. These transactions contain a Transaction item with sku attribute set to VIN_Credit, and price attribute set to a negative value equivalent to the amount of the transaction (signifying that Subscribe deducted the credit).

Fetching AutoBill Credit History

Subscribe maintains a log of credit-related events for each AutoBill object. This log tracks credit-related events such as credit granted, revoked, consumed, and earned due to a gift card redemption. Retrieve the audit log with the AutoBill object’s fetchCreditHistory() method. (Because the method includes paging and a time range, you may limit the number of records returned.) fetchCreditHistory() returns an array of CreditEventLog objects. Each CreditEventLog object holds the Credit object used for that specific event, a timestamp, the type of activity performed with the Credit object, and a text note field. Use fetchCreditHistory to return an array of CreditEventLog objects:
Parent topic:Working with Credit