get_billing_email(); if ($email === '') { return; } $payload = [ 'channel_id' => $channel_id, 'order_id' => (string) $order->get_id(), 'billing_email' => $email, 'amount' => (float) $order->get_total(), 'currency' => $order->get_currency(), 'billing_phone' => $order->get_billing_phone() ?: null, 'created_at' => $order->get_date_created() ? $order->get_date_created()->format('c') : null, 'metadata' => [ 'status' => $order->get_status(), ], ]; wp_remote_post($url, [ 'headers' => [ 'Content-Type' => 'application/json', 'X-Webhook-Secret' => $secret, ], 'body' => wp_json_encode($payload), 'timeout' => 15, 'blocking' => false, ]); } catch (\Throwable $e) { // Never break order flow for a webhook. } } }