# Buy from your Shopify store with an AI agent

> Connect a Shopify store to Atta. The agent searches its catalog, builds the cart, hands off Shopify checkout, and settles the budget from the store's webhooks.

Updated 2026-11-06. Source: https://atta.sh/integrations/shopify

Connect a Shopify store to a workspace and the Atta agent searches its catalog, builds a cart and sends the order through Shopify's own checkout. Shopify's webhooks tell Atta when the order is paid or cancelled, and that settles or releases the budget reservation. The approval policy applies before the checkout link is handed out.

## What the agent does with the store

The connected store is a catalog the agent can search and a cart it can fill. A request like "20 of the 500 ml bottles" becomes a search, a comparison across the variants, and a cart. Store and brand preferences filter the results in code before the model sees them.

Checkout works like this:

- `placeOrder` runs after the approval policy allows it. It reserves the amount against the budget and stamps the Shopify cart so the order can be recognized later.
- The shopper gets Shopify's checkout link. With a card program, Atta first issues a single-use [virtual card](https://atta.sh/virtual-cards) capped at the approved total, and the shopper pays with it in Shopify's checkout.
- The order shows as handed off until the store reports back.

A reservation isn't a payment. Atta never decrements a budget as if a handoff were money spent.

## How the store reports back

Shopify calls `POST /api/webhooks/shopify`, which is verified with the store's webhook secret.

| Event | What Atta does |
| --- | --- |
| Paid | Keeps the reservation, so it counts as spent |
| Cancelled | Releases the reservation back to the budget |
| Fulfilled | Receives the lines, and writes stock for any linked to an inventory item |
| Paid after a release | Holds the money again, under its own key |

An event is matched to its order by Shopify's cart token. The first event pins Shopify's order id. A total that differs is logged at error level, and a total above the row's is held for the difference.

For a store that never reports, the orders page has two backstop buttons, and an hourly sweep releases checkouts nobody answered.

> **Atta:** Order 1042 is with Shopify checkout. $186.00 is reserved against Operations. I'll release it if it isn't paid in 24 hours.

For a card-paid order, the card's events move the budget and the Shopify webhook moves status only. Both report the same payment, and counting it twice would release too much on a refund.

## Setting it up

Connecting a store to a workspace needs the operator to set a key once and someone with workspace management to enter the store's details.

1. **Operator:** generate a key with `openssl rand -base64 32` and set it as `CONNECTIONS_KEY`. Without it, connecting is refused.
2. **Create a custom app in Shopify** with an Admin API token and a Storefront token, and a webhook secret.
3. **In Atta,** open Settings, then "Your store and channels", and enter the `*.myshopify.com` domain, the Admin token, the Storefront token and the webhook secret.
4. **Point the store's webhooks** at `https://<your-host>/api/webhooks/shopify`. Settings shows the URL.

Atta asks Shopify before saving. The Admin API's shop domain must match the one you entered, so a workspace can't claim a store it doesn't hold. The Admin token is used once for that check and not stored. The other secrets are encrypted with AES-256-GCM, bound to the workspace and domain, and the fields never display them again. A workspace has one live store, and a domain can belong to only one workspace.

A workspace with no connection uses the deployment's store from environment variables, if the operator configured one.

## What the open web adds

A Shopify store isn't the only place the agent can look. The open web is read-only. The agent returns the product links or a cart link for the shopper to open, and doesn't check out there. A store that supports the Universal Commerce Protocol can get an anonymous cart created from Atta's servers, carrying the lines and the shopper's country and nothing else.

## Questions

### Does Atta pay the Shopify order itself?

The shopper pays in Shopify's checkout, using the link Atta hands over. With a card program, Atta issues a single-use card capped at the approved total for that payment.

### How does the budget know an order was paid?

Shopify's webhook reports it, matched by cart token. Until then the amount is reserved, not spent, and a cancelled order releases it.

### Can two workspaces share one store?

No. A domain belongs to one workspace, and a workspace has one live store. Atta checks with Shopify that the credentials are for the domain you entered.

### Where are the Shopify secrets kept?

The Admin token is used once to verify the shop and isn't stored. The other secrets are encrypted at rest under the deployment's connections key, and nothing reads them back to a page.
