我找澄清使用網絡掛接控制器的條紋出納的作爲Laravel文檔描述,我無法確認我的應用程序接收網絡掛接事件:條紋出納網絡掛接
http://laravel.com/docs/5.0/billing#handling-failed-payments
該文檔建議一個路由指向網絡掛接控制器是這樣的:
Route::post('stripe/webhook', 'Laravel\Cashier\[email protected]');
的URI的路徑必須進行修改是URI在我的條紋設置。在測試環境中,我使用ngrok來公開本地服務器。
我在尋找的澄清是什麼URI應該爲測試和生產。爲了測試,我應該只使用ngrok轉發url(例如,http://3a4bfceb.ngrok.com),還是需要在公共目錄中有一個腳本來處理來自Stripe的webhook事件。
我不知道控制器是否能夠處理好與handlePayload
功能接收數據,或者如果我需要添加額外的PHP腳本(例如webhook.php
)的東西如如在條紋文檔描述:
// Set your secret key: remember to change this to your live secret key in production
// See your keys here https://dashboard.stripe.com/account
Stripe::setApiKey("sk_test_xxxxxxxxxxxxxxxxxxxxxxx");
// Retrieve the request's body and parse it as JSON
$input = @file_get_contents("php://input");
$event_json = json_decode($input);
// Do something with $event_json
http_response_code(200); // PHP 5.4 or greater
如果任何人都可以使用的檢測和生產URI,以及是否額外的處理腳本需要,除了出納WebhookController.php
提供幫助,我將不勝感激。
它會很好地工作ngrok,在我的經驗。 – ceejayoz 2015-02-17 21:32:35