Skip to main content

Commerce (read-only)

The commerce API reports the creator's own storefront orders captured from a connected Shopify or WooCommerce store. It is observability, not a checkout.

We are not the merchant of record

lsg.bio never processes a creator's customer payment, holds funds, issues a refund, or pays a commission. There is no create-order, refund, or payout endpoint in this API, and there will not be one without a new product and a processor agreement.

Scopes​

Both routes require commerce:read. There is no commerce:write scope.

GET /api/v1/commerce/orders​

Returns the owner's orders for one currency.

ParameterMeaning
sinceRFC 3339 lower bound (default: 30 days ago)
untilRFC 3339 upper bound
currencyISO 4217 code; defaults to the account display currency
shop_domainOne connected store
statusall, net, or refunded
page_size1–200, default 50
page_tokenOffset token from the previous page
curl -s "https://lsg.bio/api/v1/commerce/orders?currency=USD&status=net" \
-H "Authorization: Bearer $LSGBIO_TOKEN"

An order carries its store domain, amount in cents, currency, refund flag, timestamp, landing site, and the attributed link when one matched. Rows with no match read as Direct / not attributed; the API never guesses attribution.

GET /api/v1/commerce/orders/{id}​

One order with its line items, refunded amount, store financial status, and attribution. Read-only; there is no refund endpoint.

Products and product-level revenue​

GET /api/v1/commerce/products lists the creator's catalog mirror with units and revenue from order line items in one currency.

POST /api/v1/commerce/products/sync asks Shopify for the catalog. It is a read of the store into our mirror, never a write to the store. Shopify connections must have granted read_products; an older read_orders-only connection returns reconnect_required and is never widened silently. The dashboard shows the same status and offers the reconnect path.

WooCommerce products are learned from order line items; a full Woo API catalog sync would require separate read-only API keys and is not collected.

Refunds​

Refunds are observed from the store:

  • Shopify: subscribe the app to refunds/create at POST /api/commerce/shopify/refunds. Amounts come from the refund's successful refund transactions and accumulate, capped at the order total.
  • WooCommerce and Gumroad: refund/cancellation/dispute deliveries mark the order refunded.

No endpoint initiates, approves, or pays a refund.

GET /api/v1/commerce/breakdown​

Per-dimension totals in one currency:

dimensionRowsCarries
storeConnected storesCommerce gross/refunded/net + orders
linkAttributed links + directCommerce totals + affiliate approved/pending/conversions
campaignAffiliate campaign attributionApproved/pending/conversions (commerce has no campaign key)
affiliateAffiliate networksApproved/pending/conversions

Mixed currencies are never summed: ask for one currency at a time. The Revenue page renders these as Stores, Links, Campaigns, and Affiliates tabs.

GET /api/v1/commerce/revenue​

Daily gross, refunded, and net totals for one currency, plus the totals across the window. Refunds are observed from the store payload; they are never initiated here. Mixed currencies are never summed — ask for one bucket at a time.

curl -s "https://lsg.bio/api/v1/commerce/revenue?currency=EUR" \
-H "Authorization: Bearer $LSGBIO_TOKEN"

Test tokens​

A test token can call both routes but cannot write anywhere. See token management.