Sample Scripts
These scripts provide a lightweight, dependency-free way to test Thyris merchant integrations from a terminal.
They require Node.js 18 or newer because they use the built-in fetch API.
Open a file below to view and copy its complete source directly from the documentation. Save the files into the same local scripts directory before running the examples.
Files
| File | Purpose |
|---|---|
| products.json | 30 sample products for catalog sync testing. |
| thyris-client.mjs | Shared API client helper. |
| List Stores | Lists stores available to the API key. |
| Upsert Products | Upserts all products from products.json. |
| Search Products | Searches products by query. |
| Create Cart | Creates a cart from a 10 digit catalogId. |
| Complete Order | Completes an order from a checkoutId. |
| Send Webhook Upsert | Sends one product through inbound catalog webhook. |
| List MCP Tools | Calls MCP tools/list. |
Environment Variables
Required:
export THYRIS_API_KEY="tr_live_your_key_here"
export THYRIS_STORE_ID="store_uuid"
Optional:
export THYRIS_BASE_URL="https://merchant.thyris.cloud"
export THYRIS_CATALOG_ID="1234567890"
export THYRIS_CHECKOUT_ID="chk_1234567890abcdef12345678"
export THYRIS_CART_QUANTITY="1"
Recommended Run Order
From the customer docs directory:
node scripts/01-list-stores.mjs
node scripts/02-upsert-products.mjs
node scripts/03-search-products.mjs DEMO-HOODIE
Copy a returned catalogId, then create a cart:
node scripts/04-create-cart.mjs 1234567890
Copy the returned checkoutId, then complete an order:
node scripts/05-complete-order.mjs chk_1234567890abcdef12345678
Test inbound webhook upsert:
node scripts/06-send-webhook-upsert.mjs
Test MCP tool listing:
node scripts/07-mcp-list-tools.mjs
Notes
- Product upsert is idempotent because each sample product has stable
skuandexternalId. - Cart creation requires a 10 digit
catalogId, not the product UUID. - Order completion changes inventory and should be treated as a business write.
- Do not commit real API keys into scripts, JSON files, or shell history.