Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

forrestedw's avatar

Stripe Unable to extract timestamp and signatures from header

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?

0 likes
1 reply

Please or to participate in this conversation.