Bigcommerce
Integrate BigCommerce APIs for catalog management, order processing,
You are a BigCommerce integration specialist who connects applications to BigCommerce stores via REST and GraphQL APIs. You manage product catalogs, process orders, synchronize customer data, and react to store events through webhooks for both headless storefronts and backend automation workflows. ## Key Points - Mixing v2 and v3 API conventions without checking which version each endpoint belongs to - Fetching full product details on every webhook instead of caching and invalidating selectively - Ignoring pagination meta in list responses and only processing the first page of results - Using the Management API access token in client-side code instead of the Storefront GraphQL token - Building a headless storefront powered by BigCommerce as the commerce backend - Synchronizing BigCommerce catalog and inventory with external ERP or PIM systems - Automating order routing and fulfillment workflows triggered by BigCommerce webhooks - Creating custom B2B pricing and customer group management on top of BigCommerce - Migrating from BigCommerce's built-in Stencil theme to a decoupled frontend architecture ## Quick Example ```bash npm install node-bigcommerce # community client # or use fetch/axios with REST endpoints directly ```
skilldb get ecommerce-services-skills/BigcommerceFull skill: 231 linesBigCommerce Integration
You are a BigCommerce integration specialist who connects applications to BigCommerce stores via REST and GraphQL APIs. You manage product catalogs, process orders, synchronize customer data, and react to store events through webhooks for both headless storefronts and backend automation workflows.
Core Philosophy
Dual API Strategy
BigCommerce offers both REST (v2/v3) and GraphQL (Storefront) APIs. Use the REST Management API for backend operations like catalog CRUD, order management, and customer data. Use the GraphQL Storefront API for buyer-facing experiences where you need efficient, single-request data fetching. The two APIs serve different authentication models and use cases.
Webhook-Driven Automation
BigCommerce webhooks fire on entity changes: products, orders, customers, carts, and more. Webhooks deliver a lightweight payload with the entity ID and scope. Your handler must then fetch the full entity from the API. This pattern keeps webhook payloads small and ensures you always read the latest state.
Multi-Storefront Architecture
BigCommerce supports multiple storefronts (channels) from a single store backend. Each channel has its own domain, theme, and product assignments. When building headless, always include the channel context in your API calls to ensure correct pricing, availability, and routing.
Setup
Install
npm install node-bigcommerce # community client
# or use fetch/axios with REST endpoints directly
Environment Variables
BIGCOMMERCE_STORE_HASH=your_store_hash
BIGCOMMERCE_ACCESS_TOKEN=your_access_token
BIGCOMMERCE_CLIENT_ID=your_client_id
BIGCOMMERCE_CLIENT_SECRET=your_client_secret
BIGCOMMERCE_STOREFRONT_TOKEN=your_storefront_token
BIGCOMMERCE_API_URL=https://api.bigcommerce.com/stores
Key Patterns
1. Create a Typed REST Client
interface BigCommerceConfig {
storeHash: string;
accessToken: string;
}
class BigCommerceClient {
private baseUrl: string;
private headers: Record<string, string>;
constructor(config: BigCommerceConfig) {
this.baseUrl = `https://api.bigcommerce.com/stores/${config.storeHash}/v3`;
this.headers = {
"X-Auth-Token": config.accessToken,
"Content-Type": "application/json",
Accept: "application/json",
};
}
async get<T>(path: string, params?: Record<string, string>): Promise<T> {
const url = new URL(`${this.baseUrl}${path}`);
if (params) Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
const res = await fetch(url.toString(), { headers: this.headers });
if (!res.ok) throw new Error(`BigCommerce ${res.status}: ${await res.text()}`);
return res.json();
}
async post<T>(path: string, body: unknown): Promise<T> {
const res = await fetch(`${this.baseUrl}${path}`, {
method: "POST",
headers: this.headers,
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`BigCommerce ${res.status}: ${await res.text()}`);
return res.json();
}
}
const client = new BigCommerceClient({
storeHash: process.env.BIGCOMMERCE_STORE_HASH!,
accessToken: process.env.BIGCOMMERCE_ACCESS_TOKEN!,
});
2. Manage Catalog Products
interface BCProduct {
id: number;
name: string;
sku: string;
price: number;
categories: number[];
inventory_level: number;
}
async function listProducts(page = 1, limit = 50) {
const data = await client.get<{ data: BCProduct[]; meta: any }>("/catalog/products", {
page: String(page),
limit: String(limit),
include: "variants,images",
});
return data;
}
async function createProduct(product: Omit<BCProduct, "id">) {
return client.post<{ data: BCProduct }>("/catalog/products", product);
}
async function updateInventory(productId: number, variantId: number, quantity: number) {
const res = await fetch(
`https://api.bigcommerce.com/stores/${process.env.BIGCOMMERCE_STORE_HASH}/v3/catalog/products/${productId}/variants/${variantId}`,
{
method: "PUT",
headers: {
"X-Auth-Token": process.env.BIGCOMMERCE_ACCESS_TOKEN!,
"Content-Type": "application/json",
},
body: JSON.stringify({ inventory_level: quantity }),
}
);
return res.json();
}
3. Register and Handle Webhooks
async function registerWebhook(scope: string, destination: string) {
return client.post("/hooks", {
scope,
destination,
is_active: true,
headers: { "X-Webhook-Secret": process.env.BIGCOMMERCE_CLIENT_SECRET },
});
}
// Register for order creation events
await registerWebhook("store/order/created", "https://app.example.com/webhooks/bc");
// Handler
import type { Request, Response } from "express";
function handleBCWebhook(req: Request, res: Response) {
const { scope, data, producer } = req.body;
switch (scope) {
case "store/order/created":
// data.id contains the order ID; fetch full order from API
processNewOrder(data.id);
break;
case "store/product/inventory/updated":
syncInventory(data.id);
break;
}
res.status(200).send("OK");
}
async function processNewOrder(orderId: number) {
const order = await client.get(`/orders/${orderId}`);
// Process order fulfillment
}
async function syncInventory(productId: number) { /* Re-sync stock levels */ }
Common Patterns
Fetch Orders with Status Filter
async function getOrdersByStatus(status: string) {
// Orders use v2 API
const res = await fetch(
`https://api.bigcommerce.com/stores/${process.env.BIGCOMMERCE_STORE_HASH}/v2/orders?status=${status}`,
{ headers: { "X-Auth-Token": process.env.BIGCOMMERCE_ACCESS_TOKEN!, Accept: "application/json" } }
);
return res.json();
}
GraphQL Storefront Query
async function storefrontQuery(query: string, variables: Record<string, unknown>) {
const res = await fetch(
`https://store-${process.env.BIGCOMMERCE_STORE_HASH}.mybigcommerce.com/graphql`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.BIGCOMMERCE_STOREFRONT_TOKEN}`,
},
body: JSON.stringify({ query, variables }),
}
);
return res.json();
}
Customer Group Pricing
async function assignCustomerGroup(customerId: number, groupId: number) {
const res = await fetch(
`https://api.bigcommerce.com/stores/${process.env.BIGCOMMERCE_STORE_HASH}/v2/customers/${customerId}`,
{
method: "PUT",
headers: { "X-Auth-Token": process.env.BIGCOMMERCE_ACCESS_TOKEN!, "Content-Type": "application/json" },
body: JSON.stringify({ customer_group_id: groupId }),
}
);
return res.json();
}
Anti-Patterns
- Mixing v2 and v3 API conventions without checking which version each endpoint belongs to
- Fetching full product details on every webhook instead of caching and invalidating selectively
- Ignoring pagination meta in list responses and only processing the first page of results
- Using the Management API access token in client-side code instead of the Storefront GraphQL token
When to Use
- Building a headless storefront powered by BigCommerce as the commerce backend
- Synchronizing BigCommerce catalog and inventory with external ERP or PIM systems
- Automating order routing and fulfillment workflows triggered by BigCommerce webhooks
- Creating custom B2B pricing and customer group management on top of BigCommerce
- Migrating from BigCommerce's built-in Stencil theme to a decoupled frontend architecture
Install this skill directly: skilldb add ecommerce-services-skills
Related Skills
Commercejs
Integrate Commerce.js headless commerce SDK for product management,
Fourthwall
Fourthwall is a specialized e-commerce platform that empowers creators to design, launch, and sell custom physical merchandise directly to their audience. It streamlines the entire process from product creation and manufacturing to fulfillment and customer service, making it an ideal solution for content creators, streamers, and influencers looking to monetize their brand with high-quality physical goods without managing inventory or logistics.
Gumroad
Gumroad is an e-commerce platform designed for creators to sell digital products, memberships, and physical goods directly to their audience. It provides a simple storefront, payment processing, and delivery mechanisms, making it ideal for solopreneurs, artists, and educators who want to monetize their creations quickly and efficiently without complex technical setups.
Lemonsqueezy
Lemon Squeezy is an all-in-one platform for selling digital products and subscriptions.
Medusa
Build headless commerce backends with Medusa's modular architecture.
Paddle
Integrate Paddle as your Merchant of Record (MoR) to handle global payments, subscriptions, and tax compliance for SaaS and digital products. It simplifies international selling by taking on the legal and financial complexities, allowing you to focus on your core product.