When a customer pays, the following entry is stored into the database:
DB::table('subscriptions')->insert([
'user_id' => $user->id,
'quantity' => 1,
'stripe_id' => $request->paymentIntent,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
]);
The record is saved successfully. When listening to the Stripe webhook payment_intent.succeeded
I want to grab the paymentIntent Id from the webhook and find the record in my database:
$paymentInstance = DB::table('subscriptions')->where('stripe_id',$paymentIntent->id)->first();
The first call responds with null
(echo $paymentInstance). When I hit resend in the Stripe dashboard, I get the desired result. How is this possible? The storing of the initial record has to be faster then the webhook reaching the server for the first time – or am I mistaken?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/31W8wWs
via IFTTT
Aucun commentaire:
Enregistrer un commentaire