# Commerce Layer

```json
{
  "name": "Commerce Layer",
  "slug": "commerce_layer",
  "url": "https://composio.dev/toolkits/commerce_layer",
  "markdown_url": "https://composio.dev/toolkits/commerce_layer.md",
  "logo_url": "https://logos.composio.dev/api/commerce_layer",
  "categories": [
    "e-commerce"
  ],
  "is_composio_managed": false,
  "updated_at": "2026-08-27T05:40:23.328Z"
}
```

![Commerce Layer logo](https://logos.composio.dev/api/commerce_layer)

## Description

Securely connect your AI agents and chatbots (Claude, ChatGPT, Cursor, etc) with Commerce Layer MCP or direct API to create and manage orders, update inventory levels, adjust prices and promotions, and track fulfillment and shipments through natural language.

## Summary

Commerce Layer is a headless commerce platform with transactional APIs for orders, inventory, pricing, customers, and fulfillment.
Use it to centralize ecommerce operations and surface real-time commerce data.

## Categories

- e-commerce

## Toolkit Details

- Tools: 10

## Images

- Logo: https://logos.composio.dev/api/commerce_layer

## Authentication

- **S2s Oauth2**
  - Type: `custom`
  - Description: S2s Oauth2 authentication for Commerce Layer.
  - Setup:
    - Configure S2s Oauth2 credentials for Commerce Layer.
    - Use the credentials when creating an auth config in Composio.

## Suggested Prompts

- List open orders created in last day
- Create refund for order 12345 now
- Update inventory levels for SKU 5678

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `COMMERCE_LAYER_CREATE_CUSTOMER` | Create Customer | Create one Commerce Layer customer from an email and optional external-reference metadata. Use a unique email or reference for automation. This mutation is cleanly undoable with DELETE_CUSTOMER using the returned customer ID. |
| `COMMERCE_LAYER_DELETE_CUSTOMER` | Delete Customer | Permanently delete one Commerce Layer customer by exact ID. This irreversible operation requires explicit confirmation and is intended only for confirmed cleanup or erasure, never bulk deletion. Never infer or enumerate customer IDs; call GET_CUSTOMER first unless deleting a fixture created in the same workflow. |
| `COMMERCE_LAYER_GET_CUSTOMER` | Get Customer | Retrieve one customer by its Commerce Layer resource ID. |
| `COMMERCE_LAYER_GET_ORDER` | Get Order | Retrieve one Commerce Layer order by ID, optionally including customer, line-item, shipment, or return context. |
| `COMMERCE_LAYER_GET_ORDER_METRIC` | Get Order Metric | Compute one common order KPI over optional date, market, currency, and status filters using the Commerce Layer Metrics API. |
| `COMMERCE_LAYER_LIST_CUSTOMERS` | List Customers | Return one page of customers, optionally filtered by an exact email address. |
| `COMMERCE_LAYER_LIST_ORDERS` | List Orders | Return one page of orders, newest first by default, for operational review and follow-up by order ID. |
| `COMMERCE_LAYER_LIST_SKUS` | List SKUs | Return one page of catalog SKUs for product discovery and ID lookup. |
| `COMMERCE_LAYER_LIST_STOCK_ITEMS` | List Stock Items | Return one page of stock items with inventory quantities and SKU codes. |
| `COMMERCE_LAYER_UPDATE_CUSTOMER` | Update Customer | Update selected attributes of one Commerce Layer customer. Only non-null fields supplied by the caller are changed. Inspect the customer first when rollback matters; restoring the captured values reverses this update. |

## Supported Triggers

None listed.

## Installation and MCP Setup

### Path 1: SDK Installation

#### Path 1, Step 1: Install Composio

Install the Composio SDK
```python
pip install composio_openai
```

```typescript
npm install @composio/openai
```

#### Path 1, Step 2: Initialize Composio and Create Tool Router Session

Import and initialize Composio client, then create a Tool Router session. Use auth_configs.create() and connected_accounts.link() to configure credentials when linking Commerce Layer accounts.
```python
from openai import OpenAI
from composio import Composio
from composio_openai import OpenAIResponsesProvider

composio = Composio(provider=OpenAIResponsesProvider())
openai = OpenAI()
session = composio.create(user_id='your-user-id')
```

```typescript
import OpenAI from 'openai';
import { Composio } from '@composio/core';
import { OpenAIResponsesProvider } from '@composio/openai';

const composio = new Composio({
  provider: new OpenAIResponsesProvider(),
});
const openai = new OpenAI({});
const session = await composio.create('your-user-id');
```

#### Path 1, Step 3: Execute Commerce Layer Tools via Tool Router with Your Agent

Get tools from Tool Router session and execute Commerce Layer actions with your Agent (use a concrete Commerce Layer prompt below).
```python
tools = session.tools
response = openai.responses.create(
  model='gpt-4.1',
  tools=tools,
  input=[{
    'role': 'user',
    'content': 'List open orders created in the last 24 hours and summarize totals by currency'
  }]
)
result = composio.provider.handle_tool_calls(
  response=response,
  user_id='your-user-id'
)
print(result)
```

```typescript
const tools = session.tools;
const response = await openai.responses.create({
  model: 'gpt-4.1',
  tools: tools,
  input: [{
    role: 'user',
    content: 'List open orders created in the last 24 hours and summarize totals by currency'
  }],
});
const result = await composio.provider.handleToolCalls(
  'your-user-id',
  response.output
);
console.log(result);
```

### Path 2: MCP Server Setup

#### Path 2, Step 1: Install Composio

Install the Composio SDK for Python or TypeScript
```python
pip install composio claude-agent-sdk
```

```typescript
npm install @composio/core ai @ai-sdk/openai @ai-sdk/mcp
```

#### Path 2, Step 2: Initialize Client and Create Tool Router Session

Import and initialize the Composio client, then create a Tool Router session for Commerce Layer. You can call mcp.create() (via composio.create()) to provision the Tool Router session and retrieve session.mcp.url.
```python
from composio import Composio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions

composio = Composio(api_key='your-composio-api-key')
session = composio.create(user_id='your-user-id')
url = session.mcp.url
```

```typescript
import { Composio } from '@composio/core';

const composio = new Composio({ apiKey: 'your-api-key' });
const session = await composio.create('your-user-id');
console.log(`Tool Router session created: ${session.mcp.url}`);
```

#### Path 2, Step 3: Connect to AI Agent

Use the MCP server with your AI agent (Anthropic Claude or Mastra)
```python
import asyncio

options = ClaudeAgentOptions(
    permission_mode='bypassPermissions',
    mcp_servers={
        'tool_router': {
            'type': 'http',
            'url': url,
            'headers': {
                'x-api-key': 'your-composio-api-key'
            }
        }
    },
    system_prompt='You are a helpful assistant with access to Commerce Layer tools.',
    max_turns=10
)

async def main():
    async with ClaudeSDKClient(options=options) as client:
        await client.query('YOUR_SPECIFIC_PROMPT_HERE')
        async for message in client.receive_response():
            if hasattr(message, 'content'):
                for block in message.content:
                    if hasattr(block, 'text'):
                        print(block.text)

asyncio.run(main())
```

```typescript
import { openai } from '@ai-sdk/openai';
import { experimental_createMCPClient as createMCPClient } from '@ai-sdk/mcp';
import { generateText } from 'ai';

const client = await createMCPClient({
  transport: {
    type: 'http',
    url: session.mcp.url,
    headers: {
      'x-api-key': 'your-composio-api-key',
    },
  },
});

const tools = await client.tools();
const { text } = await generateText({
  model: openai('gpt-4o'),
  tools,
  messages: [{
    role: 'user',
    content: 'YOUR_SPECIFIC_PROMPT_HERE'
  }],
  maxSteps: 5,
});

console.log(`Agent: ${text}`);
```

## Why Use Composio?

### 1. AI Native Commerce Layer Integration

- Supports both Commerce Layer MCP and direct API based integrations
- Structured, LLM-friendly schemas for reliable tool execution
- Rich coverage for reading, writing, and querying your Commerce Layer data

### 2. Managed Auth

- Built-in OAuth handling with automatic token refresh and rotation
- Central place to manage, scope, and revoke Commerce Layer access
- Per user and per environment credentials instead of hard-coded keys

### 3. Agent Optimized Design

- Tools are tuned using real error and success rates to improve reliability over time
- Comprehensive execution logs so you always know what ran, when, and on whose behalf

### 4. Enterprise Grade Security

- Fine-grained RBAC so you control which agents and users can access Commerce Layer
- Scoped, least privilege access to Commerce Layer resources
- Full audit trail of agent actions to support review and compliance

## Use Commerce Layer with any AI Agent Framework

Choose a framework you want to connect Commerce Layer with:

- [ChatGPT Work](https://composio.dev/toolkits/commerce_layer/framework/chatgpt)
- [Claude Cowork](https://composio.dev/toolkits/commerce_layer/framework/claude-cowork)
- [Hermes](https://composio.dev/toolkits/commerce_layer/framework/hermes-agent)

## Related Toolkits

- [Addresszen](https://composio.dev/toolkits/addresszen) - Addresszen is a real-time address autocomplete and verification service. It helps capture accurate, deliverable addresses with instant suggestions and validation.
- [Asin data api](https://composio.dev/toolkits/asin_data_api) - Asin data api gives you detailed, real-time product data from Amazon, including price, rank, and reviews. Perfect for e-commerce pros and data-driven marketers who need instant marketplace insights.
- [Baselinker](https://composio.dev/toolkits/baselinker) - BaseLinker is an all-in-one e-commerce management platform connecting stores, marketplaces, carriers, and more. It streamlines order processing, inventory control, and automates your sales operations.
- [Bestbuy](https://composio.dev/toolkits/bestbuy) - Best Buy is a leading retailer offering APIs for product, store, and recommendation data. Instantly access up-to-date retail insights for smarter shopping and decision-making.
- [Bluebarry](https://composio.dev/toolkits/bluebarry) - Bluebarry is a customer data and product-advice platform for shopper identities, profiles, and recommendations. It helps teams analyze customer context and synchronize shopper data for better commerce experiences.
- [Btcpay server](https://composio.dev/toolkits/btcpay_server) - BTCPay Server is a free, open-source, self-hosted Bitcoin payment processor. It lets merchants accept Bitcoin payments directly, cutting out middlemen and boosting privacy.
- [Cdr platform](https://composio.dev/toolkits/cdr_platform) - Cdr platform is an API for purchasing carbon dioxide removal services. It enables businesses to offset emissions by accessing verified carbon removal projects.
- [Cloudcart](https://composio.dev/toolkits/cloudcart) - CloudCart is an e-commerce platform for building and managing online stores. It helps businesses streamline product listings, orders, and customer engagement.
- [Countdown api](https://composio.dev/toolkits/countdown_api) - Countdown API gives you real-time, structured eBay product data, reviews, and seller feedback. Perfect for powering price monitoring, product research, or marketplace analytics workflows.
- [Dpd2](https://composio.dev/toolkits/dpd2) - Dpd2 is a robust email management platform for handling, sorting, and automating email workflows. Streamline your communications and boost productivity with advanced sorting, labeling, and response tools.
- [Finerworks](https://composio.dev/toolkits/finerworks) - FinerWorks is an online platform for fine art and photo printing services. Artists and photographers use it to order custom prints and manage print inventory efficiently.
- [Fingertip](https://composio.dev/toolkits/fingertip) - Fingertip is a business management platform for selling, booking, and customer engagement—all from a single link. It helps businesses streamline operations and connect with customers across social channels.
- [Fraudlabs pro](https://composio.dev/toolkits/fraudlabs_pro) - FraudLabs Pro is an online payment fraud detection service for e-commerce and merchants. It helps minimize chargebacks and revenue loss by detecting and preventing fraudulent transactions.
- [Gelato](https://composio.dev/toolkits/gelato) - Gelato is a print-on-demand platform for creating products, managing orders, checking stock, and finding shipping options. It helps businesses sell globally with local production, pricing, and fulfillment.
- [Gift up](https://composio.dev/toolkits/gift_up) - Gift Up! is a digital platform for selling, managing, and redeeming gift cards online. It streamlines promotions and gift card transactions for businesses and their customers.
- [Goody](https://composio.dev/toolkits/goody) - Goody is a gifting platform that lets users send gifts and physical products without handling logistics. It streamlines gifting by managing delivery, fulfillment, and recipient experience.
- [Gumroad](https://composio.dev/toolkits/gumroad) - Gumroad is a platform for selling digital products, physical goods, and memberships with a simple checkout and marketing tools. It streamlines creator payouts and helps you grow your audience effortlessly.
- [Instacart](https://composio.dev/toolkits/instacart) - Instacart is an online grocery delivery and pickup service platform. It lets you discover local retailers and create shoppable lists and recipes with ease.
- [Junglescout](https://composio.dev/toolkits/junglescout) - Junglescout is an Amazon product research and analytics platform for sellers. It delivers sales estimates, competitive insights, and optimization tools to boost your Amazon business.
- [Ko fi](https://composio.dev/toolkits/ko_fi) - Ko-fi is a platform that lets creators receive donations, memberships, and sales from fans. It helps creators monetize their work and grow their audience with minimal friction.

## Frequently Asked Questions

### Do I need my own developer credentials to use Commerce Layer with Composio?

Yes, Commerce Layer requires you to configure your own S2s Oauth2 credentials. Once set up, Composio handles secure credential storage and management for you.

### Can I use multiple toolkits together?

Yes! Composio's Tool Router enables agents to use multiple toolkits. [Learn more](https://docs.composio.dev/tool-router/overview).

### Is Composio secure?

Composio is SOC 2 and ISO 27001 compliant with all data encrypted in transit and at rest. [Learn more](https://trust.composio.dev).

### What if the API changes?

Composio maintains and updates all toolkit integrations automatically, so your agents always work with the latest API versions.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
