Integrating with Claude
You can ask Claude directly to help you build integrations with BareCommerceCore. Claude understands our API and can generate working code.
How It Works
Claude has been trained on deterministic APIs and understands BareCommerceCore's contract. You can ask it to:
- Generate integration code
- Build custom workflows
- Debug API issues
- Create helper functions
- Set up payment processing
Getting Started
1. Set Up Your Store
Create a 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. Ask Claude
Open Claude and describe what you want to build. Include:
- Your store ID
- Your API key (keep it safe!)
- Your payment provider credentials if doing payments
- What you want to accomplish
- Technology you're using (Node.js, Python, etc.)
Starter Prompts
Create Payment Intents with Order Data
I have a BareCommerceCore store with ID {store_id} and use Stripe for payments.
Stripe Secret Key: {stripe_secret_key}
Write a Node.js backend endpoint that:
- Receives cart items and customer info from the frontend
- Creates a Stripe PaymentIntent with order data (items, subtotal, tax, shipping) in the metadata
- Returns the clientSecret to the frontend
- Includes error handling and validationBuild a Webhook Handler for Stripe
I use Stripe for payments with BareCommerceCore.
Write a Node.js webhook handler for Stripe events:
- payment_intent.succeeded (payment completed)
- payment_intent.payment_failed (payment failed)
- charge.refunded (refund processed)
Include:
- Stripe signature verification
- Error handling
- Logging
Note: The order is automatically created in BareCommerce from the webhook.
Your handler should handle additional business logic (send email, update your database, etc).Bulk Import Products
I have 100 products in a CSV file I want to import to BareCommerceCore.
BareCommerce API Key: {api_key}
Store ID: {store_id}
Write a Node.js script that:
- Reads the CSV file
- Creates products via the BareCommerceCore API (POST /products endpoint)
- Handles errors gracefully
- Shows progressSync Inventory to a Third-Party System
I want to sync BareCommerceCore inventory to Shopify every hour.
BareCommerce: API Key {api_key}, Store ID {store_id}
Shopify: API key {shopify_key}
Write a Node.js script that:
- Fetches all products from BareCommerceCore API
- Updates inventory on Shopify
- Logs successes and failures
- Handles rate limitingBuild a Custom Reporting Script
I want to generate a daily sales report from BareCommerceCore.
API Key: {api_key}
Store ID: {store_id}
Write a script that:
- Fetches all orders from the past 24 hours using the API
- Filters by status=paid
- Calculates total revenue, number of orders, average order value
- Generates a PDF or sends a summary email
- Includes error handlingCreate a Full Checkout Flow
I'm building an e-commerce store with BareCommerceCore and Stripe.
Store ID: {store_id}
Stripe Secret Key: {stripe_secret_key}
BareCommerce API Key: {api_key}
Build a complete checkout flow:
- Frontend: Shopping cart component with customer info
- Backend: Create Stripe PaymentIntent with order metadata
- Frontend: Show Stripe payment form
- Webhook handler: Handle payment success
- Include error handling and logging
Note: Orders are created automatically from the Stripe webhook.Important: Orders and Payments
Key architectural point: Orders are created automatically from payment provider webhooks, not via API calls.
❌ Don't do this:
// This endpoint doesn't exist!
POST /api/stores/{storeId}/orders
{ customerId, items, total }✅ Do this instead:
// Create a Stripe PaymentIntent with order data
const paymentIntent = await stripe.paymentIntents.create({
amount: totalInCents,
currency: 'usd',
metadata: {
store_id: storeId,
customer_id: customerId,
items: JSON.stringify(items),
subtotal: subtotal.toString(),
tax: tax.toString(),
shipping: shipping.toString(),
}
});
// When customer pays, Stripe sends webhook to BareCommerce
// BareCommerce creates the order automatically
// No manual order creation needed!Tips for Better Results
- Be specific about what you want — "Build payment processing" vs "Create a function that syncs product inventory every hour"
- Include credentials — Tell Claude your API keys, store ID, payment provider info
- Ask for error handling — "Include proper error messages and retry logic"
- Reference the API docs — If Claude seems confused, point it to the API reference and payment guides
- Test the code — Claude generates good code, but always test before deploying
- Don't ask for order creation API — Orders are created from webhooks, not API calls
Common Tasks
Authenticating Requests to BareCommerce
const headers = {
'X-API-Key': process.env.BARECOMMERCE_API_KEY,
'Content-Type': 'application/json',
};Fetching Products
const response = await fetch(
`https://api.barecommercecore.com/api/stores/${storeId}/products`,
{ headers }
);
const { items, total } = await response.json();Creating Products
const response = await fetch(
`https://api.barecommercecore.com/api/stores/${storeId}/products`,
{
method: 'POST',
headers,
body: JSON.stringify({
title: 'Product Name',
slug: 'product-name',
price: '29.99',
description: 'Product description',
}),
}
);Fetching Orders
const response = await fetch(
`https://api.barecommercecore.com/api/stores/${storeId}/orders?status=paid`,
{ headers }
);
const { items: orders, total } = await response.json();Creating Stripe PaymentIntent
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
const paymentIntent = await stripe.paymentIntents.create({
amount: Math.round(total * 100), // cents
currency: 'usd',
metadata: {
store_id: storeId,
customer_id: customerId,
items: JSON.stringify(items),
subtotal: subtotal.toString(),
tax: tax.toString(),
shipping: shipping.toString(),
}
});When Things Don't Work
If Claude generates code that doesn't work:
- Check the error — Claude can usually read error responses and fix them
- Verify your API key — Make sure it's in the right format and hasn't expired
- Check field names — Our API reference lists all valid fields
- Check endpoint exists — Orders are read-only via GET; they're created from webhooks
- Ask Claude to debug — Paste the error and ask it to fix the code
Next Steps
- Stripe Integration Guide — Complete Stripe setup
- PayPal Integration Guide — Complete PayPal setup
- Square Integration Guide — Complete Square setup
- View the full API Reference
- Learn about Webhooks
- Check out Best Practices