# Shopify

> Connect Shopify to atrby with a paid-order webhook and cart attributes, so each order is matched to the visit that brought it.

Canonical: https://atrby.site/docs/integrations/shopify
Last updated: 2026-10-21

Attribute every Shopify order to the visit that brought it.

## Connect

1. In Shopify admin, open Settings → Notifications → Webhooks → Create webhook, with the event **Order payment** and format JSON. Below the list, Shopify shows the key your webhooks are signed with. That's the secret.
2. In atrby, open Revenue → Payment processors → Connect, choose Shopify and paste the secret.
3. atrby shows your webhook URL. It looks like `https://app.atrby.site/api/webhooks/shopify/…`. Add it in Shopify and send this event: `orders/paid`.

The connection shows as active once the first webhook arrives. Webhooks with a wrong signature are rejected.

## Pass the visit ids

Where they go: Cart attributes, which Shopify copies to the order as `note_attributes`. Add a small script to your theme so the ids are stored on the cart.

*Browser*

```js
const ids = window.atrby?.ids(); // { atrby_sid, atrby_site }
```

*Theme · layout/theme.liquid, before </body>*

```html
<script>
  window.addEventListener("load", () => {
    const ids = window.atrby?.ids();
    if (ids) fetch("/cart/update.js", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ attributes: ids }),
    });
  });
</script>
```

## What gets recorded

- Each order once, however often Shopify retries the webhook.
- The amount is the order's `total_price` in the shop currency.
- Refunds aren't read from Shopify yet, so revenue is gross of refunds.

## Related
- [Stripe](https://atrby.site/docs/integrations/stripe)
- [Paddle](https://atrby.site/docs/integrations/paddle)
- [Payment API](https://atrby.site/docs/payment-api)
