where('public_id', $storePublicId) ->where('status', WooStore::STATUS_ACTIVE) ->first(); if (! $store) { return response()->json(['message' => 'Store not found.'], 404); } if (! $this->verifier->verify($request, $store)) { return response()->json(['message' => 'Invalid signature.'], 401); } $topic = (string) $request->header('X-WC-Webhook-Topic', ''); if (! in_array($topic, (array) config('woo.webhook_topics', []), true)) { return response()->json(['ignored' => true]); } /** @var array $payload */ $payload = $request->json()->all(); if ($payload === []) { return response()->json(['ignored' => true]); } $order = $this->ingest->ingest($store, $payload); return response()->json([ 'ok' => true, 'order_id' => $order->id, ]); } }