Capxul Docs
HooksOfframp

useCapxulOfframpStatus

Query hook for tracking an offramp by id — its lifecycle status, destination, and linked payment.

Tracks an offramp in flight: its lifecycle status, the destination it settles to, and the ledger Payment it produces once one exists. Get the offramp priced with useCapxulOfframpQuote.

Published contract, no live rail yet

Offramp is new in this alpha train and not yet callable: in the published SDK, client.offramp.status is a stub that fails every request with a NOT_IMPLEMENTED CapxulError ("offramp.status is not yet implemented"). The contract is published so integrations can be typed today; the settlement rail behind it settles wallet destinations only. See Capability status.

Import

import { useCapxulOfframpStatus } from "@capxul/sdk-react";

Usage

"use client";

import { useCapxulOfframpStatus } from "@capxul/sdk-react";

function OfframpTracker({ offrampId }: { offrampId: string }) {
  const status = useCapxulOfframpStatus(offrampId);

  if (status.isLoading) return <p>Checking status…</p>;
  if (status.error) return <p>{status.error.message}</p>;

  return (
    <p>
      Offramp {status.data.id}: {status.data.status}
      {status.data.paymentId ? ` (payment ${status.data.paymentId})` : null}
    </p>
  );
}

Parameters

offrampId

string | undefined

The offramp to track. The query stays disabled while offrampId is undefined, so you can pass an id that arrives asynchronously without manual gating.

options

{ enabled?: boolean } | undefined

Pass enabled: false to skip the read until your UI is ready for it.

Return type

import { type UseCapxulOfframpStatusReturn } from "@capxul/sdk-react";
// UseQueryResult<OfframpStatus, CapxulError>

data is an OfframpStatus: the offramp id, its status (pending, processing, completed, failed, or cancelled), the destinationId it settles to, the linked paymentId (null until the offramp lands on the payment ledger), and updatedAt.

The hook returns TanStack Query's UseQueryResult. The most-used fields:

FieldDescription
dataThe query data (typed per hook, shown above). undefined until the first success.
errorA CapxulError when the last fetch failed, otherwise null.
status'pending' | 'error' | 'success'.
isLoadingtrue during the first fetch (no data yet).
isFetchingtrue whenever a fetch is in flight, including background refetches.
refetchManually 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", "status", offrampId] — scoped per offramp. No mutation invalidates status keys automatically; refetch (or poll with TanStack Query's refetchInterval) to follow an offramp to a terminal state.

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.status(offrampId) on the core SDK.

On this page