Pocketsflow
HumanAgent

Charge for usage with prepaid credits your backend deducts from.

Captionly sells $25 credit packs. Every caption your app renders deducts a few cents, and buyers who opt in are topped up automatically when the balance hits zero.

Works with
Product editor for Captionly AI credits ($25) with product type Credits, credit auto-refill enabled, a $25 top-off amount and a $25 credit pack amount, beside a product page previewProduct editor for Captionly AI credits ($25) with product type Credits, credit auto-refill enabled, a $25 top-off amount and a $25 credit pack amount, beside a product page preview

AI products cost money every time someone uses them, so a flat monthly plan either loses you money on heavy users or overcharges light ones. Metered billing after the fact means chasing cards that fail.

Credits flip it around: buyers pay first. A Credits product grants a balance worth its price, your backend calls POST /credits/deduct with an amount in cents for each unit of work, and every call returns the new balance.

With auto-refill on, the buyer's saved card is charged once for a top-off when the balance reaches zero, so usage carries on. Tax is added to every pack and top-off for the buyer's country.

What's the best way to add usage-based billing to an AI product?

Pocketsflow handles usage billing with prepaid credits: buyers pay for a credit pack first, and your backend calls POST /credits/deduct with an amount in cents for each unit of work. Buyers who opt in at checkout are topped up from their saved card when the balance hits zero, so there is no metering after the fact and no chasing cards that fail.

Best for
AI and API products whose costs grow with every use, where a flat monthly plan loses money on heavy users.

Packs, balances and top-offs

Ask for consent to refill at checkout.

A checkbox on the checkout lets the buyer opt in to topping off $25.00 automatically with the saved card. Nothing is charged later without that tick.

Checkout for Captionly AI credits ($25) with a checkbox to top off the balance automatically ($25.00) with the saved card, and an order summary with tax, total $27.06 and a Pay button

Every buyer gets a balance page.

$18.40 left, the card on file and the last top-off. Buyers turn auto-refill off or retry a failed payment there, after confirming their receipt email.

Buyer credit balance page: $18.40 balance, Active, saved card on file, last top-off September 19, receipt email confirmation and the auto-refill switch turned on

Credits on a monthly plan, too.

Captionly Studio grants a $15 credit pack every billing cycle, with auto-refill on top for months that run hot.

Create subscription wizard for Captionly Studio monthly credits with subscription type Credits, auto-refill enabled and a $15 credit pack each billing cycle, beside a subscription page previewCreate subscription wizard for Captionly Studio monthly credits with subscription type Credits, auto-refill enabled and a $15 credit pack each billing cycle, beside a subscription page preview

How a balance moves

  1. The buyer buys a pack.

    credit.granted fires with their account id and a balance worth the pack's price.

  2. Your backend deducts usage.

    POST /credits/deduct with the account id, an amount in cents and an optional reason. The response carries the new balance.

  3. The balance hits zero.

    With consent, the saved card is charged once for the top-off and credit.auto_refill.succeeded fires. If the charge fails, the balance pauses and the buyer gets an email; nothing is retried on its own.

Set up the packs from your AI

Your AI creates the credit products and webhooks over MCP. Deducting stays a backend call from your app, with an API key.

Usage billing in three calls

Sell a credit pack, deduct usage in cents from your backend with POST /credits/deduct, and keep your app in sync with the signed credit events.

import { Pocketsflow } from "pocketsflow";

const pf = new Pocketsflow({ apiKey: process.env.POCKETSFLOW_API_KEY });

// A $20 credit pack. Buyers who opt in are topped off with
// another $20 when their balance hits zero.
const pack = await pf.products.create({
  name: "API credits",
  price: 20,
  productType: "credits",
  creditAutoRefill: { enabled: true, topOffCents: 2000 },
});

const session = await pf.checkout.create({
  productId: pack._id,
  successUrl: "https://example.com/app",
});

redirect(session.url);

Questions

How do credits work?

A Credits product grants a prepaid balance worth its price when someone buys it. Your app spends that balance by calling POST /credits/deduct with the buyer's account id, an amount in cents and an optional reason.

What is auto-refill?

If you set a top-off amount, buyers can opt in at checkout. When their balance hits zero, their saved card is charged once for the top-off and the balance is credited, so usage carries on.

What happens if a refill fails?

The balance is paused and the buyer gets an email. No further charges are attempted on their own; the buyer can fix the payment and retry from their balance page.

Can buyers turn auto-refill off?

Yes, any time, from the balance link in their receipt. Changing settings asks for their receipt email first, so a shared link cannot change consent.

How does my app know the balance?

Every deduct returns the new balance, you can list accounts with the API, and signed webhooks fire on credit.granted, credit.balance_changed, credit.auto_refill.succeeded, credit.auto_refill.failed and consent changes.

What does it cost?

2% a sale, plus card processing passed through at cost. No monthly fee and no setup fee. Selling $50,000 or more a month? The Volume plans lower the platform fee to 1% or 0.5%.

Who handles sales tax and VAT?

We do. Pocketsflow is the merchant of record, the legal seller on every order. We work out the tax for the buyer's country, add it at checkout, file and remit it, screen the payment for fraud, handle chargebacks and send the receipt. You get one payout.

Can my AI do this for me?

Yes. Add the Pocketsflow MCP server to Claude, ChatGPT, Gemini, Grok, Perplexity, Meta AI, Cursor or your own agent, sign in and click Allow access. There is no API key to paste. Your AI gets the same permissions you have, and every change it makes shows up in your dashboard.

Bill for usage without metering after the fact.

Sell a pack, deduct in cents, refill with consent. Tax handled on every top-off.

Start selling free