Learn how to integrate Coinbase Commerce payments into your application using OnchainKit to eliminate traditional fees and expand your global reach.
Accepting crypto payments can help you eliminate traditional credit card fees and avoid costly chargebacks, giving you a faster, more global payment experience. In this guide, you’ll learn how to quickly integrate Coinbase Commerce and OnchainKit to accept crypto payments for products or services in your application.
By the end of this guide, you’ll have a fully functional checkout flow that:
Remove traditional credit card processing fees and chargebacks
Accept payments from crypto users worldwide, 24/7
Receive payments instantly with blockchain confirmation
Get started in minutes with OnchainKit components
Before you begin, ensure you have the following accounts and tools set up:
Coinbase Commerce Account
Sign up for Coinbase Commerce to accept cryptocurrency payments globally.
You’ll need this to create products and manage payments.
Coinbase Developer Platform Account
Create a CDP account to access OnchainKit APIs and services.
CDP provides the infrastructure for seamless crypto integrations.
Reown (WalletConnect) Account
Set up Reown (formerly WalletConnect) for secure wallet connections across devices and platforms.
Create Your Product in Coinbase Commerce
First, you’ll create a product in Coinbase Commerce that represents what you’re selling.
Save the product UUID immediately - you’ll need it as an environment variable. The UUID appears in the product URL after creation.
Set Up Your Development Environment
Clone the official OnchainKit app template to get started quickly with best practices already configured.
Verify the installation completed successfully by running ls
to see the project files.
Configure Environment Variables
Create your environment configuration with the required API keys and identifiers.
In your project root, create or update your .env.local
file:
Never commit API keys to version control. Add .env.local
to your .gitignore
file.
Use descriptive variable names and keep them organized with comments for team members.
Configure Smart Wallet Integration
Set up Wagmi to prioritize smart wallets for better user experience.
Update your Wagmi configuration file (typically src/app/wagmi.ts
):
This configuration ensures users connect with smart wallets, which provide enhanced security and better UX.
Set Up OnchainKit Provider
Configure the OnchainKit provider to connect with Base network and your CDP API key.
Update src/app/components/OnchainProviders.tsx
:
Update your configuration file to handle environment variables properly:
Using environment variables makes your app more secure and easier to deploy across different environments.
Implement the Payment Interface
Create an attractive payment interface that showcases your product and handles the checkout flow.
Update your main page (src/app/page.tsx
):
Make sure to add your product image to the public
folder and update the image path accordingly.
The conditional rendering prevents errors when no wallet is connected, providing a smooth user experience.
Test and Deploy Your Application
Test your payment flow locally before deploying to production.
Local Testing:
http://localhost:3000
Production Deployment:
Start with testnet transactions to ensure everything works before going live with mainnet.
Wallet connection issues
Common solutions:
Payment not processing
Check these items:
Environment variable errors
Configuration checklist:
.env.local
Now that you have crypto payments working, consider these enhancements:
Scale your setup to handle multiple products and services
Set up payment confirmation webhooks for automated processing
Track payment metrics and customer behavior
Accept payments on multiple blockchain networks
Congratulations! You’ve successfully integrated Coinbase Commerce and OnchainKit into your application. Your users can now make crypto payments, giving you access to:
✅ Zero traditional payment fees and chargebacks
✅ Global customer reach with 24/7 payment processing
✅ Instant settlement with blockchain confirmation
✅ Enhanced security through smart wallet integration
Ready to scale? Consider expanding to multiple products, implementing automated fulfillment, or adding analytics to track your crypto payment performance.
Your application now supports the future of global payments. Happy building on Base!
Learn how to integrate Coinbase Commerce payments into your application using OnchainKit to eliminate traditional fees and expand your global reach.
Accepting crypto payments can help you eliminate traditional credit card fees and avoid costly chargebacks, giving you a faster, more global payment experience. In this guide, you’ll learn how to quickly integrate Coinbase Commerce and OnchainKit to accept crypto payments for products or services in your application.
By the end of this guide, you’ll have a fully functional checkout flow that:
Remove traditional credit card processing fees and chargebacks
Accept payments from crypto users worldwide, 24/7
Receive payments instantly with blockchain confirmation
Get started in minutes with OnchainKit components
Before you begin, ensure you have the following accounts and tools set up:
Coinbase Commerce Account
Sign up for Coinbase Commerce to accept cryptocurrency payments globally.
You’ll need this to create products and manage payments.
Coinbase Developer Platform Account
Create a CDP account to access OnchainKit APIs and services.
CDP provides the infrastructure for seamless crypto integrations.
Reown (WalletConnect) Account
Set up Reown (formerly WalletConnect) for secure wallet connections across devices and platforms.
Create Your Product in Coinbase Commerce
First, you’ll create a product in Coinbase Commerce that represents what you’re selling.
Save the product UUID immediately - you’ll need it as an environment variable. The UUID appears in the product URL after creation.
Set Up Your Development Environment
Clone the official OnchainKit app template to get started quickly with best practices already configured.
Verify the installation completed successfully by running ls
to see the project files.
Configure Environment Variables
Create your environment configuration with the required API keys and identifiers.
In your project root, create or update your .env.local
file:
Never commit API keys to version control. Add .env.local
to your .gitignore
file.
Use descriptive variable names and keep them organized with comments for team members.
Configure Smart Wallet Integration
Set up Wagmi to prioritize smart wallets for better user experience.
Update your Wagmi configuration file (typically src/app/wagmi.ts
):
This configuration ensures users connect with smart wallets, which provide enhanced security and better UX.
Set Up OnchainKit Provider
Configure the OnchainKit provider to connect with Base network and your CDP API key.
Update src/app/components/OnchainProviders.tsx
:
Update your configuration file to handle environment variables properly:
Using environment variables makes your app more secure and easier to deploy across different environments.
Implement the Payment Interface
Create an attractive payment interface that showcases your product and handles the checkout flow.
Update your main page (src/app/page.tsx
):
Make sure to add your product image to the public
folder and update the image path accordingly.
The conditional rendering prevents errors when no wallet is connected, providing a smooth user experience.
Test and Deploy Your Application
Test your payment flow locally before deploying to production.
Local Testing:
http://localhost:3000
Production Deployment:
Start with testnet transactions to ensure everything works before going live with mainnet.
Wallet connection issues
Common solutions:
Payment not processing
Check these items:
Environment variable errors
Configuration checklist:
.env.local
Now that you have crypto payments working, consider these enhancements:
Scale your setup to handle multiple products and services
Set up payment confirmation webhooks for automated processing
Track payment metrics and customer behavior
Accept payments on multiple blockchain networks
Congratulations! You’ve successfully integrated Coinbase Commerce and OnchainKit into your application. Your users can now make crypto payments, giving you access to:
✅ Zero traditional payment fees and chargebacks
✅ Global customer reach with 24/7 payment processing
✅ Instant settlement with blockchain confirmation
✅ Enhanced security through smart wallet integration
Ready to scale? Consider expanding to multiple products, implementing automated fulfillment, or adding analytics to track your crypto payment performance.
Your application now supports the future of global payments. Happy building on Base!