创建 Stripe 连接
POST
/web/v1/workspaces/{workspaceId}/stripe/connectionsJWT为当前工作区创建新的 Stripe 连接。该连接存储支付处理所需的 Stripe 账户凭证和 Webhook 配置。
鉴权
Auth Chain: WEB Chain — 需要
Authorization: Bearer <jwt>需要workspace:manage权限。 以下请求头由系统自动注入(前端无需处理):X-PORTAL-ACCESS-CODE(Nginx),X-Request-Id(Gateway)
请求参数
| Name | Type | Required | In | Description |
|---|---|---|---|---|
workspaceId | string | Yes | path | 工作区业务 ID |
connectionName | string | Yes | body | 连接显示名称 |
connectionDescription | string | No | body | 连接的可选描述 |
stripeAccountId | string | Yes | body | Stripe 账户 ID(例如 `acct_xxx`) |
apiKey | string | Yes | body | Stripe API 密钥 |
webhookSecret | string | Yes | body | Stripe Webhook 签名密钥(例如 `whsec_xxx`) |
partnerEndpoint | string | Yes | body | 合作方回调端点 URL |
configJson | string | No | body | 附加配置(JSON 字符串) |
成功响应
已创建201
{
"version": "1.3.0",
"timestamp": 1709337600000,
"success": true,
"code": "2000",
"message": "SUCCESS",
"data": {
"bizId": "sc_abc123",
"tenantBizId": "tn_xyz789",
"connectionName": "Production Stripe",
"connectionDescription": "Main production connection",
"stripeAccountId": "acct_1234567890",
"partnerEndpoint": "https://partner.example.com/webhook",
"configJson": null,
"status": 1,
"statusName": "ACTIVE",
"createdAt": "2026-03-21T00:00:00Z",
"updatedAt": "2026-03-21T00:00:00Z"
}
}错误响应
Unauthorized401
{
"success": false,
"code": "4010",
"message": "Invalid or expired token"
}Forbidden403
{
"success": false,
"code": "4030",
"message": "Insufficient permissions"
}说明
apiKey和webhookSecret字段加密存储,不会在响应中返回。- 需要目标工作区的
workspace:manage权限。 - 连接默认以活跃状态创建。