Skip to main content
The read-only credit attribute of the Account object holds the current credits available to the Account. Use the grantCredit and revokeCredit calls to manipulate credit. These methods generate appropriate audit trails of credit changes. Do not set the value of this attribute directly. (For example, when creating a new Account object by calling update().) Note: Use token-related methods such as Account.incrementTokens() or decrementTokens\(\) to manipulate tokens available to the Account. Subscribe can handle tokens both as payment methods outside the credit framework, and as part of the credit system. Although you can use Tokens interchangeably across the two systems, Vindicia recommends that in your implementation, you choose one system, rather than mixing the two. If you have not previously implemented a token-as-payment-method system, choose credit-based token management, because the Credit object allows you to abstract the type of credit, and therefore offers more flexibility for future replacement.

Granting Credit to an Account

If a customer performs a specific activity at your site, you may choose to give that customer credit. For example, if a customer redeems a phone card, a cell phone company may add a number of cell phone minutes to the customer’s account. You may also apply currency credits to the account. Use the Credit’s name-value pairs to define the reason for the Grant, and to provide another field by which your Credit activity may be analyzed. Use Account.grantCredit to add credit to an Account:
Note: Subscribe does not allow you to grant time-based credit to an Account object.

Revoking Credit from an Account

For some customer activities, you might revoke credit from the customer’s account. For example, if a customer uses airline frequent flier miles to book a flight, an airline company would deduct frequent flier miles from the customer’s account. If you accept currency credits, you may also deduct currency from the account. Use Account.revokeCredit to deduct credit from an Account:
Note: If the amount of token-based credit to be revoked results in a negative balance, Subscribe sets the balance to 0.

Using Credits for a One-Time Transaction

One-time transactions may use credit available to an Account. To use Credits for one-time transactions, make certain that the Transaction object includes a PaymentMethod that matches the currency or token type you wish to use to conduct the transaction. If the customer Account has enough credit to support the transaction, Subscribe authorizes the transaction, and adds a new transaction item to the Transaction object returned to you in response to your authCapture() call. This transaction item has its sku attribute set to VIN_Credit, and its price set to a negative value (equivalent to the amount of the transaction), signifying that Subscribe deducted the credit from the customer’s account. Note: You can also have Subscribe process a one-time transaction that does not consume available currency credits. In the Transaction object, populate the name-value pair vin:ignoreCredits = true and the Transaction will charge against the payment method, using no currency credits. Create a one-time credit transaction:

Fetching Account Credit History

Subscribe maintains a log of credit-related events for each Account. This log keeps track of various credit-related events such as credit granted, revoked, consumed, or earned from a gift card redemption. Retrieve the audit log by calling the Account object’s fetchCreditHistory() method. The method includes paging and a time range, so you can limit the number of records returned. It returns an array of CreditEventLog objects. Each CreditEventLog object holds the Credit object, a timestamp, the type of activity performed with the Credit object, and a note text field. Call Account.fetchCreditHistory:
Parent topic:Working with Credit