Skip to main content
OnDB stores JSON documents with verifiable storage and automatic payment handling.

How It Works

The SDK automatically handles payment responses internally. When you pass a payment callback as the second parameter to store(), the SDK:
  1. Attempts the store operation
  2. If the server requires payment, the SDK invokes your callback with the payment quote
  3. Your callback executes the payment and returns the result
  4. The SDK automatically retries the store operation with the payment proof
You do NOT need to catch payment errors or make a second API call - the SDK handles the entire flow.

Store with Payment Callback

Wait for Confirmation

The waitForConfirmation option ensures data is confirmed on-chain before returning:

Payment Methods

OnDB supports multiple payment methods:

Method 2: Auto-Pay (Agent Key)

Method 3: Pre-paid via Callback

Storage Model

OnDB uses an append-only storage model. See Immutability for details on how creates, updates, and deletes work under the hood, as well as data retention policies.

Next Steps

Payment Flows

Deep dive into payment options

Query Builder

Query your stored data