บันทึกแผนสมาชิก

สร้างหรืออัปเดตเรคคอร์ดแผนสมาชิก API จะพิจารณาว่าจะสร้างหรืออัปเดตโดยอิงจาก membership_plan_id

พารามิเตอร์

  • membership_plans array จำเป็น

    อาร์เรย์ของออบเจ็กต์ Membership Plan ที่จะบันทึก จำนวนสูงสุดที่แนะนำ: 1000 รายการต่อคำขอเพื่อประสิทธิภาพสูงสุด API จะแบ่งรายการเป็นกลุ่มเพื่อประมวลผลโดยอัตโนมัติ แต่ละรายการต้องมี facility_id (จำเป็นหากไม่ใช้ linking_identifier) หรือ linking_identifier (จำเป็นหากไม่ใช้ facility_id)

ค่าที่ส่งคืน

ส่งคืนข้อความสั้น ๆ ที่ยืนยันการดำเนินการซิงค์

คำขอ

ตัวอย่างนี้ใช้ facility_id สำหรับการผสานรวมแบบ Linking Identifier ให้ส่ง "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 (ถ้ามี)