Managing Usage Credits

Managing credits in Moesif is easy to do and can be done through the Moesif UI, via a Company Profile, or through Moesif’s API. Unlike many billing providers, which manage an available balance at the customer level, Moesif can segregate available funds based on subscription.

For instance, a company may be subscribed to two pay-as-you-go plans. They would like to add $100 to plan A and $1000 to plan B. Traditionally, when managed at the billing provider level, this would just be shown as an available balance of $1100 at the customer level that could be freely spent between subscriptions. This makes it hard to control spending for a specific subscription if you have multiple. With Moesif, you can add the balance to each specific subscription to ensure that spending is controlled at the subscription (or service) level.

Usage Credit Fields

When managing your customer’s balances in Moesif, there are three fields and values that a company’s profile contains to be aware of.

Current Balance

This value is the current balance without factoring in any pending activity/transactions that have not been processed yet.

Pending Activity

This is the activity/transactions (credits or debits) that have not yet been posted. This value is mutable and the value can change up until the transaction is posted. Once posted, this will be reflected in the updated Current Balance field and removed from the amount under Pending Activity.

For example, if there is API usage or credits that have been added to an account, you will see the corresponding amount here until it has been posted.

Available Balance

From a usage perspective, this amount is the most important as it dictates what credits a user has left to spend, in a pre-paid scenario. This value is the amount of credits/$ that are left for the user to consume. This amount is equal to (Current Balance + (plus) Pending Activity).

For example, if my current balance is $1000 and I have a $250 debit transaction pending, my available balance will be $750. Below is a table to demonstrate this:

Field Value
Current Balance $1000
Pending Activity $250
Available Balance $750

Credit Balance Behavior

Stripe doesn’t support prepaid subscriptions. To help you implement prepaid credits-based systems easily with Stripe, Moesif supports automatic application of credits to Stripe invoices. It builds on top of Moesif’s real-time credits consumption and usage tracking system.

Key Features

  • Automatically apply credits to Stripe invoices.
  • Customize behavior for zero credit balance.

Limitations

  • Only supported for Stripe.
  • Only supported for per-unit and package pricing.

How It Works

This feature automatically applies credits to Stripe invoices. When creating a Billing Meter, you can choose between these options to control how Moesif applies credits:

Bill Customer (Default)

This option creates Stripe credits for the customer if a positive subscription balance exists in Moesif. Specifically, the Available Balance must have a positive amount.

Stripe credits the customer’s credit balance by the specific usage amount it receives from Moesif. The credit adjustment amount can go up to the amount of subscription balance you have. After the adjustment, Stripe then applies the remaining balance to the finalized invoice.

Here’s an example that walks you through how this option works:

  • You have $20 as Available Balance in Moesif. You also have an active subscripiton that expires at a certain time.
  • While your subscription is active, Moesif tracks a $12 usage for your subscription. It meters the usage and sends the usage details to Stripe.
  • Stripe creates an invoice for the usage.
    • Assume that the positive $20 Available Balance still exists at the time Moesif sends the usage.
      • Stripe performs a credit adjustment of $12 against the credit balance. Your remaining balance comes down to ($20-$12) = $8.
      • Stripe finalizes the invoice for $0.
    • If the subscription balance goes to $0, or below $0, or no balance exists, Stripe doesn’t apply any credits. Rather, it invoices the customer for the full usage amount $12.

The following table shows some more example scenarios with different amounts:

Available Balance Usage Stripe credits Invoice
$20 $5 $5 $0
$20 $20 $20 $0
$20 $27 $20 $7
$0 $27 $0 $27
-$5 $27 $0 $27
Example Use Case

A hybrid model where customer can pay in advance for credits, but you want to bill overage charges in a postpaid manner. In addition, the postpaid amount can differ from the discount for prepaid credits.

Zero Out Invoices

This option always creates Stripe credits to balance usage. Moesif sends the usage amounts as usual, but invoices will be zeroed out with credits. This option allows you to invoice customers manually or through another system. Choose this option if you want to use Stripe for usage monitoring only and use an alternative method for billing or invoicing.

This option works the same way as Bill Customer, except that the amount of credits always equals the usage amount. Here’s a table showing some example scenarios:

Available Balance Usage Stripe credits Invoice
$20 $5 $5 $0
$20 $20 $20 $0
$20 $27 $27 $0
$0 $27 $27 $0
-$5 $27 $27 $0
Example Use Case

If your sales team negotiates with customers for upgrades or custom pricing, you may not want to automatically bill them for overages or cancel their subscription due to insufficient credits. Once you reach an agreement for an upgrade, you manage credits directly.

Updated: