Idea
An implementation that demonstrates Dynamic’s unified payment flow, allowing users to:- Fund transactions using external wallets
- Transfer funds from exchange accounts (Coinbase, Kraken)
- Purchase crypto through onramp providers (Coinbase, Banxa, Crypto.com)
- Choose their preferred payment method through a unified interface
Key Components
- Dynamic MPC Wallets - Embedded, non-custodial wallets with seamless auth
- Unified Payment Interface - Single UI for all payment methods
- External Wallet Funding - Direct transfers from connected wallets
- Exchange Integration - Coinbase and Kraken account transfers
- Onramp Providers - Fiat-to-crypto purchases via Coinbase, Banxa, and Crypto.com
This unified payment flow combines all of Dynamic’s funding methods. See external wallet funding, exchange transfers, and onramp providers for individual methods.
Configure Dynamic Environment
Create a new environment in the Dynamic dashboard.- Navigate to the Dynamic Dashboard > Developers
- Go to “SDK and API Keys” under the Developers section
- Copy your
Environment IDand create a newAPI Token- you’ll need these to authenticate your requests to Dynamic’s API

Enable Funding Methods
Before using payWithCrypto, you need to enable the funding methods you want to support:1. External Wallet Funding
- Go to your Dynamic dashboard
- Navigate to Funding → External Wallet
- Enable Funding with External Wallets

2. Exchange Funding
- Go to your Dynamic dashboard
- Navigate to Funding → Exchanges & Onramps
- Enable Coinbase and/or Kraken

3. Onramp Providers
- Go to your Dynamic dashboard
- Navigate to Funding → Exchanges & Onramps
- Enable Coinbase and/or Banxa
- Accept terms and conditions for each provider if necessary

Basic Implementation
Create a simple payment component that uses theusePayWithDynamic hook:
You can find more information about the hook here.
components/PaymentForm.tsx
How It Works
Unified Payment Flow
TheusePayWithDynamic hook provides a unified interface that:
- Accepts Payment Parameters - Destination address, amount, token, and network
- Shows Payment Options - Displays available funding methods based on your configuration
- Handles User Selection - Lets users choose their preferred payment method
- Orchestrates Transaction - Executes the payment through the selected method
Available Payment Methods
External Wallet Funding
- Users can fund transactions from any connected external wallet
- Supports all major wallet providers (MetaMask, WalletConnect, etc.)
- Direct blockchain transactions with gas fee handling
- Learn more: External Wallet Funding
Exchange Funding
- Coinbase: Transfer funds from Coinbase accounts to wallets
- Kraken: Transfer funds from Kraken accounts to wallets
- Requires OAuth setup
- Required destination address whitelisting for Kraken
- Learn more: Exchange Transfers
Onramp Providers
- Coinbase: Buy crypto with fiat using credit cards, bank transfers
- Banxa: Global onramp with multiple payment methods
- Crypto.com: Buy crypto with fiat using credit cards, bank transfers, and other payment methods, or use your Crypto.com exchange account
- Learn more: Onramp Providers
Crypto.com is currently in limited beta. Please contact support if you’re interested in early access.
Error Handling
The payWithCrypto system handles various error scenarios:- Insufficient Funds: Clear messaging when user doesn’t have enough balance
- Network Issues: Connection problems and transaction failures
- Whitelisting Requirements: Exchange-specific address verification needs
- Invalid Amounts: Amount validation and minimum requirements