Skip to main content

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​

FilePurpose
products.json30 sample products for catalog sync testing.
thyris-client.mjsShared API client helper.
List StoresLists stores available to the API key.
Upsert ProductsUpserts all products from products.json.
Search ProductsSearches products by query.
Create CartCreates a cart from a 10 digit catalogId.
Complete OrderCompletes an order from a checkoutId.
Send Webhook UpsertSends one product through inbound catalog webhook.
List MCP ToolsCalls 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"

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 sku and externalId.
  • 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.