保存会员计划
创建或更新会员计划记录。API 根据 membership_plan_id 确定是创建还是更新。
参数
-
membership_plans
array必填要保存的会员计划对象数组。为获得最佳性能,建议每个请求最多 1000 个项目。API 会自动对项目进行分批处理。每个项目必须包含
facility_id(未使用linking_identifier时必填)或linking_identifier(未使用facility_id时必填)。
返回值
返回一条确认同步操作的简单消息。
请求
此示例使用 facility_id。对于关联标识符集成,请改为发送 "linking_identifier": "branch_downtown"。
curl -X POST https://partner-api.performancehub.co/partner/v1/membership-plans \
-u sk_live_YOUR_PARTNER_SECRET_KEY: \
-H "Content-Type: application/json" \
-d '{
"membership_plans": [
{
"membership_plan_id": "plan_99999",
"facility_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Student – term access",
"description": "Library and student hub access for one teaching term",
"billing_cycle": "one_time",
"price": 4500,
"currency": "AUD",
"duration_days": 84,
"is_recurring": false,
"is_trial": false,
"visible_to_public": true,
"active_members": 245,
"access_zones": [
{
"name": "Library",
"description": "Reading rooms, study spaces and bookable rooms",
"access_hours": {
"mon": [["08:00", "21:00"]],
"tue": [["08:00", "21:00"]],
"wed": [["08:00", "21:00"]],
"thu": [["08:00", "21:00"]],
"fri": [["08:00", "17:00"]],
"sat": [["09:00", "13:00"]]
}
},
{
"name": "Student Hub",
"description": "Common room, kitchen and lockers",
"access_hours": {
"mon": [["07:00", "22:00"]],
"tue": [["07:00", "22:00"]],
"wed": [["07:00", "22:00"]],
"thu": [["07:00", "22:00"]],
"fri": [["07:00", "22:00"]]
}
}
],
"class_limit": null
}
]
}'
响应
返回一条成功消息,其中包含有关同步操作的元数据。
{
"message": "Membership plan sync successful.",
"metadata": {
"success": 98,
"skipped": 2,
"skipped_items": [
{
"membership_plan_id": "plan_456",
"facility_id": null,
"reason": "Missing facility_id"
}
]
}
}
元数据字段:
- success:成功处理的会员计划数量
- skipped:跳过的计划数量(如有)
- skipped_items:跳过的计划及原因的数组(如有)
- dry-run:使用 dryrun 密钥类型时的布尔标志(如适用)