Php Laravel-条纹-超级钩-网钩未被捕获
我使用的是Php Laravel-条纹-超级钩-网钩未被捕获,php,stripe-payments,laravel-5.4,webhooks,laravel-cashier,Php,Stripe Payments,Laravel 5.4,Webhooks,Laravel Cashier,我使用的是laravel5.4和laravelcashier。我希望能够在我的localhost:8888 为此,我安装了ultrahook,并像这样启动它 超级挂钩 http://stripe.leococo.ultrahook.com -> http://localhost:8888/stripe/webhook 拉维尔航线 Route::post('stripe/webhook','\Laravel\Cashier\Http\Controllers\WebhookController@ha
laravel5.4
和laravelcashier
。我希望能够在我的localhost:8888
为此,我安装了ultrahook
,并像这样启动它
超级挂钩
http://stripe.leococo.ultrahook.com -> http://localhost:8888/stripe/webhook
拉维尔航线
Route::post('stripe/webhook','\Laravel\Cashier\Http\Controllers\WebhookController@handleWebhook');代码>
条带Webhook配置
http://stripe.leococo.ultrahook.com
问题
当我从Stripe
发送webhook
时,我得到testwebhook成功发送
在终端ultrahook
中,我得到了这个
[2017-05-3119:26:04]发布http://localhost:8888/stripe/webhook -200
但似乎没有触发handleWebhook
功能。它不会停在断点上,也不会死('test')
我尝试了php artisan路径:clear
php artisan配置:clear
。我不知道这是否正常,但我在Chrome Inspector的网络
部分没有看到任何内容在.env中添加以下行
CASHIER_ENV=testing
Laravel/出纳检查您对webhook的呼叫是否具有有效的事件id。
为了验证这一点,eventExistsOnStripe使用此事件id回调条带服务器以检查其存在性
以下是Laravel/Bacher 7.0的主要webhook入口点:
public function handleWebhook(Request $request)
{
$payload = json_decode($request->getContent(), true);
if (! $this->isInTestingEnvironment() && ! $this->eventExistsOnStripe($payload['id'])) {
return;
}
$method = 'handle'.studly_case(str_replace('.', '_', $payload['type']));
if (method_exists($this, $method)) {
return $this->{$method}($payload);
} else {
return $this->missingMethod();
}
}
isInTestingEnvironment只需检查我们是否处于测试环境中:谢谢Cpt显然:)
你如何确定它没有被触发
die('test')
将导致对Stripe的200ok
响应,因此您仍然会得到“testwebhooks发送成功”。一个Stripe webhook调用永远不会出现在Chrome的inspector中。如果我把一个xdebug
断点放在它上面,它应该停止吗?执行此类函数的正确方法是什么?当Web服务器收到POST请求时,IDE中的断点不会起多大作用。我将使用Laravel的Log::debug()
函数将调试信息输出到handleWebhook
函数中的日志中。
protected function isInTestingEnvironment()
{
return getenv('CASHIER_ENV') === 'testing';
}