# Connect a client website to Emacron Store

The client keeps their customer-facing website and uses Emacron Store as its commerce backend. Products, stock, orders and merchant operations are managed in the Emacron dashboard. This does not move their domain, host their frontend or grant browser access to the CRM dashboard.

## 1. Configure the merchant dashboard

1. Open **Store**, select **Emacron Store**, and create/configure the native Store. Connected WooCommerce/Shopify inventories remain provider-owned.
2. Add genuine products, exact options/SKUs, currency, prices and stock. Explicitly select which products may be published.
3. In **Storefront & checkout**, review business/support details and policies. Configure only the payment and fulfillment methods the merchant intends to offer. Enable customer sign-in/guest checkout deliberately. Email/WhatsApp sign-in requires the relevant package, selected connected sender and, for WhatsApp, an approved authentication template.
4. Deliberately publish the Store when its genuine details and products are ready. Record its saved public slug from its shop address.
5. Under **Connect your own website**, enable website API access and approve the exact website origin, for example `https://shop.your-company.com`. Add the `www` origin separately if used. No paths or wildcards. HTTPS is required except localhost development. This approves browser access, not customer ownership or staff permissions.

## 2. Connect the frontend

Download [the browser SDK](https://crm.emacronai.com/emacron-store.js) and host it on the client's website. No employee token, administrator key, gateway secret or merchant server key belongs in browser code.

```js
import { EmacronStore } from '/emacron-store.js';

const store = new EmacronStore({
  slug: 'YOUR_SAVED_STORE_SLUG',
  apiOrigin: 'https://api.crm.emacronai.com'
});
const settings = await store.settings();
const catalog = await store.products({ page: 0 });
// Render actual returned product/option IDs and prices.
```

This works with a custom React/Next.js, Vue or plain JavaScript frontend. The SDK uses the documented `/api/shop/{slug}` APIs. Merchant setup/publication/origin changes remain dashboard actions. Check `authMethods()` before offering sign-in, and use only the verified customer's private proof for owned account/order operations. An allowed website origin is never that proof.

For checkout, collect actual cart items and destination, load current fulfillment/payment choices, prepare a private `prepareReview()` draft, call `review()`, display its authoritative prices/policies, obtain explicit confirmation, then call `place()`. Preserve the original operation/proof after an uncertain response and inspect saved status. Do not automatically retry writes with fresh IDs. SDK and complete examples are linked below.

## 3. Optional actual Shiprocket price

Only offer this if the merchant has enabled/configured carrier-priced checkout. Call `deliveryChoices()` for the actual cart and destination. Its selected service may contain `carrier_quotes`. Display the returned delivery cost (`fee_minor`), currency, eligible payment methods and expiry. The merchant can enable courier names in Store settings. With names off, the API returns a neutral Delivery label and the lowest eligible estimate for each payment method. Keep the quote private.

Pass the selected service's `id` as `service_id` and its selected quote's `id` as `carrier_quote_id` to `prepareReview()`, together with the actual items, full destination, selected permitted payment method and accepted policies. The SDK retains that quote ID. Do not invent or submit your own shipping amount. Refresh quotes when the cart/address/payment choice changes or the estimate expires. Server review and placement validate the quote; an estimate does not book a shipment or schedule pickup.

The vanilla starter demonstrates merchant-rule delivery, pickup slots and a carrier estimate picker. Use it as an example of selecting an estimate and sending its ID with checkout review. The hosted Store has its own delivery-estimate interface.

## 4. Orders and payment

Placed orders use the same native order engine and appear in the merchant dashboard. Payment, fulfillment, returns, stock receipts and refunds remain distinct facts. For online payment, request payment against the saved order, open only its returned secure provider link, and reconcile saved status. A browser success callback is not proof of payment. Do not expose staff refund/booking controls to customers.

Use signed Store events for your trusted server's integrations. Verify signatures, deduplicate events and handle out-of-order delivery. If server inventory/order reads or explicitly supported fulfillment/tracking writes are needed, issue a narrowly scoped **server access key** in the dashboard and keep it only in your server secret manager. These keys are separate from shopper authentication and do not grant arbitrary CRM administration.

## 5. Validate before client launch

On the exact approved origin, test actual published products/options, guest and signed-in ownership, changed/expired quotes, out-of-stock and failed requests, payment status, dashboard order visibility, eligible cancellations/returns and your intended notifications. Confirm each merchant's own channel/payment/carrier configuration. Emacron's remaining carrier, recurring, lifecycle and physical-print acceptance gaps mean the whole Store is not yet universally launch-certified. Physical pickups must never be inferred from a rate or order.

## References

- [Public guide](https://crm.emacronai.com/docs/storefront-api)
- [Typed supported OpenAPI](https://crm.emacronai.com/specs/store-api-v1.json)
- [Operation matrix](https://crm.emacronai.com/specs/store-operation-matrix-v1.md)
- [Authentication, ownership and retries](https://crm.emacronai.com/specs/store-auth-ownership-v1.md)
- [Framework-free starter](https://crm.emacronai.com/examples/storefront/)
- [Starter setup and limitations](https://crm.emacronai.com/examples/storefront/README.md)
- [Signed event receiver contract](https://crm.emacronai.com/specs/store-webhooks-v1.md)

The current source-derived contract contains120 supported public/customer/checkout/merchant-server operations. Another331 staff/provider operations are inventoried separately; that inventory is not a complete typed private API reference and grants no browser or server-key authority. API version1 is not a promise that every planned Store feature is accepted or enabled.
