跳转到主要内容
POST
/
subscription
Create Subscription
curl --request POST \
  --url https://uat-api.clinkbill.com/api/subscription \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --header 'X-Timestamp: <api-key>' \
  --data '
{
  "customerId": "cus_xxxxx",
  "productId": "prd_xxxxx",
  "priceId": "price_xxxxx",
  "paymentInstrumentId": "pi_xxxxx",
  "paymentMethodType": "CARD",
  "paymentCurrency": "USD",
  "returnUrl": "https://merchant.example.com/subscription/return",
  "merchantReferenceId": "sub_ref_123",
  "metadata": {
    "orderNo": "SO-10001"
  },
  "platformType": "WEB",
  "deviceType": "Android"
}
'
{
  "code": 200,
  "msg": "success",
  "data": {
    "subscriptionId": "<string>",
    "sessionId": "<string>",
    "action": {
      "redirectUrl": "<string>",
      "walletHandleRedirectOrDisplayQrCode": {
        "imageUrlPng": "<string>",
        "imageUrlSvg": "<string>",
        "imageDataUrl": "<string>",
        "hostedInstructionsUrl": "<string>",
        "mobileAuthUrl": "<string>",
        "fallbackUrl": "<string>",
        "packageName": "<string>",
        "expiresAt": 123,
        "expiresSecond": 123
      },
      "paymentMethodType": "<string>",
      "postData": {}
    },
    "amount": 123,
    "currency": "<string>",
    "orderId": "<string>",
    "invoiceId": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.clinkbill.com/llms.txt

Use this file to discover all available pages before exploring further.

授权

X-API-KEY
string
header
必填

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

X-Timestamp
string
header
必填

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

请求体

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.

paymentInstrumentId
string
必填

Existing payment instrument ID used for the initial payment and renewals.

paymentMethodType
enum<string>
必填

Payment method type. Supported values are uppercase.

可用选项:
CARD,
GCASH
paymentCurrency
string
必填

Payment currency. The value is normalized to uppercase.

returnUrl
string
必填

URL where the customer is redirected after required payment actions.

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.

promotionCode
string

Promotion code to apply.

metadata
object

Merchant metadata. Values must be strings.

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

响应

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.