跳转到主要内容
为已认证的商户创建新门店。门店标识(slug)从名称自动生成,JSONB 配置字段(webhookSettingsnotificationSettingscheckoutSettings)使用默认值初始化。
POST /v1/actions/store/create-store
认证方式: API Key

请求体

字段类型必需说明
namestring门店名称(1-48 个字符,自动去除首尾空格)

请求示例

import { WaffoPancake } from "@waffo/pancake-ts";

const client = new WaffoPancake({
  merchantId: process.env.WAFFO_MERCHANT_ID!,
  privateKey: process.env.WAFFO_PRIVATE_KEY!,
});

const { store } = await client.stores.create({ name: "My Digital Store" });
console.log(store.id);   // => "STO_2aUyqjCzEIiEcYMKj7TZtw"
console.log(store.slug); // => "my-digital-store-a1b2c3"

成功响应 (200)

{
  "data": {
    "store": {
      "id": "STO_2aUyqjCzEIiEcYMKj7TZtw",
      "name": "My Digital Store",
      "status": "active",
      "logo": null,
      "supportEmail": null,
      "website": null,
      "slug": "my-digital-store-a1b2c3",
      "prodEnabled": false,
      "webhookSettings": {
        "testWebhookUrl": null,
        "prodWebhookUrl": null,
        "testEvents": [],
        "prodEvents": []
      },
      "notificationSettings": {
        "emailOrderConfirmation": true,
        "emailSubscriptionConfirmation": true,
        "emailSubscriptionCycled": true,
        "emailSubscriptionCanceled": true,
        "emailSubscriptionRevoked": true,
        "emailSubscriptionPastDue": true,
        "notifyNewOrders": true,
        "notifyNewSubscriptions": true
      },
      "checkoutSettings": {
        "defaultDarkMode": false,
        "light": {
          "checkoutLogo": null,
          "checkoutColorPrimary": "#000000",
          "checkoutColorBackground": "#FFFFFF",
          "checkoutColorCard": "#F5F5F5",
          "checkoutColorText": "#1A1A1A",
          "checkoutBorderRadius": "8px"
        },
        "dark": {
          "checkoutLogo": null,
          "checkoutColorPrimary": "#FFFFFF",
          "checkoutColorBackground": "#1A1A1A",
          "checkoutColorCard": "#2A2A2A",
          "checkoutColorText": "#F5F5F5",
          "checkoutBorderRadius": "8px"
        }
      },
      "deletedAt": null,
      "createdAt": "2026-01-15T10:30:00.000Z",
      "updatedAt": "2026-01-15T10:30:00.000Z"
    }
  }
}

响应字段

字段类型说明
idstring门店 ID(Short ID 格式 STO_xxx
namestring门店显示名称
statusstring门店状态(activeinactivesuspended
logostring | null门店 Logo URL
supportEmailstring | null客服邮箱地址
websitestring | null门店网站 URL
slugstring | null自动生成的 URL 标识
prodEnabledboolean是否已启用生产模式
webhookSettingsobject | nullWebhook 配置(见更新门店 - Webhook 设置
notificationSettingsobject | null通知偏好(见更新门店 - 通知设置
checkoutSettingsobject | null结账页面主题(见更新门店 - 结账设置
deletedAtstring | null软删除时间戳(ISO 8601),活跃时为 null
createdAtstring创建时间戳(ISO 8601)
updatedAtstring最后更新时间戳(ISO 8601)

错误响应

状态码错误说明
400Missing required field: name请求体中未提供 name
400Store name cannot be emptyname 为空字符串或仅含空格
400Store name exceeds maximum length of 48 charactersname 去除空格后超过 48 个字符
400Maximum store limit reached (20)商户已拥有 20 个门店
每个商户最多可创建 20 个门店。门店创建者自动获得 owner 角色。