Skip to main content
POST
/
subscriptions
/
batch
批次匯入訂閱
curl --request POST \
  --url https://api.zangsho.com/v1/subscriptions/batch \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "subscriptions": [
    {
      "customer_id": 123,
      "mrr": "990.00",
      "billing_cycle": "monthly",
      "started_at": "2023-11-07T05:31:56Z",
      "current_period_start": "2023-11-07T05:31:56Z",
      "plan_name": "Pro Plan"
    }
  ],
  "on_conflict": "skip"
}
'
{
  "data": {
    "total": 123,
    "created": 123,
    "updated": 123,
    "skipped": 123,
    "failed": 123,
    "results": {
      "created": [
        {
          "index": 123,
          "id": 123,
          "identifier": "<string>"
        }
      ],
      "updated": [
        {
          "index": 123,
          "id": 123,
          "identifier": "<string>"
        }
      ],
      "skipped": [
        {
          "index": 123,
          "reason": "duplicate_email",
          "identifier": "<string>"
        }
      ],
      "failed": [
        {
          "index": 123,
          "reason": "validation_error",
          "message": "<string>",
          "identifier": "<string>"
        }
      ]
    }
  }
}

Authorizations

Authorization
string
header
required

使用 Laravel Sanctum Token 進行認證。

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

Body

application/json
subscriptions
object[]
required
Required array length: 1 - 100 elements
on_conflict
enum<string>
default:skip
Available options:
skip,
update

Response

批次匯入結果

data
object