Skip to main content
POST
/
subscriptions
建立訂閱
curl --request POST \
  --url https://api.zangsho.com/v1/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customer_id": 123,
  "plan_name": "Pro Plan",
  "mrr": "990.00",
  "billing_cycle": "monthly",
  "started_at": "2026-01-01T00:00:00Z",
  "current_period_start": "2026-01-01T00:00:00Z"
}
'
{
  "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 設定」頁面取得。

Body

application/json
customer_id
integer
required

客戶 ID

mrr
string
required

月經常性收入

Example:

"990.00"

billing_cycle
enum<string>
required

訂閱週期

Available options:
monthly,
quarterly,
semi-annual,
yearly
started_at
string<date-time>
required

訂閱開始時間

current_period_start
string<date-time>
required

目前週期開始時間

plan_name
string

方案名稱

Example:

"Pro Plan"

Response

訂閱建立成功

data
object