为已认证的商户创建新门店。门店标识(slug)从名称自动生成,JSONB 配置字段(webhookSettings、notificationSettings、checkoutSettings)使用默认值初始化。
POST /v1/actions/store/create-store
认证方式: API Key
请求体
| 字段 | 类型 | 必需 | 说明 |
|---|
name | string | 是 | 门店名称(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"
}
}
}
响应字段
| 字段 | 类型 | 说明 |
|---|
id | string | 门店 ID(Short ID 格式 STO_xxx) |
name | string | 门店显示名称 |
status | string | 门店状态(active、inactive 或 suspended) |
logo | string | null | 门店 Logo URL |
supportEmail | string | null | 客服邮箱地址 |
website | string | null | 门店网站 URL |
slug | string | null | 自动生成的 URL 标识 |
prodEnabled | boolean | 是否已启用生产模式 |
webhookSettings | object | null | Webhook 配置(见更新门店 - Webhook 设置) |
notificationSettings | object | null | 通知偏好(见更新门店 - 通知设置) |
checkoutSettings | object | null | 结账页面主题(见更新门店 - 结账设置) |
deletedAt | string | null | 软删除时间戳(ISO 8601),活跃时为 null |
createdAt | string | 创建时间戳(ISO 8601) |
updatedAt | string | 最后更新时间戳(ISO 8601) |
错误响应
| 状态码 | 错误 | 说明 |
|---|
| 400 | Missing required field: name | 请求体中未提供 name |
| 400 | Store name cannot be empty | name 为空字符串或仅含空格 |
| 400 | Store name exceeds maximum length of 48 characters | name 去除空格后超过 48 个字符 |
| 400 | Maximum store limit reached (20) | 商户已拥有 20 个门店 |
每个商户最多可创建 20 个门店。门店创建者自动获得 owner 角色。