Farther ShoreDocs
Go to Farther Shore
Getting startedCore conceptsLaunch checklist
ProductsUpstream routingEnvironmentsDeveloper portals
Billing strategiesPlans and limitsSubscribersAPI keys
Gateway enforcementUsage meteringLimits and creditsGateway sharding
Launch a request-counted product15mAdd monthly included usageAdd subscription plus overageCreate a prepaid credits productMeter AI token usageAdd a custom meterIssue and test an API keyDebug a denied requestUpdate product docsPrepare for launch
TroubleshootingGateway response codesMeter namingPlatform docs publishing
Status
Docs/Cookbook/Create a prepaid credits product

Create a prepaid credits product

Require customers to reserve balance before traffic is forwarded.

PreviousAdd subscription plus overageNextMeter AI token usage

On this page

When to use creditsStepsExample credit modelProduct docs languageTest casesCommon mistakes

Prepaid credits require subscribers to fund usage before the gateway forwards requests.

When to use credits

Use prepaid credits when:

  • upstream cost is high or variable
  • you do not want to extend unpaid usage
  • each request maps cleanly to a credit amount
  • subscribers expect to buy a balance and spend it down

Steps

  1. Create a credit-based billing strategy.
  2. Define what one credit means.
  3. Configure the meter that spends credits.
  4. Create a plan or purchase flow that grants credits.
  5. Configure gateway enforcement to require available balance.
  6. Publish the product.
  7. Test both sufficient and insufficient balance cases.

Example credit model

creditUnit: "1 credit"
spend:
  meter: images
  amount: 1
  credits: 1

Product docs language

Each image generation costs 1 credit. Requests are only forwarded when your
account has enough credits for the operation.

Test cases

  • subscriber with balance can call the API
  • subscriber without balance is denied before upstream forwarding
  • failed upstream calls do not incorrectly spend final usage
  • usage and credit balance remain understandable after retries

Common mistakes

Do not use credits unless the product can explain what credits buy. If customers need an invoice after usage instead of a prepaid wallet, use overage or pay as you go instead.