Woocommerce webhook没有显示回应

问题描述 投票:0回答:1

我正在开发一个webhook来注意订单何时更新。

我的webhook功能如下所示:

public function webhook(Request $request) {

    if(!empty(Request::header('x-wc-webhook-delivery-id'))) {

        $head = Request::header('x-wc-webhook-source');
        $site = preg_replace('{/$}', '', $head);

        $webhookId = Request::header('x-wc-webhook-id');
        $deliveryId = Request::header('x-wc-webhook-delivery-id');

        $this->webhookOrders($site, $webhookId, $deliveryId);
    }

}

因此它将触发webhookOrders函数,该函数仅通过WebhookId和deliveryId获取更新的订单:

 $delivery = $woocommerce->get('webhooks/'.$webhookId.'/deliveries/'.$deliveryId);

虽然奇怪的是,当我尝试通过webhook访问此get请求时,它向我显示一个空响应:

    Array
(
    [id] => 559
    [duration] => 
    [summary] => 
    [request_method] => 
    [request_url] => https://<my_platform>/api/v1/orders/create
    [request_headers] => 
    [request_body] => 
    [response_code] => 
    [response_message] => 
    [response_headers] => 
    [response_body] => 
    [date_created] => 2018-02-28T10:48:05
    [_links] => Array
        (
            [self] => Array
                (
                    [0] => Array
                        (
                            [href] => https://<my_woo_site>/wp-json/wc/v1/webhooks/0/deliveries/559
                        )

                )

            [collection] => Array
                (
                    [0] => Array
                        (
                            [href] => https://<my_woo_site>/wp-json/wc/v1/webhooks/0/deliveries
                        )

                )

            [up] => Array
                (
                    [0] => Array
                        (
                            [href] => https://<my_woo_site>/wp-json/wc/v1/webhooks/0
                        )

                )

        )

)

在Woocommerce管理面板中,它向我显示有内容:

enter image description here

另外,令我疯狂的是,当我访问webhook外面的URL时,它会向我显示内容。并且日志文件未显示任何错误。

希望有人知道这个问题。谢谢!

php laravel api woocommerce
1个回答
1
投票

发现问题:

交货不再记录。

@deprecated 3.3.0 Webhooks交付日志现在使用日志系统。

© www.soinside.com 2019 - 2024. All rights reserved.