Answer the question
In order to leave comments, you need to log in
Why doesn't handleWebhook Cashier Laravel work?
Hello everyone, I want to accept hooks from Stripe, I read the doc
Route scored this Route::post('stripe/webhook', '\App\Http\Controllers\[email protected]');
The controller extends the base
use Laravel\Cashier\Http\Controllers\WebhookController as CashierController;
class WebhookController extends CashierController {}
public function handleInvoicePaymentSucceeded($payload)
{
//http_response_code(201);
//$subscription = Subscription::where('stripe_id', $payload);
$path = 'screenshots/' . time() . '.txt';
$result = Storage::disk('public')->put($path, 'asdasd');
}
public function index()
{
$input = @file_get_contents('php://input');
//$event_json = json_decode($input);
// Do something with $event_json
$path = 'screenshots/' . time() . '.txt';
$result = Storage::disk('public')->put($path, 'asdasd');
http_response_code(200); // PHP 5.4 or greater
}
Answer the question
In order to leave comments, you need to log in
I kind of figured it out, I had to climb into the WebhookController class,
and there is a check
if (! $this->isInTestingEnvironment() && ! $this->eventExistsOnStripe($payload['id'])) {
return;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question