Skip to main content
Capabilities

Session capabilities

When to use: your app has only a frontend that holds the end user's session token, but needs signed capabilities such as payments, email or LLM chat, and appSecret cannot live in the browser.

How it works: the frontend calls /client/cap/v1/* with the user session. The platform validates the session, signs the request server-side and forwards it to the corresponding Open Platform endpoint. appSecret never leaves the platform.

Prerequisites​

  1. A valid session: headers X-Auth-Token and X-App-Code (headers only, not query parameters).
  2. The Open Platform is enabled for the app, see Credentials.
  3. Each capability is switched on in the console: create order, query order, send email, LLM chat. You can also set a per-user daily limit. All capabilities are off by default.

Endpoints​

EndpointMethodFieldsBehavior
/client/cap/v1/pay/createPOSTproductId (required), sukProduct-priced orders only: the amount comes from the console, so the frontend cannot set it. The order number is generated by the platform. Response as in Create an order; callbacks go to the app's notifyUrl as usual
/client/cap/v1/pay/queryGET / POSTmerchantOrderNoOnly the current user's own orders. Response as in Query an order
/client/cap/v1/mail/selfPOSTtemplateCode (required, an app template or built-in), variables, code, name, link, contentAlways sent to the current user's bound email. Returns 你的账号还没有绑定邮箱 if none is bound. CNY 0.01 per email
/client/cap/v1/llm/chatPOSTmessages (OpenAI message format), modelLLM chat, billed by token usage

Common rejections (code=300): 请先登录 (sign in first), 缺少应用标识 (missing app ID), 登录已过期,请重新登录 (session expired), 应用不存在 (app not found), 该应用尚未开通开放平台 (Open Platform not enabled), plus messages for a capability that is off or a daily limit that is reached.

Example​

curl -s -X POST https://cloud.ifootoo.com/client/cap/v1/pay/create \
-H 'X-Auth-Token: <token>' -H 'X-App-Code: <appCode>' \
-H 'Content-Type: application/json' -d '{"productId": 12}'