packet.closed ✓ Canlı

Bir paket / delivery siparişi kapatıldığında (ödendi/teslim/finalize) eklentinin webhookUrl'ine async imzalı POST edilir. Manuel telefon paketleri VE entegrasyon teslimatları (Getir, Yemeksepeti, Trendyol, Migros, Fuudy, WebStore) kapandığında tetiklenir.

← Event Kataloğu

packet.closedpacket.created. packet.created paket oluşturulduğunda; packet.closed paket kapandığında gelir — farklı yaşam-döngüsü anları. Dine-in masa kapanışı ise ayrı event: table.closed.

Abonelik

HTTP, imza & teslimat

POST {webhookUrl}
Content-Type: application/json
X-Restomenum-Signature: t=<unixSec>,v1=<HMAC_SHA256(webhookSecret, "<t>.<rawBody>")>
X-Restomenum-Event: packet.closed
X-Restomenum-Delivery: <deliveryId>
  • İmzayı ham gövde üzerinden doğrula ("<t>.<rawBody>"), ±5 dk replay — bkz. imza şeması.
  • Header'lar: X-Restomenum-Event: packet.closed, X-Restomenum-Delivery: <id>.
  • Idempotency: envelope id tekildir (at-least-once → aynı id'yi dedup et, 200 dön).
  • Ack: 2xx → işlendi. 5xx/timeout → retry (backoff) → dead-letter. 4xx → kalıcı (retry yok).

Envelope alanları

AlanTipZorunluAçıklama
idstringOlay id'si — idempotency anahtarı (packetclosed_<serverId><packetId>).
typestringpacket.closed
versionnumberEnvelope şema sürümü (1).
tenantIdstringTenant kimliği.
occurredAtnumberKapanış zamanı (epoch ms).
dataobjectPaket kanonik verisi — orders:read yoksa {}.

data alanları

AlanTipZorunluAçıklama
packetIdstringPaket id'si (packets/get?packetId=).
docNonumberAdisyon/belge no.
channelstringKanonik kanal — PACKET (manuel) / GETIR / YEMEKSEPETI / TRENDYOL / MIGROS / FUUDY / WEBSTORE.
entegrasyonstringEntegrasyon anahtarı (küçük harf: packet/getir/deliveryhero/…).
statusstring | nullSipariş durumu — Delivered / Rejected / … İptal/red'i kendin filtrele (platform tüm kapanışları gönderir).
orderCodestringPlatform sipariş kodu (entegrasyon siparişlerinde; varsa).
isScheduledbooleanİleri tarihli sipariş mi (varsa).
scheduledDatenumberPlanlanan teslim zamanı (varsa).
note / paymentNotestringSipariş / ödeme notu.
total / paid / totalDiscountnumberTutarlar.
orders[]arrayAdisyon satırları: id, title, quantity, options[], extra, discount, note, lineTotal. title = ürün adı (ham product objesi gönderilmez); options = string array.
customerobjectMüşteri + adres — PII; customers:read + consent yoksa gönderilmez.

Tam örnek payload

packet.closed envelope (manuel telefon paketi)
{
  "id": "packetclosed_<serverId><packetId>",
  "type": "packet.closed",
  "version": "1",
  "tenantId": "<tenantId>",
  "occurredAt": 1780885101009,
  "data": {
    "packetId": "YJyvBuxjDA31kdc7E3KQ",
    "docNo": 3,
    "channel": "PACKET",
    "entegrasyon": "packet",
    "status": "Delivered",
    "note": "Sipariş Notu",
    "paymentNote": "nakit",
    "total": 17,
    "paid": 17,
    "totalDiscount": 0,
    "orders": [
      { "id": "1780875078783-32e1", "title": "Bellavista", "quantity": 1, "options": [], "extra": 0, "discount": 0, "note": "", "lineTotal": 13 },
      { "id": "1780875078783-4e12", "title": "dondurma", "quantity": 1, "options": ["çilek"], "extra": 0, "discount": 0, "note": "", "lineTotal": 4 }
    ],
    "customer": {
      "id": "123456", "name": "Ahmet Bayrak", "region": null,
      "address": "Adres", "addressDescription": null,
      "phone": "123456", "call": "123456", "latitude": null, "longitude": null
    }
  }
}

Entegrasyon teslimatında channel "GETIR"/"YEMEKSEPETI"/"TRENDYOL"/… olur; entegrasyon siparişinde orderCode, planlıda isScheduled+scheduledDate dolu gelir (boşsa alan yer almaz).

Önemli notlar

status ile filtrele: platform tüm kapanışları gönderir (Rejected/iptal dahil). "Tamamlanmış satış" istiyorsan status'a göre kendin filtrele.
Sızıntı önlemi: ham product objesi gönderilmez (yalnız title + lineTotal);customer yalnız customers:read + consent ile; data yalnız orders:read onaylıysa dolu.