Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.neuraldraft.io/llms.txt

Use this file to discover all available pages before exploring further.

The Commerce pillar is a Shopify-alternative for AI-built sites. Stripe Connect is wired in from day one, so payouts go straight to the project owner — never through Neural Draft. Cart lives in the buyer’s browser; we take a cart payload and create a Stripe Checkout Session on the connected account.

What this gives you

  • Products with variants, categories, inventory tracking, image galleries, multi-language translations.
  • Stripe Connect — Express onboarding flow, status checks, charges / payouts gating.
  • Checkout sessions — pass a cart, get a Stripe-hosted checkout URL. Direct charges on the connected account.
  • Orders with full state machine (pending → paid → processing → shipped → delivered), refunds, partial refunds.
  • Storefront widgets — product card, buy button, cart drawer, all CDN-cached.
  • Manual orders — for offline / cash sales that bypass payment.

Quick example

A typical e-commerce flow: list products publicly, accept a cart, create a Stripe Checkout Session, redirect the customer.
# 1. Public product listing (no auth)
curl "https://api.neuraldraft.io/v1/public/products?project_id=$PROJECT_ID"

# 2. Create a checkout session
curl -X POST https://api.neuraldraft.io/v1/checkout-sessions \
  -H "Content-Type: application/json" \
  -d '{
    "items": [{ "product_id": 42, "variant_id": 88, "quantity": 1 }],
    "customer": { "name": "Ada Lovelace", "email": "ada@example.com" }
  }'

# => { "order_id": 902, "checkout_url": "https://checkout.stripe.com/c/pay/cs_live_..." }

Common workflows

1. Onboard Stripe Connect for the project

Required for any paid product or paid booking. The project owner clicks a button, lands on Stripe-hosted onboarding, and returns when complete.
curl -X POST https://api.neuraldraft.io/v1/connect/onboarding \
  -H "Authorization: Bearer $NEURAL_DRAFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "return_url": "https://example.com/admin/connected",
    "refresh_url": "https://example.com/admin/connect"
  }'
{
  "url": "https://connect.stripe.com/express/onboarding/...",
  "existing_account": false
}
Surface the URL to the user. Once they finish, the connect.account_updated webhook fires and GET /v1/connect/status reports charges_enabled: true. Cost: 250 credits per Connect account, per month — billed at month-end.

2. Create a product

curl -X POST https://api.neuraldraft.io/v1/products \
  -H "Authorization: Bearer $NEURAL_DRAFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Neural Draft hoodie",
    "slug": "nd-hoodie",
    "description": "A purple hoodie. Heavy gauge, soft inside.",
    "price": 4500,
    "currency": "gbp",
    "type": "physical",
    "status": "active",
    "track_inventory": true,
    "stock_quantity": 200,
    "images": ["https://cdn.example.com/hoodie.jpg"]
  }'
price is integer cents. Currency follows the project’s Stripe Connect currency.

3. Add variants

curl -X POST https://api.neuraldraft.io/v1/products/42/variants \
  -H "Authorization: Bearer $NEURAL_DRAFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Medium / Purple",
    "sku": "ND-HOODIE-M-PURPLE",
    "options": { "size": "M", "color": "Purple" },
    "stock_quantity": 50,
    "is_active": true
  }'

4. Drop a buy-button widget into a page

<div data-nd-widget="buy-button" data-product-id="42" data-variant-id="88"></div>
<script src="https://widgets.neuraldraft.io/v1/buy-button.js" defer></script>
The widget reads your brand colors, opens Stripe Checkout, redirects on success. Works on any HTML page, any framework.

5. Listen for paid orders

curl -X POST https://api.neuraldraft.io/v1/webhook-endpoints \
  -H "Authorization: Bearer $NEURAL_DRAFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/api/neural-draft",
    "events": ["order.created", "order.paid", "order.refunded", "order.shipped"]
  }'
When a customer completes Stripe Checkout, we receive Stripe’s webhook, update the Order to paid, decrement stock, and fire order.paid to your endpoint. Use it to send a fulfilment email, kick off a warehouse pick, or tag the customer in your CRM.

6. Refund an order

curl -X POST https://api.neuraldraft.io/v1/orders/902/refund \
  -H "Authorization: Bearer $NEURAL_DRAFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":1500}'
amount (cents) is optional. Omit for a full refund. Partial refunds update payment_status to partially_refunded.

7. Manual / cash orders

Useful for in-person and over-the-phone sales that bypass Stripe Checkout.
curl -X POST https://api.neuraldraft.io/v1/orders/manual \
  -H "Authorization: Bearer $NEURAL_DRAFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [{ "product_id": 42, "quantity": 2 }],
    "customer": { "name": "Walk-in", "email": "" },
    "payment_method": "manual"
  }'
The order is created with payment_status: unpaid. Flip it to paid (via PATCH /v1/orders/{id}/status) once cash is in hand.

Reference

EndpointTag
GET /v1/productsCommerce
POST /v1/productsCommerce
GET /v1/products/{id}Commerce
PATCH /v1/products/{id}Commerce
POST /v1/products/{id}/variantsCommerce
GET /v1/product-categoriesCommerce
GET /v1/ordersCommerce
PATCH /v1/orders/{id}/statusCommerce
POST /v1/orders/{id}/refundCommerce
POST /v1/checkout-sessionsCommerce
POST /v1/orders/manualCommerce
GET /v1/connect/statusCommerce
POST /v1/connect/onboardingCommerce
GET /v1/public/productsCommerce