How to sell prepaid credits for an API
To sell prepaid credits for an API, create a meter for the activity, create a Usage credits benefit for that meter, and attach the benefit to a product. Buyers pay by card and receive units, your app spends them, and Ruba tracks the balance. Ruba pays you to your own bank.
Why credits are friendly to small sellers
Ruba sells prepaid credits for 4% + $0.50 a sale, and usage draws them down. Imtiaz in Chattogram sells an image-resizing API. Customers pay him once, and he does not want to chase small invoices later. With prepaid credits, customers buy a pack, say 10,000 calls, and spend them as they go. The money comes first.
That also protects your costs. If every call costs you something, a customer cannot use more than they paid for.
Credits first, overage second
Here is the order. Your application sends an event to a meter. Ruba checks the customer’s balance. Credits are used first. Only when the balance is zero does extra usage become billable, and only if the product has a metered price.
- 1Buyer pays for a packUnits are issued.
- 2App spends unitsEach event uses some.
- 3Balance reaches zeroRuba does not charge more.
- 4Your app decidesBlock, or offer a top-up.
- 1Buyer pays for a packUnits are issued.
- 2App spends unitsCredits go first.
- 3Balance reaches zeroExtra use is overage.
- 4Ruba bills overageOn the subscription invoice.
Set it up, step by step
- Step 1Create a meterFor the activity you bill.
- Step 2Create the benefitUsage credits, with units.
- Step 3Choose rolloverCarry unused credits or not.
- Step 4Attach itTo a one-time or recurring product.
A one-time product issues its units once after purchase. A subscription issues them at the start of each billing cycle.
Read the balance in your app
Ruba does not block a customer at zero. Your app reads the balance and decides. Use the Customer Meters API for credited, consumed and remaining units.
import { Ruba } from "@getruba/sdk";
const ruba = new Ruba({
accessToken: process.env.RUBA_ACCESS_TOKEN ?? "",
server: "sandbox",
});
const meters = await ruba.customerMeters.list({
customerId: "<customer_id>",
});
for await (const page of meters) {
for (const meter of page.result.items) {
console.log(meter.meterId, meter.creditedUnits);
}
}What to do next
Ruba charges 4% + $0.50 per sale, with no monthly fee, and pays you in PKR, INR or BDT to your own bank. Money is ready 7 days after a sale, and payouts start at $10 after the fee. Apply for Ruba early access. Next: usage-based billing for an AI app.
Buyers pay first, then spend. You are never chasing an invoice. Nothing monthly to pay, and no company required. Early access gets your API credits a rate of 4% + $0.50 per sale, locked once you are approved and for as long as the account is open and in good standing. Ruba promises that a fee it never told you about is refunded, and that you get $100. Terms apply. See the early-access deal.
Questions people ask
What are credits in Ruba?
Credits are prepaid units attached to a Usage Meter. When an event reaches that meter, Ruba uses the customer’s available units first and bills any metered overage only after the balance reaches zero.
How do customers get credits?
Through a Usage credits benefit attached to a product. For a one-time product, the units are issued once after purchase. For a subscription, they are issued at the start of each billing cycle.
Do unused credits carry over?
Only if you turn on Carry unused credits over. It affects newly issued credits, not credits already granted.
Can I do credits with no overage at all?
Yes. Leave the product without a metered price for that meter, and the customer only spends what they bought.
Why not send negative events to model credits?
Do not do it. Negative events can change a Sum meter, but they are not recorded as first-class credited units. Use the Usage credits benefit.
Sources
We check these when we update this guide. Rules can change, so check them yourself before you decide.
- Ruba: usage creditsChecked 26 Nov 2026
- Ruba: fund usage after a purchaseChecked 26 Nov 2026
- Ruba: metersChecked 26 Nov 2026
- Ruba: record billable activityChecked 26 Nov 2026
- Ruba: pricing and feesChecked 26 Nov 2026