Appearance
useCashAppCompletedTransactionSummary
Live display-ready summary of the last completed Cash App onramp.
When to use
Success screen after the order completes. Updates when cashApp:orderCompleted fires (and from session transaction data when applicable).
Always two legs: fiat in (send) and crypto out (receive).
Example
tsx
import {
useCashAppCompletedTransactionSummary,
useSwappedConnectClient,
} from '@swapped/connect-sdk/react'
function Success() {
const summary = useCashAppCompletedTransactionSummary()
const client = useSwappedConnectClient()
if (!summary) return null
return (
<div>
<p>Provider: {summary.provider}</p>
<p>
Paid {summary.send.amount} {summary.send.currency}
</p>
<p>
Receive {summary.receive.amount} {summary.receive.currency}
</p>
{summary.receive.network && <p>Network: {summary.receive.network}</p>}
{summary.fees.map((fee, index) => (
<p key={index}>
{fee.type === 'merchant' ? 'Merchant fee' : 'Provider fee'}{' '}
{fee.formatted.amount || fee.amount}
</p>
))}
{summary.from && <p>From: {summary.from}</p>}
{summary.to && <p>To: {summary.to.formatted ?? summary.to.address}</p>}
{summary.transaction && <p>Tx: {summary.transaction.hash}</p>}
{summary.sessionId && <p>Session: {summary.sessionId}</p>}
<button type="button" onClick={() => void client.restartSession()}>
New payment
</button>
</div>
)
}May be null after reload or restartSession() even if payment completed on the server.
This hook is provider-free and can mount outside CashAppProvider.
Errors
This hook does not throw. null means no summary is available yet.
The next createOrder can hit SESSION_NOT_ACTIVE if you did not call restartSession() — see Errors.