Merchant API for headless backends

Use pk_live_ keys with write scopes from your server only. All requests go to your Merly gateway at /api/v1/merchant.

Write scopes (headless)

ScopeLabelUse
write:webhooksTest webhooksSend signed test lifecycle events to your configured outbound webhook URL
write:catalogPublish catalogPublish store policy and product directory (headless merchants)
write:customersLink customersLink external customer IDs to Merly wallets (headless merchants)
write:ordersIngest ordersReport paid orders for purchase earn (headless merchants)

All mutating routes require an x-idempotency-key header. Generate a unique value per logical operation so safe retries do not double-apply changes.

Write endpoints

POSTTest outbound webhook

/api/v1/merchant/webhooks/test

Scope: write:webhooks

Sends a signed test lifecycle event to the outbound webhook URL configured in Integrations.

Request body

{
  "event_type": "merly.points.earned"
}

Example response

{
  "ok": true,
  "event_type": "merly.points.earned",
  "correlation_id": "…"
}

POSTPublish catalog policy and products

/api/v1/merchant/catalog/publish

Scope: write:catalog

Headless merchants only. Requires x-idempotency-key.

Request body

{
  "policy_store_only": true,
  "cap": {
    "max_coupon_value_usd": 50
  }
}

Example response

{
  "ok": true,
  "product_count": 0,
  "catalog_store_id": "hl_boutique-example-com",
  "correlation_id": "…"
}

POSTIngest paid order

/api/v1/merchant/orders

Scope: write:orders

Request body

{
  "order_id": "ord_1",
  "external_customer_id": "cust_1",
  "customer_email": "buyer@example.com",
  "currency": "USD",
  "total": "120.00",
  "subtotal": "110.00"
}

Example response

{
  "order_id": "ord_1",
  "earn_granted": 110,
  "correlation_id": "…"
}

Read endpoints (shopper wallet data)

Use from your backend when enriching CRM or support tools — not in the browser SDK.

GETCustomer wallet balance

/api/v1/merchant/customers/{customer_id}/balanceread:balance

GETSubscription tier

/api/v1/merchant/customers/{customer_id}/tierread:tier

GETWallet activity

/api/v1/merchant/customers/{customer_id}/activityread:activity

POSTValidate Merly credit coupon at merchant checkout

/api/v1/merchant/coupons/validateread:coupons