rtClient.payments
SDK methods for reading settled payments - the protocol ledger, per address and per product.
A Payment is one settled leg of a collect: an amount, a currency, a recipient, and the
contribution role that earned it. rtClient.payments is a read surface - legs are written by
the chainhook handlers as mints confirm, so nothing here creates one.
Read money here rather than deriving it. A product's minFeeSbtc is a floor a payer may
exceed, so multiplying a fee by an edition count does not give you what somebody earned. The
ledger does.
rtClient.payments.getUserRevenue(stxAddress, params?)
Address-rooted revenue analytics, and the method most apps want. Returns
ApiResponse<UserRevenueReport> - aggregated totals plus a paginated tail of recent payments.
UserRevenueQueryParams filters by role (creator or collector), groups by app, currency,
day, type, product, month, role or axis (product is the one a per-product earnings
figure reads, as Bottle Drop's reply earnings do), and takes a window. This is what the hub earnings surface and the creator revenue
chart are built on.
const { data } = await rtClient.payments.getUserRevenue(address, {
role: "creator",
groupBy: "app",
});rtClient.payments.listPayments(params?)
The ledger, filtered. Returns { items, pagination, summary } - and the summary is the useful
half: total, totalAmount, totalSplitAmount, averageAmount, plus a byCurrency breakdown,
computed over the whole filtered set rather than the current page.
ListPaymentsParams accepts recipientAddress, buyerAddress, sourceType, sourceAppId,
currencyType, status, a startDate/endDate window, and sortBy / sortOrder.
const res = await rtClient.payments.listPayments({
recipientAddress: address,
currencyType: "SBTC",
});
res.data.summary.byCurrency.forEach((c) => console.log(c.currencyType, c.totalAmount));rtClient.payments.getProductPayments(productId, params?)
Every leg paid by collects of one smart product. Same { items, pagination, summary } envelope,
paginated with { page, limit }.
Amounts are strings, not numbers - they are chain-precision integers in the currency's base
unit, and totalAmount is null rather than "0" when nothing matched.
rtClient.currencyTypes
rtClient.currencyTypes.listCurrencyTypes()
The currencies a product may be priced in.
Read it rather than hardcoding a coin. What a marketplace charges in is per-marketplace by construction - creating is priced in the venue's own native token while collecting settles in sats
- and the preferred currency is the user's choice, not the app's. See Payment currency policy.