Skip to main content
PUT
/
subscriptions
/
{id}
/
cancel
取消訂閱
curl --request PUT \
  --url https://api.zangsho.com/v1/subscriptions/{id}/cancel \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "cancelled_at": "2026-01-09T00:00:00Z",
  "reason": "no_longer_needed"
}
'
{
  "data": {
    "id": 123,
    "customer_id": 123,
    "status": "active",
    "plan_name": "<string>",
    "mrr": "<string>",
    "billing_cycle": "<string>",
    "source": "api",
    "started_at": "2023-11-07T05:31:56Z",
    "current_period_start": "2023-11-07T05:31:56Z",
    "cancelled_at": "2023-11-07T05:31:56Z",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

使用 Laravel Sanctum Token 進行認證。

Token 可在商家後台的「API 設定」頁面取得。

Path Parameters

id
integer
required

Body

application/json
cancelled_at
string<date-time>

取消時間(未提供則使用當前時間)

reason
string

取消原因

Example:

"no_longer_needed"

Response

訂閱取消成功

data
object