Appearance
Orders & checkout
Create a Cash App onramp order and show checkout (Cash App URL / Lightning invoice).
When to use
After the user picks an asset and amount. Session must be active.
Methods
| Method | Purpose |
|---|---|
createOrder(request) | Create onramp order; returns CashAppOrder |
getActiveOrder() | In-memory active order, or null |
reset() | Clear local active order (also happens on session refresh) |
There is no closeOrder or status-poll method. Listen for events while checkout is showing.
Request
ts
type CreateCashAppOrderRequest = {
amountFiat: string; // fiat USD amount, e.g. '25.00'
destinationChain: Network;
destinationAsset: TokenSymbol;
};Creating a new order replaces any previous active order.
Example — create
ts
import { Network, TokenSymbol } from '@swapped/connect-sdk';
const order = await client.cashApp.createOrder({
amountFiat: '25.00',
destinationAsset: TokenSymbol.USDT,
destinationChain: Network.Ethereum,
});
console.log(order.id, order.expiresAt, order.cashAppUrl);Checkout UI fields
| Field | Use for |
|---|---|
order.cashAppUrl | Open Cash App / encode as a Cash App QR |
order.shortUrl | Compact share / open link |
order.invoice | BTC Lightning invoice — encode as a Lightning QR |
order.fiatAmount / order.fiatCurrency | Deposit value (excluding fees) |
order.amount | Total fiat the user pays (includes fees) |
order.estimatedOut | Expected destination amount |
order.destinationAsset / order.destinationChain | Receive token + network |
order.recipientAddress | Destination address |
order.providerFee / order.merchantFee | Fee breakdown |
order.expiresAt | Expiry timestamp (ms since epoch) — see Expiry |
ts
const { cashAppUrl, shortUrl, invoice } = order;
// Encode cashAppUrl as a QR, or open it:
// <a href={cashAppUrl}>Open Cash App</a>
if (shortUrl) {
// <a href={shortUrl}>Open</a>
}
// Encode invoice as a Lightning QRStarting a new order clears the previous active order automatically.
Status
Prefer events for live updates. Status values are 'pending' | 'success' | 'failure'.
Read the in-memory order with getActiveOrder() when you need the current checkout payload.
Errors
| Code | When | What to do |
|---|---|---|
SESSION_REQUIRED | No loaded session | loadSession() |
SESSION_NOT_ACTIVE | Session cannot start a new payment | restartSession() first |
API_ERROR | Create network failure | Retry; keep user on a safe step |
See Errors.