Skip to main content
POST
By default, the portal link in data.url opens the portal home page. To send the customer straight to a specific page, append a redirectUrl query parameter to data.url before redirecting. Its value is the URL-encoded path of the target page. Examples of common paths (not a complete list):
Always URL-encode the redirectUrl value and make sure the resulting link is correct. An incorrect link leads to a 404 page.The example above is JavaScript, where searchParams encodes the value automatically. If you use another language (or don’t use searchParams), you need to encode the value yourself, for example with URLEncoder.encode(path, StandardCharsets.UTF_8) in Java or urllib.parse.quote(path, safe='') in Python. The encoded value should look like %2Fsubscription%2Fsub_xxxxx%2Fupdate. Encode it only once.

Authorizations

X-API-KEY
string
header
required

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

Headers

X-Timestamp
string
required

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

Example:

"1783513683000"

Body

application/json

Parameters required to initialize a customer portal session

customerId
string
required

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.

Example:

Response

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)

Example:

200

msg
string

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

Example:

"success"

data
object

Customer Portal session details when successfully created