Skip to main content
Headless CLIOrders + fulfillment
Headless CLI

Orders + fulfillment

Handle fulfillment and refunds from the command line when operations need to move fast.

Order-side commands — list, fulfill (full or partial), refund, returns, exchanges. Bulk patterns with jq.

Order-side commands mirror the REST /merchant/orders endpoints — list, get, fulfill, refund, return, exchange.

List

bash
# All recent ordersaly-store-cli orders list --site-slug acme --limit 25 # Filter by statusaly-store-cli orders list --status pendingaly-store-cli orders list --status fulfilled # Filter by datealy-store-cli orders list --created-after 2026-05-01 --json # Filter by customeraly-store-cli orders list --customer-id cust_42

Get

bash
aly-store-cli orders get ord_72...4b --json

Fulfill

bash
# Fulfill all unshipped items in one goaly-store-cli orders fulfill ord_72...4b \  --carrier USPS \  --tracking 9400111202555582846137 # Partial — specify line items + quantitiesaly-store-cli orders fulfill ord_72...4b \  --carrier UPS \  --tracking 1Z999AA10123456784 \  --item li_1:1 --item li_2:2
Per-line fulfillment is durable
Each --item records a separate fulfillment row. The order stays in partially_fulfilled until every line item ships.

Refund

bash
# Full refundaly-store-cli orders refund ord_72...4b --reason "Buyer request" # Partial refund (amount in cents)aly-store-cli orders refund ord_72...4b --amount 1500 --reason "Damaged in transit"

Returns

bash
# Createaly-store-cli orders return create ord_72...4b \  --item li_1:1 \  --reason "Wrong size" # Approve (issues RMA)aly-store-cli orders return approve ord_72...4b ret_8c... # Receivealy-store-cli orders return receive ord_72...4b ret_8c... # Rejectaly-store-cli orders return reject ord_72...4b ret_8c... --reason "Outside window"

Exchanges

bash
aly-store-cli orders exchange create ord_72...4b \  --item li_1:1 \  --new-variant-id var_2 \  --reason "Wrong color"

Bulk patterns

List + xargs for batch operations:

bash
# Mark every pending order in the last 24h as shipped via USPS standardaly-store-cli orders list --status pending --created-after $(date -u -v-1d +%FT%TZ) --json \  | jq -r '.[].id' \  | while read id; do      aly-store-cli orders fulfill "$id" \        --carrier USPS \        --tracking "$(my-shipping-system create-label --order "$id" --json | jq -r .tracking)"    done

Output discipline

For automation, always pass --json and pipe through jq. Human output is intentionally unstable across versions; JSON shape tracks the REST API and only breaks on documented major bumps.

Updated

Was this page helpful?