CREEM HMAC-SHA256 · SQLITE WAL LEDGER

How Scrape-Anything Enforces Idempotent Creem Credit Settlement & Zero-Debit Misses

Target Query: prepaid api credit ledger hmac sha256 zero debit on miss · Category: Developer Guide · Verified Rate: $0.015/hit ($0 on miss) · Updated: 2026-12-02

Direct Answer: Promising '$0 on miss' in marketing copy means nothing if the billing ledger still debits a credit before checking response quality. Scrape-Anything's pure-stdlib SQLite WAL ledger (`CreemCreditLedger`) settles credits strictly post-verification inside atomic `BEGIN IMMEDIATE` transactions: `debit_verified()` refuses to mutate balances whenever `billed_micros == 0`, while `/webhooks/creem` verifies `X-Creem-Signature` / `creem-signature` with constant-time HMAC-SHA256 and deduplicates webhook replays by `event_id`.

Engineering Mechanics & Deterministic Guardrails

Prepaid Ledger Invariants & Webhook Lifecycle

Ledger OperationSQLite WAL GuaranteeSecurity / Billing Check
`checkout.completed`Atomic `BEGIN IMMEDIATE` + unique `event_id`HMAC-SHA256 verified; grants 15M / 75M / 300M micros
`refund.created` / `dispute.created`Idempotent adjustment with audit recordHMAC-SHA256 verified; revokes disputed balance
`debit_verified(billed_micros > 0)`Atomic balance check & deductionLinked to `receipt_sha256` and operation tier
`debit_verified(billed_micros == 0)`Strict no-op (zero row balance mutation)Enforces `$0`-on-miss invariant in code
Scrape-Anything Zero-Charge Guardrail Disposition Matrix (% of Unit Rate Billed) Verified Schema-Passing Hit (New) 100% ($0.015) Cross-Tenant Archive Cache Hit 100% ($0.015) Same-Tenant Archive Cache Refresh 10% ($0.0015) Cloudflare / CAPTCHA Fake-200 0% ($0.00) JSON Schema Validation Mismatch 0% ($0.00) SSRF Loopback / Metadata (HTTP 422) 0% ($0.00) Encrypted PDF or Blank SPA Shell 0% ($0.00)

Verified Settlement Telemetry Fields

{
  "type": "object",
  "required": [
    "billed_micros",
    "billing_tier",
    "cache_hit",
    "receipt_sha256"
  ],
  "properties": {
    "billed_micros": {
      "type": "integer",
      "minimum": 0
    },
    "billing_tier": {
      "type": "string"
    },
    "cache_hit": {
      "type": "boolean"
    },
    "receipt_sha256": {
      "type": "string"
    }
  }
}

Any extracted payload violating required keys, types, bounds, or regex patterns returns schema_valid: false, exact validation_errors, and billed_micros: 0.

Executable REST, Remote /mcp & treg hub Snippets

# Verify live engine health and zero_on_miss flag
curl -fsSL "https://scrape.fastmesh.dev/health" 

# Inspect Creem SKU mapping and micro-USD unit rates
curl -fsSL "https://scrape.fastmesh.dev/v1/pricing" 

Hard guarantee: fake-200 CAPTCHA/Turnstile shells, login walls, encrypted PDFs, empty results, schema mismatches, and SSRF HTTP 422 blocks always return billed_micros: 0.

Test Schema-Validated Extraction Live in 5 Seconds

Paste any public URL, HTML table, JSON-LD, CSV, or fake-200 shell at scrape.fastmesh.dev or top up once with never-expiring Creem prepaid credits ($15 Starter / $59 Growth / $199 Scale — $0/mo recurring).

Frequently Asked Questions

How does Scrape-Anything prevent duplicate Creem webhooks from double-crediting?

Every webhook event is recorded by its unique `event_id` inside an atomic SQLite WAL transaction; replays return idempotent HTTP 200 without re-crediting.

Are any API keys or webhook secrets stored in the codebase?

Never. `CREEM_API_KEY` and `CREEM_WEBHOOK_SECRET` are injected exclusively from out-of-repo environment / secret manager configuration.

Can `debit_verified` ever deduct balance when a request fails schema validation?

No. Failed validations always produce `billed_micros = 0`, which triggers an explicit zero-mutation guard inside the ledger.

Related Structured Extraction Guides

Explore all 32 Scrape-Anything Technical Guides or inspect the machine-readable llms.txt index.