Level 11
I don't have the solution but I believe you've to add the headers to the request.
https://laravel.com/docs/8.x/http-tests#customizing-request-headers
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am getting the follow error:
Stripe\Exception\SignatureVerificationException : Unable to extract timestamp and signatures from header
Here is my test:
public function testHandlePaymentIntentSucceeded(): void
{
/** @var \App\Models\Basket $basket */
$basket = Basket::factory()->create();
$this->mock(CreateOrder::class, function (MockInterface $mock) use ($basket) {
$mock
->shouldReceive('handle')
->once()
->withArgs(function (Community $communityArg, Basket $basketArg, PaymentIntent $paymentIntent) use ($basket) {
return $communityArg->is($this->community) && $basketArg->is($basket) && $paymentIntent->id === 'pi_test';
});
});
$this->mock(StripeClient::class);
$this->sendWebhook([
'type' => 'payment_intent.succeeded',
'data' => [
'object' => [
'charges' => [
'object' => 'list',
'data' => [
[
'id' => 'ch_test',
'metadata' => [
'basket_id' => (string) $basket->getKey(),
],
'object' => 'charge',
'status' => 'succeeded',
],
],
],
'id' => 'pi_test',
'object' => 'payment_intent',
],
],
])->assertSuccessful();
}
protected function sendWebhook(array $data = []): TestResponse
{
return $this->withoutExceptionHandling()->postJson('/stripe/webhook', $data);
}
}
I've had a good search and can't find anything to see why this is causing an issue. What is the problem?
Please or to participate in this conversation.