BasePayButton is a ready-to-use React component that provides a seamless payment experience using Base Account. It handles the entire payment flow including user interaction, transaction processing, and result handling.
Installation
Basic Usage
Props
paymentOptions (required)
Payment configuration object with the following properties:The payment amount in USDC (e.g., “10.50” for $10.50)
The recipient wallet address or ENS name
Whether to use testnet for the payment (default: false)
Object containing information requests to collect during payment
Styling Props
Color scheme for the button appearance (default: ‘system’)
Button size (default: ‘medium’)
Button variant style (default: ‘solid’)
Whether the button is disabled (default: false)
Event Handlers
Callback function called when payment completes (success or failure)
Custom click handler (called before payment processing)
Payment Options
Basic Payment
Payment with User Info Collection
Styling Options
Color Schemes
Sizes and Variants
Event Handling
Payment Result Handling
Custom Click Handler
Complete Example
TypeScript Support
The component is fully typed when using TypeScript:Testing
For testing your integration:- Use testnet mode: Set
testnet: truein payment options - Get test USDC: Use Circle’s faucet on Base Sepolia
- Test different scenarios: Try successful payments, cancellations, and errors
- Verify user info collection: Test with different
payerInfoconfigurations