Core Functionalities
Crypto On-Ramp
Purchase cryptocurrencies directly using various payment methods with automatic wallet integration
Wallet Integration
Automatically populates the user’s connected wallet address as the destination for purchases
Customizable Widget
Configurable MoonPay widget supporting both sandbox and production environments
Balance Management
View wallet balances and seamlessly navigate to purchase flows when funds are needed
Installation & Setup
1
Install MoonPay SDK
The module uses the official MoonPay React Native SDK:
2
Configure API Key
Add your MoonPay API key to
.env.local:3
Import Components
Import the components you need:
API Keys: Use
pk_test_ prefixed keys for testing and pk_live_ for production. The module automatically detects the environment.Module Architecture
Core Components
- MoonPay Widget
- Onramp Screen
- Wallet Screen
MoonPayWidget - Core component that embeds MoonPay’s purchase flowapiKey- Your MoonPay API keyenvironment- ‘sandbox’ or ‘production’height- Widget height in pixelsonOpen- Callback when widget loadsonError- Error handling callbackonRetry- Retry mechanism callback
Quick Start Example
MoonPay Service Configuration
ThemoonpayService.ts provides configuration and validation utilities:
Utility Functions
object
object
object
Advanced Usage Patterns
Custom Purchase Flow
Transaction Status Tracking
Balance-Based Recommendations
Integration with Other Modules
Embedded Wallets
Automatic wallet address detection and integration
Data Module
Real-time balance updates and transaction history
Swap Module
Purchase crypto then immediately swap to desired tokens
Thread Module
Share purchase milestones and achievements
Combined Workflow Example
Environment Configuration
- Development
- Production
- Uses sandbox environment automatically
- Test transactions don’t involve real money
- Full widget functionality for testing
Error Handling & Troubleshooting
object
Security Considerations
API Reference
For detailed API documentation, see:The MoonPay module provides a seamless bridge between traditional finance and crypto, enabling users to easily onboard into the Solana ecosystem with familiar payment methods.