CommerceForAI

Introduction

CommerceForAI is a hosted commerce API that sits on top of your own Stripe account. Stripe takes the payment. CommerceForAI handles everything around it: products and sizes, stock that can't oversell, orders created from verified Stripe events, shipping labels, returns, print-on-demand, customer emails, and events you can build on.

You use it through a zero-dependency TypeScript SDK, the HTTP API, or an MCP server that lets an AI agent operate the store. The docs are also available to coding agents as llms.txt.

npm install commerceforai

How it fits together

  1. Catalog. Create products with variants (sizes, colors). Each variant has a price in cents and, optionally, a stock count.
  2. Checkout. checkouts.create() reserves stock and returns a Stripe Checkout URL. Redirect the customer there.
  3. Orders. When Stripe confirms payment, a signed webhook turns the checkout into an order and commits the stock. Your success page is never treated as proof of payment.
  4. Fulfillment. Buy a shipping label, or let Printful or Printify print and ship. Either way the order is marked fulfilled and the customer gets tracking.
  5. After the sale. Refunds, returns and restocks go through the same API. Every change emits an event.

Conventions

  • Money is in minor units. $25.00 is 2500.
  • Every SDK call returns { data, error }. API errors never throw. Check error.type, for example out_of_stock or invalid_request.
  • POSTs are idempotent. The SDK sends an Idempotency-Key automatically, so retries can't create duplicates.
  • Test and live mode follow your Stripe key. A store created with a test key gets cfa_test_ API keys.

Next