Skip to main content
POST
data.url 返回的门户链接默认进入门户首页。如需让客户直接进入指定页面,可在跳转前给 data.url 拼接 redirectUrl 查询参数,参数值为目标页面路径(需做 URL 编码)。常用路径举例如下(非全部页面):
redirectUrl 的值务必做 URL 编码,且需确保拼接的链接正确,否则会导致页面 404。上例为 JavaScript 写法,searchParams 会自动编码。使用其他语言(或不使用 searchParams)时,需要自行对参数值进行编码,例如 Java 的 URLEncoder.encode(path, StandardCharsets.UTF_8)、Python 的 urllib.parse.quote(path, safe='')。编码后应为 %2Fsubscription%2Fsub_xxxxx%2Fupdate,注意只编码一次。

授权

X-API-KEY
string
header
必填

Your secret API key obtained from the Clink dashboard (Developers section)

请求头

X-Timestamp
string
必填

Current timestamp in milliseconds since Unix epoch (required for request signing)

示例:

"1783513683000"

请求体

application/json

Parameters required to initialize a customer portal session

customerId
string
必填

Existing customer's unique identifier

returnUrl
string

Redirect URL when customer click on 'Return to Merchant'

subscriptionUpdateProductIds
string[]

Product IDs allowed for subscription upgrades or downgrades in this customer portal session. When omitted or empty, this session does not restrict eligible products. Blank or invalid product IDs are rejected.

示例:

响应

200 - application/json

Customer portal session created successfully

Response object returned when creating a new checkout session

code
integer<int32>

HTTP status code indicating the request result (200 for success, 4xx for client errors, 5xx for server errors)

示例:

200

msg
string

Human-readable message describing the result ('success' for successful operations, error details for failures)

示例:

"success"

data
object

Customer Portal session details when successfully created