useCapxulOfframpQuote
Query hook for pricing a cash-out to a saved destination — fee and received amount, with an expiry.
Prices a cash-out: given a saved destination and an amount, returns a
quote with the fee, the amount the recipient would receive, and when the quote
expires. Track an offramp in flight with
useCapxulOfframpStatus;
manage destinations with
useCapxulDestinations.
Published contract, no live rail yet
Offramp is new in this alpha train and not yet callable: in the
published SDK, client.offramp.quote is a stub that fails every request
with a NOT_IMPLEMENTED CapxulError
("offramp.quote is not yet implemented"). The quote and status contracts are
published so integrations can be typed today. The settlement rail behind
them is also constrained: the platform can settle wallet destinations only —
bank / mobile-money settlement is roadmap. See
Capability status.
Import
import { useCapxulOfframpQuote } from "@capxul/sdk-react";Usage
"use client";
import { useCapxulOfframpQuote } from "@capxul/sdk-react";
function QuotePreview({ destinationId }: { destinationId: string }) {
const quote = useCapxulOfframpQuote({
destinationId,
amount: { currency: "USD", value: "100.00", decimals: 2 },
});
if (quote.isLoading) return <p>Getting quote…</p>;
if (quote.error) return <p>{quote.error.message}</p>;
return (
<p>
You receive {quote.data.receivedAmount.value}{" "}
{quote.data.receivedAmount.currency} (fee {quote.data.fee.value}{" "}
{quote.data.fee.currency})
</p>
);
}Parameters
input
OfframpQuoteInput | undefined
The query stays disabled while input is undefined, so you can pass a
destination id that arrives asynchronously without manual gating.
Prop
Type
destinationId is the saved destination to cash out to (see
useCapxulDestinations);
amount is the money to cash out; actor scopes the quote to the personal
account (default) or an organization.
options
{ enabled?: boolean } | undefined
Pass enabled: false to skip the read until your UI is ready for it.
Return type
import { type UseCapxulOfframpQuoteReturn } from "@capxul/sdk-react";
// UseQueryResult<OfframpQuote, CapxulError>data is an OfframpQuote: the quote id, the echoed input, expiresAt
(epoch milliseconds — after this the quote is stale), the receivedAmount
after fees, and the fee. Both amounts are decimal money values, never raw
token units.
The hook returns TanStack Query's UseQueryResult. The most-used fields:
| Field | Description |
|---|---|
data | The query data (typed per hook, shown above). undefined until the first success. |
error | A CapxulError when the last fetch failed, otherwise null. |
status | 'pending' | 'error' | 'success'. |
isLoading | true during the first fetch (no data yet). |
isFetching | true whenever a fetch is in flight, including background refetches. |
refetch | Manually refetch the query. |
Capxul query hooks stay pending until the provider finishes bootstrapping —
you do not need to gate them on useCapxul() yourself. The full field list is
in the TanStack Query useQuery reference;
see also the TanStack Query integration guide.
Query key
["capxul", "offramp", "quote", <serialized input>] — one cache entry per
actor / destination / amount combination, so editing the amount fetches a
fresh quote. No mutation invalidates quote keys automatically; refetch to
re-price after expiresAt.
Errors
Every request currently fails with NOT_IMPLEMENTED (see the callout above).
Failures surface as a CapxulError on error.
Client method
This hook wraps client.offramp.quote(input) on the core SDK.