packet.created ✓ Canlı

Restomenum'da yeni bir paket sipariş oluşunca eklentinin webhookUrl'ine imzalı POST edilir. Bu, paket/kurye eklentilerinin temel event'idir. Aşağıdaki şema canlı (authoritative) payload'ı tanımlar.

← Event Kataloğu

HTTP & imza

POST {webhookUrl}
Content-Type: application/json
X-Restomenum-Signature: t=<unixSec>,v1=<HMAC_SHA256(webhookSecret, "<t>.<rawBody>")>
  • İmzayı ham gövde üzerinden doğrula ("<t>.<rawBody>"), ±5 dk replay toleransı. webhookSecret kurulumda (OAuth exchange) verilir — bkz. imza şeması ve token exchange.
  • 2xx dön → işlendi sayılır. 2xx dışı / timeout → Restomenum retry eder.
  • Aynı id tekrar gelebilir (retry) → idempotency için id'yi dedup et.

Envelope (tüm event'lerde ortak)

AlanTipZorunluAçıklama
idstringIdempotency anahtarı. Aynı id tekrar gelebilir → dedup et.
typestringpacket.created
versionstringEnvelope şema versiyonu ("1").
tenantIdstringRestoran (tenant) id.
occurredAtnumberOluşma zamanı (unix ms).
dataobjectEvent'e özel gövde (aşağıda).

data alanları

AlanTipZorunluAçıklama
packetIdstringPaket id (statü callback'lerinde kullanılır).
docNonumberGünlük sipariş no.
orderCodestringSipariş kodu (örn. "A12").
totalnumberPaket toplamı.
paidnumberÖdenen tutar.
totalDiscountnumberİndirim toplamı (türetilmiş).
paymentNotestringÖdeme notu (örn. "Kapıda nakit").
isScheduledbooleanİleri tarihli sipariş mi?
scheduledDatenumber | nullİleri tarihliyse zaman, değilse null.
notestringMüşteri/sipariş notu.
entegrasyonstringSipariş kanalı — string kod: packet (manuel/telefon), yemeksepeti, getir, trendyol
orders[]arraySipariş satırları (id, title, quantity, options[], extra, discount, note, lineTotal, product). title = ürün adı, kökten direkt oku; options = string array (seçenek adları); product tam ürün objesi de gelir. lineTotal'ı Restomenum hesaplar.
customerobject⚠️ PII alanları yalnız customers:read + consent ile DOLU gelir (aşağı bkz).
callbackUrlsobject⚠️ Yalnız packets:status ile EKLENİR (aşağı bkz).

Tam örnek payload

customers:read + packets:status DAHİL (en dolu hali)
{
  "id": "evt_9f2a7c1b",
  "type": "packet.created",
  "version": "1",
  "tenantId": "tnt_123",
  "occurredAt": 1730000000000,
  "data": {
    "packetId": "1780633662954",
    "docNo": 42,
    "orderCode": "A12",
    "total": 145,
    "paid": 0,
    "totalDiscount": 0,
    "paymentNote": "Kapıda nakit",
    "isScheduled": false,
    "scheduledDate": null,
    "note": "Zili çalma",
    "entegrasyon": "packet",
    "orders": [
      {
        "id": "ord_1",
        "title": "Lahmacun",
        "quantity": 2,
        "options": [
          "Acılı",
          "Bol soğan"
        ],
        "extra": 0,
        "discount": 0,
        "note": "",
        "lineTotal": 60,
        "product": {
          "title": "Lahmacun"
        }
      }
    ],
    "customer": {
      "id": "cust_9",
      "name": "Ahmet Yılmaz",
      "phone": "05xxxxxxxxx",
      "address": "Atatürk Cad. No:5",
      "addressDescription": "2. kat",
      "region": "Kadıköy",
      "call": "05xxxxxxxxx"
    },
    "callbackUrls": {
      "pickup": "https://plugins.restomenum.app/plugin-api/packets/{tenantId}/{pluginId}/{packetId}/pickup?token=…",
      "delivered": "https://plugins.restomenum.app/plugin-api/packets/{tenantId}/{pluginId}/{packetId}/delivered?token=…",
      "cancel": "https://plugins.restomenum.app/plugin-api/packets/{tenantId}/{pluginId}/{packetId}/cancel?token=…"
    }
  }
}

Scope'a göre değişen alanlar

ScopeEtki
events:subscribe + packet.createdWebhook'u almak için zorunlu (manifest events[] + scope).
customers:read yoksacustomer objesindeki PII alanları silinir (name, phone, address, email, tckn, vergino). id / region / call / addressDescription kalır.
packets:status yoksacallbackUrls hiç eklenmez.
PII alanlarını yalnız belirttiğin amaçla işle. Yeni bir sürümde customers:read eklemek kurulumda re-consent tetikler. Bkz. customers:read.

Statü callback (packets:status)

Paket durumunu Restomenum'a bildirmek için callbackUrls'ten ilgili URL'e POST at (token query string'te). Bu URL'leri sen üretmezsin — platform üretip payload'a ekler, sen uygun anda çağırırsın (örn. aksiyon butonu / actionUrl çalışınca).

# Statü bildirimi — token query string'te, gövde boş/serbest
POST https://plugins.restomenum.app/plugin-api/packets/{tenantId}/{pluginId}/{packetId}/pickup?token=…
POST …/{packetId}/delivered?token=…
POST …/{packetId}/cancel?token=…
# pickup → yolda · delivered → teslim edildi · cancel → iptal (terminal — sonrası değişmez)
pickup     → yolda
delivered  → teslim edildi
cancel     → iptal
(terminal durum sonrası değişmez)