跳转到主要内容
POST

授权

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 create a subscription by API. Provide at least one of customerId, customerEmail, or referenceCustomerId.

priceId
string
必填

Recurring price ID.

productId
string
必填

Product ID for the subscription.

paymentMethodType
enum<string>
必填

Payment method type (uppercase). CARD requires a previously saved card and its paymentInstrumentId. APPLEPAY and GOOGLEPAY require additionalPaymentInstrument.tokenValue; the first invoice is paid with the wallet token and later renewals are charged as CARD with the bound instrument. The payment method must be enabled for subscriptions for your merchant account.

可用选项:
APPLEPAY,
CARD,
CASHAPP,
GCASH,
GOOGLEPAY,
PIX,
UPI
paymentCurrency
string
必填

Payment currency. The value is normalized to uppercase.

customerId
string

Existing customer ID. At least one customer identifier is required.

customerEmail
string

Customer email. Used to resolve or create a customer when customerId is not provided.

referenceCustomerId
string

Merchant-side customer ID used to resolve, create, or bind a customer.

merchantReferenceId
string

Merchant-side reference ID for reconciliation.

paymentInstrumentId
string

Existing payment instrument ID used for the initial payment and renewals. Required for CARD and other methods that do not support automatic creation. For APPLEPAY and GOOGLEPAY it is optional: when omitted, Clink creates the wallet payment instrument from additionalPaymentInstrument.tokenValue and binds it to the subscription for renewals.

promotionCode
string

Promotion code to apply.

returnUrl
string
必填 unless paymentMethodType = APPLEPAY or GOOGLEPAY

URL where the customer is redirected after required payment actions. Required for all payment methods except APPLEPAY and GOOGLEPAY, which are settled synchronously and do not redirect.

additionalPaymentInstrument
object
必填 if paymentMethodType = APPLEPAY or GOOGLEPAY

Complete wallet token for APPLEPAY / GOOGLEPAY, as returned by the wallet SDK. The token is single-use: generate a new one for every payment attempt.

metadata
object

Merchant metadata. Values must be strings.

billingAddress
object

Optional billing address used for the payment instrument and first-invoice tax calculation. This address takes precedence over the existing payment instrument address, customer billing address, and request IP country for the first invoice. When Clink automatically creates a payment instrument, the address is saved to the new payment instrument. When paymentInstrumentId references an existing payment instrument, this address does not update that payment instrument.

platformType
enum<string>

Platform type. Supported values are WEB and WAP.

可用选项:
WEB,
WAP
deviceType
enum<string>

Device type. Supported values are Android and iOS.

可用选项:
Android,
iOS
scheduledPhases
object[]

Optional scheduled subscription plan changes. Each phase takes effect at a future billing period boundary.

Maximum array length: 10

响应

Subscription created successfully

code
integer<int32>

Response status code, 200 when success

示例:

200

msg
string

Brief description of what happened, 'success' when happy case

示例:

"success"

data
object

Response data returned after creating a subscription. It contains the subscription, order, and invoice identifiers, together with the payment flow result.