Skip to main content
OnDB supports paid read operations. When a query requires payment, the SDK throws PaymentRequiredError containing a payment quote. You then pay and re-query using executeWithPayment().

How It Works

Basic Example

Pay and Re-Query

After catching PaymentRequiredError, process the payment and use executeWithPayment() to retry:

executeWithPayment

The executeWithPayment() method on QueryBuilder retries a query with payment proof:

Parameters

Return Value

Returns QueryResponse<T> with the same structure as execute().

Error Types

Type-Safe Payment Handling

Use Cases

Next Steps

Cost Estimation

Estimate operation costs

Write Payments

Write operation payments