Integrating with v0 by Vercel
v0 generates React components with AI. It's great for building individual components of a storefront that connect to BareCommerceCore.
Getting Started
1. Create Your Store
Set up your store at barecommercecore.com (opens in a new tab) and get your API key. Also set up a payment provider (Stripe, PayPal, or Square).
2. Generate a Component in v0
Go to v0.dev (opens in a new tab) and describe what you want to build.
3. Add API Integration
Once v0 generates the component, you can modify it to call BareCommerceCore API for products and payment provider APIs for checkout.
Starter Prompts
Product Grid
Create a React component that displays a grid of products.
Fetch products from the BareCommerceCore API using the X-API-Key header.
Show product image, title, price, and an "Add to Cart" button.
Use Tailwind CSS for styling.Product Detail Page
Build a product detail page component that:
- Takes a product ID as a prop
- Fetches product details from BareCommerceCore API
- Shows full description, images, price, and variants
- Has an "Add to Cart" buttonShopping Cart
Create a shopping cart component that:
- Stores items in React state
- Shows a list of items with quantity controls
- Calculates total price
- Has a "Checkout" button that sends the cart items and customer info to your backend
- The backend should create a Stripe PaymentIntent with the order data as metadata
- Display the Stripe payment formCustomer Dashboard
Build a dashboard component that shows:
- Recent orders fetched from BareCommerceCore API
- Customer profile information
- Order details in an expandable listImportant: Orders and Payments
Orders are created automatically from payment webhooks, not via API calls. Here's the correct flow:
- Customer adds items to cart in your component
- User clicks checkout
- Your backend creates a Stripe PaymentIntent with order data as metadata
- Frontend shows Stripe payment form
- Customer completes payment
- Stripe sends webhook to BareCommerceCore
- Order is automatically created in BareCommerceCore
- Display confirmation to customer
You don't create orders via code. They're created from payment provider webhooks.
Integrating Into Your Project
v0 components work great as building blocks. Here's how to use them:
- Generate UI components in v0 (product grid, cart, etc)
- Copy the code into your Next.js project
- Wire them together into a full app
- Connect payment processing for checkout (use Stripe, PayPal, or Square)
- Connect product fetching to BareCommerceCore API
Handling API Calls
When integrating BareCommerceCore API:
- Use your API key — Pass
X-API-Keyheader with your BareCommerceCore API key - Handle errors — Show error messages to the user if API calls fail
- Load states — Show loading spinners while fetching data
Example:
const response = await fetch(
`https://api.barecommercecore.com/api/stores/${storeId}/products`,
{
headers: {
'X-API-Key': process.env.NEXT_PUBLIC_BARECOMMERCE_API_KEY,
},
}
);
const { items } = await response.json();Handling Payment
For payment processing, use Stripe, PayPal, or Square:
// Example: Create Stripe PaymentIntent on your backend
const paymentIntent = await stripe.paymentIntents.create({
amount: totalInCents,
currency: 'usd',
metadata: {
store_id: storeId,
customer_id: customerId,
items: JSON.stringify(cartItems),
subtotal: subtotal.toString(),
tax: tax.toString(),
shipping: shipping.toString(),
}
});
// Return clientSecret to frontend
// Frontend collects payment via Stripe Elements
// Payment success webhook creates order automaticallySee Stripe Integration, PayPal Integration, or Square Integration for complete setup.
Tips
- v0 is great for UI-first development. Focus on how it looks, then wire up the API.
- Start with simple components (product card, button) before building complex flows.
- Test API integration thoroughly—make sure real data loads correctly.
- Remember: Don't try to create orders via API. Use payment provider webhooks instead.
Next Steps
- Stripe Integration Guide — Set up Stripe payments
- PayPal Integration Guide — Set up PayPal payments
- Square Integration Guide — Set up Square payments
- View the full API Reference
- Learn about Webhooks
- Check out Best Practices