Examples use React with
@dynamic-labs-sdk/react-hooks. The underlying JS SDK is framework-agnostic — swap the hooks for direct calls against @dynamic-labs-sdk/client to adapt this guide to vanilla JS, Vue, Svelte, or any other framework.Setup
Follow the React Quickstart (JS SDK) to scaffold a Vite + React app and wire<DynamicProvider> with the EVM extension.
QR code
Generate a QR for the raw address with any QR library (e.g.qrcode.react):
Wallet address
For copy-to-clipboard flows, readaddress straight off the wallet account:
Payment links
A “payment link” is just a URL with the recipient, amount, and chain encoded as query params. The sender lands on a page in your app that reads the params and triggers a USDCtransfer from their wallet.
Generating the link
src/components/PaymentLinkGenerator.tsx
getActiveNetworkId returns the wallet’s current chain id (e.g. "8453" for Base) so the sender lands on the right chain. See Getting Active Network.
Processing the link
The payment page reads the URL params, switches the sender’s wallet to the correct chain, then runs an ERC-20transfer:
src/routes/Pay.tsx
Adding metadata
For richer payment requests (description, reference, expiry) just add more query params before generating the link:expiresAt on the payment page before accepting the transfer.
Security considerations
- Validate params server-side if your app touches the recipient address or amount in any backend flow — the URL is user-controlled.
- Rate limit the page that processes links so a leaked URL can’t drain a wallet via auto-clicking.
- HTTPS only — never serve payment URLs over plain HTTP.
- Bound amounts — reject anything outside a sane min/max for your product.