Skip to content

创建 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)

请求参数

NameTypeRequiredInDescription
workspaceIdstringYespath工作区业务 ID
connectionNamestringYesbody连接显示名称
connectionDescriptionstringNobody连接的可选描述
stripeAccountIdstringYesbodyStripe 账户 ID(例如 `acct_xxx`)
apiKeystringYesbodyStripe API 密钥
webhookSecretstringYesbodyStripe Webhook 签名密钥(例如 `whsec_xxx`)
partnerEndpointstringYesbody合作方回调端点 URL
configJsonstringNobody附加配置(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"
}

说明

  • apiKeywebhookSecret 字段加密存储,不会在响应中返回。
  • 需要目标工作区的 workspace:manage 权限。
  • 连接默认以活跃状态创建。

内部文档