Hi Guys,
I just have figured out this issue. I just wanted to share this with you. I hope this is helpful to you.
-
install Laravel 5.1
-
add this line of code below: "laravel/cashier": "~4.0"
in require section of composer.json file. -
run "composer update" through cmd or ssh terminal
-
add this line of code on your routes.php file below: Route::post('stripe/webhook', '\Laravel\Cashier\WebhookController@handleWebhook'); The important thing in this step is that you make sure you add a backslashe infront of Laravel. Because, if you don't add it, laravel will automatically try to access from app\http\controllers folder.
-
add your webhook url to your stripe account which can be found from 1. your account -> 2. account settings -> 3. webhooks. You can add the url from there. Please make sure you choose test mode unless you are putting it live right away.
-
Important!! You have to add except to csrf middleware since stripe doesn't pass csrf token. First, you go to VerifyCsrfToken file which is located in app/Http/Middleware. Second add this: 'strip/*', into the except array. So it's going to look like this:
protected $except = [ 'stripe/*', ];
-
You can go back to stripe settings page and test it by clicking "send test webhook" button.
If you see "success" message, you are good to go. That's it!