Appearance
Getting started (Core)
Use the framework-agnostic client from @swapped/connect-sdk.
Install
bash
npm install @swapped/connect-sdkCreate client and load session
ts
import { createSwappedConnectClient } from '@swapped/connect-sdk';
const client = createSwappedConnectClient({
sessionId: 'your-session-id',
// apiBaseUrl: 'https://connect-api.swapped.com', // optional
});
await client.loadSession();
const session = client.getSession();
console.log(session?.merchant.name);You need a Swapped Connect sessionId from your backend before creating the client.
Typical order of work
createSwappedConnectClient→loadSession- Gate UI on session view (
getSessionView) — onlyactivecan pay - List payment methods
- Run a deposit flow — Wallets, Exchange Pay, or Coinbase
- Listen for events as needed
restartSession()for another payment, ordestroy()when done
Entry points
| Import | Purpose |
|---|---|
@swapped/connect-sdk | Client, types, modules |
@swapped/connect-sdk/format | Display helpers |
Prefer React? See the React track.