Article · Published December 3, 2026
How I built credit-based pricing for a SaaS without losing count
Credit-based pricing for a SaaS makes sense when each use has a real cost: an AI render or an audio split that I pay for every time. Then you sell credits instead of a subscription priced on a guess about average use. The hard part is that the count of credits must never drift from what was paid and what was used. Here is how I built that in two products.

Why credits fit when every use costs money
Fashnable is my AI virtual try-on for online stores, at fashnable.app: a garment photo becomes a video of an AI model wearing it. Snapstems, at snapstems.com, splits a song into voice, drums and bass. In both, every job calls a paid AI service, so a flat price would make light users overpay and heavy users cost me money.
The unit differs. In Snapstems a standard split costs one credit and a six-part or higher-quality split costs two, whatever the output format. In Fashnable the cost of a render follows its options: length, resolution, and whether a reference face is supplied.
The credit ledger takes credits before the job starts
In both products the balance lives in a database, the ledger, and on the server one function decides what a job costs. When a job is requested, the server first checks the input, then takes the credits, then starts the work. A bad photo or an oversized file costs the user nothing.
Taking credits is written so that two requests arriving at once cannot spend the same credit. The write only succeeds if the balance has not changed since it was read. An account with one credit that fires two splits gets one split and one "out of credits" message.
The payment provider's role, and my server's
Both products sell through Polar, a payment provider. Snapstems offers one credit pack and two monthly plans. The card is entered on Polar's checkout page, never on mine, and Polar hosts the page where a customer manages or cancels a plan. My server opens the checkout for the signed-in account, so the purchase lands on that account.
Credits are added when Polar sends my server a signed payment notice. An unsigned or stale notice is refused. The number of credits comes from which product was bought, never from the amount paid, so a discount cannot change it. Each order is recorded once, in the same database write as the balance, so a notice delivered twice adds credits once.
Failed jobs give credits back, refunded orders take them away
A failed job returns its credits without the user asking. In Fashnable, if a render crashes and the queue retries it, the retry refunds once and stops. In a four-photo shoot where one pose fails, the three photos made are kept and the failed one is refunded.
Money refunds run the other way. When an order is refunded through Polar, the credits it granted are taken back, once. In Fashnable the balance can go below zero if the credits were already spent. Snapstems takes back a share that matches a partial refund, and stops at zero.
Credit expiry, and where a ledger stops
Snapstems keeps two buckets: pack and free credits stay until used, while a monthly plan's credits are replaced at each renewal and removed when the plan ends. Monthly credits are spent first, and a failed job returns credits to the bucket they came from. Fashnable keeps one balance and tells buyers that credits never expire.
A payment notice can get lost, so each product has a tool that compares Polar's orders with the ledger, and I run it by hand. Both products are young, and nothing here is a claim about sales. And if each use cost me almost nothing, I would sell a flat subscription and skip the ledger.
What to decide before selling credits
Three decisions come first. What does one credit buy: a whole job, or a slice that grows with quality and length? What happens on failure: an automatic return, and what about a job that half worked? And do credits expire: never, at each renewal, or when a plan ends?
I settle these with a client before touching the payment provider, because each answer becomes a rule in the ledger and a sentence in the refund policy. If you are weighing credits against a subscription, tell me what one use costs you and I will say how I would count it.
Want something like this?
Tell me what you are building, or what you are still doing by hand, and I will tell you how I would approach it. No commitment.