curl --request POST \
--url https://uat-api.clinkbill.com/api/subscription/{id}/pause \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-Timestamp: <x-timestamp>' \
--data '
{
"reason": "Customer requested a break"
}
'
{
"code": 200,
"msg": "success",
"data": {
"subscriptionId": "sub_xxxxx",
"customerId": "cus_xxxxx",
"productId": "prd_xxxxx",
"priceId": "price_xxxxx",
"priceSnapshotId": "pricesns_xxxxx",
"createTime": 1793491200000,
"quantity": 1,
"paymentMethodType": "card",
"paymentInstrumentId": "pi_xxxxx",
"status": "paused",
"billing": "charge_automatically",
"currency": "USD",
"currentPeriodStart": 1793491200000,
"currentPeriodEnd": 1796083200000,
"recurringInvoiceItem": {
"invoiceItemId": "ii_xxxxx",
"amount": "20.00",
"currency": "USD",
"periodStart": 1793491200000,
"periodEnd": 1796083200000,
"discountAmount": "2.00",
"paymentAmount": "18.00",
"description": "Monthly membership",
"price": {
"productId": "prd_xxxxx",
"productName": "Monthly Membership",
"productUrl": "https://merchant.example.com/membership",
"priceId": "price_xxxxx",
"priceSnapshotId": "pricesns_xxxxx",
"unitAmount": "20.00",
"quantity": 1,
"recurring": {
"interval": "month",
"intervalCount": 1,
"pricingModel": "flat_rate"
}
}
},
"pause": {
"pausedAt": 1795737600000,
"remainingSeconds": 345600,
"reason": "Customer requested a break"
}
}
}
Subscription
暂停订阅
Pause an eligible active subscription now or replace its pending pause schedule. A future pauseAt keeps the subscription active until the pause takes effect. UPI, PIX and subscriptions set to cancel at period end are ineligible.
POST
/
subscription
/
{id}
/
pause
curl --request POST \
--url https://uat-api.clinkbill.com/api/subscription/{id}/pause \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-Timestamp: <x-timestamp>' \
--data '
{
"reason": "Customer requested a break"
}
'
{
"code": 200,
"msg": "success",
"data": {
"subscriptionId": "sub_xxxxx",
"customerId": "cus_xxxxx",
"productId": "prd_xxxxx",
"priceId": "price_xxxxx",
"priceSnapshotId": "pricesns_xxxxx",
"createTime": 1793491200000,
"quantity": 1,
"paymentMethodType": "card",
"paymentInstrumentId": "pi_xxxxx",
"status": "paused",
"billing": "charge_automatically",
"currency": "USD",
"currentPeriodStart": 1793491200000,
"currentPeriodEnd": 1796083200000,
"recurringInvoiceItem": {
"invoiceItemId": "ii_xxxxx",
"amount": "20.00",
"currency": "USD",
"periodStart": 1793491200000,
"periodEnd": 1796083200000,
"discountAmount": "2.00",
"paymentAmount": "18.00",
"description": "Monthly membership",
"price": {
"productId": "prd_xxxxx",
"productName": "Monthly Membership",
"productUrl": "https://merchant.example.com/membership",
"priceId": "price_xxxxx",
"priceSnapshotId": "pricesns_xxxxx",
"unitAmount": "20.00",
"quantity": 1,
"recurring": {
"interval": "month",
"intervalCount": 1,
"pricingModel": "flat_rate"
}
}
},
"pause": {
"pausedAt": 1795737600000,
"remainingSeconds": 345600,
"reason": "Customer requested a break"
}
}
}
所有商户都可以暂停由 Clink 管理且符合条件的
省略
active 订阅。不传请求体或传 {} 会立即暂停。要预约暂停,请传未来的 Unix 毫秒时间戳 pauseAt。如果传入的时间等于或早于当前时间,暂停会立即生效。再次提交会替换待执行的暂停计划,包括原计划的原因和自动恢复时间。
以下示例生成“明天暂停、一周后恢复”的请求体。
const day = 24 * 60 * 60 * 1000;
const pauseAt = Date.now() + day;
const body = { pauseAt, resumeAt: pauseAt + 7 * day, reason: "客户申请暂停" };
resumeAt 表示手动恢复。预约成功时,响应中的 status 仍为 active,并返回 pause.pauseAt。暂停生效后,状态变为 paused,响应中会带上实际暂停时间 pause.pausedAt 和剩余服务秒数 pause.remainingSeconds。
| 业务错误码 | 说明及处理方式 |
|---|---|
90100252 | 暂停操作当前不可用。如果持续出现,请联系支持。 |
90100253 | 确认订阅处于 active 且由 Clink 管理。镜像订阅不支持暂停。 |
90100254 | 续费正在处理,等续费完成后再暂停。 |
90100255 | 有待完成的立即套餐变更,等变更完成后再暂停。 |
90100256 | 订阅已设置到期取消,无法暂停。 |
90100257 | UPI 和 PIX 订阅不支持暂停。 |
90100258 | 按错误消息中的 UTC 范围调整时间。自动恢复时间须晚于当前时间和暂停时间。 |
请求头
请求体
application/json
响应
Updated subscription on success. Check the business code in the response.