---
title: 'Build a eCommerce App using Coinbase Commerce and OnchainKit'
slug: /coinbase-commerce-onchainkit-checkout
description: Learn how to integrate Coinbase Commerce payments into your application using OnchainKit.
author: hughescoin
keywords: [
Account Abstraction,
AA,
Smart account,
Smart Wallet,
Funding,
Onramps,
Onchainkit,
Onboarding
Smart contract wallet,
Smart account,
]
tags: ['account abstraction']
difficulty: intermediate
hide_table_of_contents: false
displayed_sidebar: null
---
# Build a eCommerce App using Coinbase Commerce and OnchainKit
Looking to sell items and receive crypto on Base? Well, look no further!
This tutorial will guide you through the process of integrating Coinbase Commerce products into your application using OnchainKit. By the end of the tutorial you will be able to spin up a demo store that allows you to sell products for crypto. If you customers do not have crypto wallets, they can easily sign up with a few clicks using [Passkeys].
## Prerequisites
Before starting this tutorial, make sure you have:
### A Coinbase Commerce Account
Coinbase Commerce is a platform that enables merchants to accept cryptocurrency payments in a decentralized manner. It provides tools for integrating crypto payments into online stores, offering a secure and straightforward way to receive hundreds of tokens across Base, Polygon, and Ethereum.
To proceed, you will need a Coinbase Commerce account. You can sign up for an account [here](https://beta.commerce.coinbase.com/sign-up).
### Access to the Coinbase Developer Platform
You'll need to set up an account on with [Coinbase Developer Platform (CDP) Account](https://www.coinbase.com/cloud). The CDP provides various tools and services for blockchain development, including access to API endpoints and other resources that will be instrumental in your project. Once you've created your account, you'll be ready to move forward with integrating these services into your application.
### Wallet Connect
You’ll need to set up a cloud account with [Reown] (FKA, WalletConnect), a protocol that enables secure wallet connections across different platforms.
## Setting up Coinbase Commerce
Let's first start by getting started by creating a product on Coinbase Commerce.
To begin integrating Coinbase Commerce payments, you'll need to set up your account and create a product. Start by logging into your Coinbase Commerce account. Once you're in, navigate to the [product creation page].

Here, you'll need to add a detailed description of the product or service you're offering. After filling in the necessary information, click on the `Create product` button.

After creating your product, click `View product` in the popup to access the product page and copy the UUID from its URL.

Finally, for security and ease of use in your development process, it's recommended to store this UUID as an environment variable in your project's `.env` file. This setup will allow you to securely reference your product when implementing the payment integration in your application.
## Setting up the OnchainKit Project
Now let's dive into the code. For this tutorial, we'll use OnchainKit's app template to create a demo store. Start by cloning the OnchainKit app template:
```bash
git clone https://github.com/coinbase/onchainkit-app-template.git
cd onchainkit-app-template
bun i
```
## Configuring Environment Variables
Update your `.env` file to include the following variables:
```bash
NEXT_PUBLIC_WC_PROJECT_ID=
NEXT_TELEMETRY_DISABLED=1
NEXT_PUBLIC_ONCHAINKIT_API_KEY=
NEXT_PUBLIC_PRODUCT_ID=
```
## Configuring Wagmi
In your Wagmi configuration file, add the following line after the `useMemo()` React hook:
```javascript
coinbaseWallet.preference = 'smartWalletOnly';
```
Ensure your `src/app/components/OnchainProviders.tsx` file has configured its `apiKey` to your CDP API key and `chain` to **base**:
```typescript:src/app/components/OnchainProviders.tsx
'use client';
import { OnchainKitProvider } from '@coinbase/onchainkit';
import { RainbowKitProvider } from '@rainbow-me/rainbowkit';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import type { ReactNode } from 'react';
import { base } from 'viem/chains';
import { WagmiProvider } from 'wagmi';
import { useWagmiConfig } from '../wagmi';
type Props = { children: ReactNode };
const queryClient = new QueryClient();
function OnchainProviders({ children }: Props) {
const wagmiConfig = useWagmiConfig();
return (