INTEGRATIONS / DEVELOPERS

นักพัฒนา API

เชื่อมต่อ PLZTIP กับเว็บไซต์ แอป และ Discord ของคุณ ผ่าน API Key และ Webhook ที่ลงลายเซ็นความปลอดภัย

AUTHENTICATION

API Secret Keys

สร้างคีย์สำหรับเรียก PLZTIP API · Secret จะแสดงเต็มเพียงครั้งเดียวตอนสร้าง

ยังไม่มี API Secret Key

สร้างคีย์เพื่อเริ่มเชื่อมต่อกับ PLZTIP API

GET · ข้อมูลสถิติครีเอเตอร์

https://plztip.me/api/v1/stats/{username}

GET · รายการโดเนท

https://plztip.me/api/v1/donations/{username}

ส่ง Authorization: Bearer YOUR_API_KEY

SIGNED OUTBOUND EVENT

เว็บฮุกแจ้งเตือนโดเนท

ส่ง JSON Event ไปยังเซิร์ฟเวอร์ของคุณ พร้อมลายเซ็น HMAC-SHA256

ปิดอยู่

การลงลายเซ็นความปลอดภัย

ระบบส่ง Header X-PLZTIP-Signature: sha256=... คำนวณ HMAC จาก Raw JSON Body ด้วย Secret ของคุณ ให้ตรวจลายเซ็นก่อนประมวลผลทุกครั้ง

ตัวอย่าง JSON Payload
{
  "id": "evt_01JXYZ",
  "type": "donation.paid",
  "created_at": "2026-11-08T10:30:00.000Z",
  "test": false,
  "data": {
    "reference": "PLZTIP-ABC123",
    "creator": "namnarak",
    "donor_name": "ผู้สนับสนุนตัวอย่าง",
    "amount": 100,
    "message": "ขอบคุณสำหรับผลงาน",
    "payment_method": "stripe_live",
    "confirmed_at": "2026-11-08T10:30:00.000Z"
  }
}
ตัวอย่าง Node.js · Express
import express from 'express';
import crypto from 'node:crypto';

const app = express();
const SECRET = process.env.PLZTIP_WEBHOOK_SECRET;

app.post('/plztip-webhook', express.raw({type:'application/json'}), (req,res) => {
  const received = String(req.header('X-PLZTIP-Signature') || '').replace(/^sha256=/, '');
  const expected = crypto.createHmac('sha256', SECRET).update(req.body).digest('hex');
  const a = Buffer.from(received, 'hex');
  const b = Buffer.from(expected, 'hex');
  if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
    return res.status(401).send('Invalid signature');
  }
  const event = JSON.parse(req.body.toString('utf8'));
  if (event.type === 'donation.paid') {
    console.log('Donation:', event.data.donor_name, event.data.amount);
  }
  res.sendStatus(204);
});

app.listen(3000);
Webhook ปิดอยู่

DISCORD INTEGRATION

เว็บฮุก Discord

ส่ง Embed แจ้งเตือนเข้าห้อง Discord เมื่อได้รับโดเนท

ปิดอยู่
ตัวอย่าง Discord JSON Embed
{
  "username": "PLZTIP",
  "allowed_mentions": {
    "parse": []
  },
  "embeds": [
    {
      "title": "ได้รับการสนับสนุนใหม่",
      "description": "**ผู้สนับสนุนตัวอย่าง** สนับสนุน **฿100**\nขอบคุณสำหรับผลงาน",
      "color": 3718648,
      "fields": [
        {
          "name": "Creator",
          "value": "namnarak",
          "inline": true
        },
        {
          "name": "Reference",
          "value": "PLZTIP-ABC123",
          "inline": true
        }
      ],
      "footer": {
        "text": "PLZTIP · Donation Webhook"
      },
      "timestamp": "2026-11-08T10:30:00.000Z"
    }
  ]
}
D Discord · ตัวอย่าง Embed

ได้รับการสนับสนุนใหม่

**ผู้สนับสนุนตัวอย่าง** ส่งกำลังใจ ฿100

Creator

namnarak

Amount

฿100

PLZTIP · Donation Webhook

Discord Webhook ปิดอยู่

ความปลอดภัยของ API และ Webhook

API Secret จะเก็บเฉพาะ Hash · Webhook Signing Secret เข้ารหัส AES-256-GCM ที่ฐานข้อมูล · URL ต้องใช้ HTTPS · ปฏิเสธ Private/Local IP และ Redirect เพื่อป้องกัน SSRF · Discord จำกัดเฉพาะ Discord Webhook URL

PLZTIP API v1