📅  最后修改于: 2022-03-11 14:54:23.582000             🧑  作者: Mango
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'
]
]);
}