📜  如何在 laravel 中获取 webhook 响应 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:23.582000             🧑  作者: Mango

代码示例1
public function orderCreateWebhook(Request $request)
    {              
        //get order_id here and send notification
        notification = "A new order with id [order_id] has been 
                       created";
        SendSMS(notification); 
    }

   public function registerOrderCreateWebhook(Request $request)
    {
            $shop = "example.myshopify.com";
            $token = "xxxxxxxxxxxxxxxxxxxxxx";
            $shopify = Shopify::setShopUrl($shop)->setAccessToken($token);
            Shopify::setShopUrl($shop)->setAccessToken($token)->post("admin/webhooks.json", ['webhook' => 
             ['topic' => 'orders/create',
             'address' => 'https://shop.domain.com/order-create-webhook',
             'format' => 'json'
             ]
            ]);
    }