ZSDepositView is a prebuilt, full-featured SwiftUI view that handles the entire USDC deposit flow. It provides a polished UI for amount selection, payment method switching, transaction status, and error handling—so you don’t have to build this from scratch.
Basic Usage
The simplest integration requires just a wallet address:With Callback
Get notified when a deposit completes:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
walletAddress | String | Yes | Destination wallet address for USDC deposits. Can be Solana (for Phantom) or Ethereum/Base address (for Apple Pay, MetaMask, Coinbase Wallet) |
onDeposit | ((Int) -> Void)? | No | Callback invoked when deposit succeeds. Receives the deposited amount in cents (e.g., 300 = $3.00) |
Supported Payment Methods
The view automatically shows all available payment methods:| Method | Description | Network |
|---|---|---|
| Apple Pay | Instant deposits via Coinbase Pay | Base |
| Phantom | Transfer USDC from Phantom wallet | Solana |
| MetaMask | Transfer USDC from MetaMask wallet | Ethereum |
| Coinbase Wallet | Transfer USDC on Base network | Base |
Amount Selection
Users can choose from preset amounts or enter a custom amount:- Preset amounts: 2, 5, $10
- Custom amount: Any amount via text input
Complete Example
Here’s a full working example in a SwiftUI view:Wallet Address Formats
ThewalletAddress parameter accepts both Solana and Ethereum-compatible addresses:
Solana Address (for Phantom)
Ethereum/Base Address (for Apple Pay, MetaMask, Coinbase)
What the View Handles
TheZSDepositView automatically takes care of:
✅ Payment Method Selection - Buttons to switch between Apple Pay, Phantom, MetaMask, and Coinbase Wallet
✅ Wallet Detection - Automatically detects installed wallets and shows installation prompts if needed
✅ Amount Input - Preset buttons (2, 5, $10) and custom amount text field
✅ Transaction Processing - Handles wallet connections, transaction signing, and network submission
✅ Loading States - Shows progress indicators during transaction processing
✅ Transaction Status - Real-time updates showing “Pending”, “Confirming”, “Confirmed”
✅ Error Handling - User-friendly error messages with retry options
✅ Dismissal - Automatic or manual dismissal after success/error
Working with Amounts
All amounts in ZeroSettle are represented in cents to avoid floating-point precision issues:Common Patterns
Update UI After Deposit
Save to Backend
Track Analytics
Testing
When testing deposits, use small amounts:Best Practices
Store balances in cents
Store balances in cents
Always store monetary amounts as integers (cents) to avoid floating-point precision errors. Convert to dollars only for display.
Save deposits to your backend
Save deposits to your backend
Don’t rely solely on the callback. Save deposit records to your backend with transaction details for reconciliation and support.
Dismiss the sheet after success
Dismiss the sheet after success
Set
showDeposit = false in your callback to automatically dismiss the view after a successful deposit.Test with all payment methods
Test with all payment methods
Make sure to test with Apple Pay, Phantom, MetaMask, and Coinbase Wallet to ensure all flows work correctly.
Use the correct address format
Use the correct address format
Solana addresses for Phantom, Ethereum/Base addresses (starting with
0x) for Apple Pay, MetaMask, and Coinbase Wallet.Need more control? Use the ZeroSettle Deposit API to build fully custom UIs with direct access to payment rails.
