Integration Guide · AI Website Builders

Add Ecommerce to AI-Generated Websites

Tools like Lovable, Bolt, v0, and Cursor generate great frontend interfaces quickly, but maintaining a real backend for inventory, carts, idempotent checkout, and webhooks is error-prone. Let Shoprivet handle the commerce engine.

Target: Lovable / Bolt / v0 / Replit / Cursor Integration: JavaScript Embed (widget.js) or Public Storefront API + Guest Carts OpenAPI 3.0 Spec

Prerequisites & Setup Checklist

  • An AI-generated React, Vite, Next.js, or HTML frontend
  • A Shoprivet store slug
  • Sign up at shoprivet.io/app/signup, create a store, add products, and configure a payment gateway (or Cash on delivery).

Environment Variables

Variable Example Value Exposure Rule
VITE_SHOPRIVET_STORE_SLUG / NEXT_PUBLIC_SHOPRIVET_STORE_SLUG downtown-shop Safe public store slug
SHOPRIVET_API_KEY shoprivet_live_example_key Backend ONLY (never ask an AI prompt to put this in client code)

Implementation Steps

1. Keep generated UI decoupled from payment secrets

Instruct your AI builder or coding assistant to connect only to https://api.shoprivet.io/public/stores/{slug} endpoints in browser code, or embed <div data-shoprivet="...">.

2. Point AI coding tools to OpenAPI and llms.txt

Share https://shoprivet.io/docs/openapi.json or https://shoprivet.io/llms.txt with Cursor or another AI assistant so it uses verified endpoints, field names, and idempotency keys instead of inventing endpoints.

3. Verify guest cart checkout and order confirmation

Ensure your generated checkout form sends a per-attempt idempotencyKey, redirects when authorizationUrl is returned, and confirms the order via POST /public/stores/:slug/orders/:orderNumber/confirm.

Prompt snippet for Cursor, Lovable, or Bolt
Integrate Shoprivet public storefront APIs for store slug "downtown-shop" using base URL https://api.shoprivet.io.
- Fetch catalog from GET /public/stores/downtown-shop/products
- Fetch enabled payment providers from GET /public/stores/downtown-shop/payment-methods
- Create guest cart via POST /public/stores/downtown-shop/carts (save returned bearer credential)
- Mutate items via POST /public/stores/downtown-shop/carts/current/items
- Check out via POST /public/stores/downtown-shop/carts/current/checkout with idempotencyKey: crypto.randomUUID()
- Redirect if authorizationUrl is returned; never put shoprivet_live_ keys in browser code.

Payment Verification, Error Handling & Security

Review generated code carefully before shipping: verify no secret API keys are stored in client state or VITE_/NEXT_PUBLIC_ variables.

  • Client-side generated frontends must never hold merchant API keys.
  • All discounts, stock checks, and prices are enforced server-side by Shoprivet regardless of client UI edits.

Deployment

Deploy your generated frontend anywhere while Shoprivet serves APIs and payments.