Skip to main content
The pay with card funding option enables users to purchase cryptocurrency with debit or credit cards, including browser payment methods like Apple Pay and Google Pay. This is particularly useful for users who may not hold crypto outside of your application and are purchasing cryptocurrency for the first time.
Users must be authenticated through MoonKey to use card funding methods. A valid access token is required for the user to proceed with card funding.
MoonKey facilitates card purchases through MoonPay, a trusted onramp provider embedded directly within your app. This provides a seamless experience where users never need to leave your application to fund their wallets.
Mainnet only: Card and fiat onramp purchases are supported on mainnets only. On testnets (e.g. Sepolia, Base Sepolia, Solana Devnet), onramps cannot purchase testnet tokens, so this flow will not be available.

How it works

When a user initiates a card purchase:
  1. Select amount - User chooses how much cryptocurrency to purchase
  2. Choose payment method - User selects debit/credit card, Apple Pay, or Google Pay
  3. MoonPay onboarding - User completes any required verification steps (KYC/AML)
  4. Complete payment - User enters payment details and confirms the purchase
  5. Funds delivered - Cryptocurrency is delivered to the user’s embedded wallet
The entire flow happens within your application, providing a seamless user experience.

Payment methods

Debit and credit cards

Users can pay directly with:
  • Debit cards - Visa, Mastercard, and other major providers
  • Credit cards - Visa, Mastercard, and other major providers
Debit cards generally have higher approval rates than credit cards for cryptocurrency purchases. Consider guiding users toward debit card payments when possible.

Apple Pay

Users on Safari or iOS devices can use Apple Pay for faster checkout:
  • Stored payment methods from Apple Wallet
  • Biometric authentication (Face ID, Touch ID)
  • One-tap payment experience

Google Pay

Users on Chrome or Android devices can use Google Pay:
  • Stored payment methods from Google account
  • Quick and secure checkout
  • Simplified payment flow

Supported assets

MoonPay supports purchasing a variety of cryptocurrencies across different networks. Users can purchase:
  • Native tokens - ETH, SOL, and other network currencies
  • Stablecoins - USDC, USDT, and other stablecoins
  • Popular tokens - Various ERC-20 and SPL tokens
For a complete list of supported cryptocurrencies and networks, see MoonPay’s supported assets documentation.

Integration

React SDK

Use the MoonKey React SDK to trigger the card funding flow:
  • Ethereum
  • Solana
import { useWallets, useFundWallet } from '@moon-key/react-auth/ethereum';

function FundWalletButton() {
  const { wallets } = useWallets();
  const { fundWallet } = useFundWallet();
  
  const handleFund = async () => {
    if (wallets.length === 0) return;
    
    const selectedWallet = wallets[0];
    
    try {
      await fundWallet(selectedWallet.address, {
        chain: 'eip155:1',
        amount: '0.1'
      });
      console.log('Funding initiated');
    } catch (error) {
      console.error('Funding failed:', error);
    }
  };
  
  return (
    <button onClick={handleFund}>
      Add Funds
    </button>
  );
}

Parameters

address
string
required
The wallet address to fund.
config
EthereumFundingConfig | SolanaFundingConfig
required
Configuration options for the funding request.

EthereumFundingConfig

chain
string
The Ethereum chain to fund on. Use 'eip155:1' for Ethereum mainnet, or other chain IDs for different networks.Example: 'eip155:1' (Ethereum mainnet)
amount
string
The amount of ETH to purchase.Example: '0.1'

SolanaFundingConfig

cluster
string
The Solana cluster to fund on. Use 'solana:mainnet' for mainnet.Example: 'solana:mainnet'
amount
string
The amount of SOL to purchase.Example: '0.1'

User experience

First-time users

For users making their first purchase through MoonPay:
  1. Account creation - User creates a MoonPay account
  2. Identity verification - User completes KYC verification (name, address, ID)
  3. Payment - User completes the purchase
  4. Future purchases - Faster checkout with saved information
KYC verification is typically quick but may take longer in some cases. This is a one-time process required by regulations.

Returning users

For users who have previously used MoonPay:
  1. Pre-filled information - Saved payment methods and details
  2. Quick checkout - Streamlined purchase flow
  3. Faster processing - No additional verification needed

Complete example

Here’s a complete example with wallet funding:
  • Ethereum
  • Solana
'use client';
import { useWallets } from '@moon-key/react-auth/ethereum';
import { useFundWallet } from '@moon-key/react-auth';
import { useState } from 'react';

export default function WalletFunding() {
  const { wallets } = useWallets();
  const { fundWallet } = useFundWallet();
  const [isFunding, setIsFunding] = useState(false);
  
  const handleFund = async () => {
    if (wallets.length === 0) {
      alert('No wallet found');
      return;
    }
    
    const selectedWallet = wallets[0];
    setIsFunding(true);
    
    try {
      await fundWallet(selectedWallet.address, {
        chain: 'eip155:1',
        amount: '0.1'
      });
      
      alert('Purchase initiated! Funds will arrive shortly.');
    } catch (error) {
      console.error('Funding failed:', error);
      alert('Purchase failed. Please try again.');
    } finally {
      setIsFunding(false);
    }
  };
  
  if (wallets.length === 0) {
    return <div>No wallet found</div>;
  }
  
  const selectedWallet = wallets[0];
  
  return (
    <div className="wallet-funding">
      <h2>Wallet</h2>
      <p>{selectedWallet.address}</p>
      
      <button 
        onClick={handleFund}
        disabled={isFunding}
      >
        {isFunding ? 'Processing...' : 'Add Funds'}
      </button>
      
      <div className="info">
        <p>• Pay with card, Apple Pay, or Google Pay</p>
        <p>• Debit cards have higher approval rates</p>
        <p>• Amount: 0.1 ETH</p>
      </div>
    </div>
  );
}

Next steps