#Shivam Kumar

1 messages · Page 1 of 1 (latest)

cinder geyserBOT
fair ferry
maiden tusk
#

can we use webhook without $endpoint_secret = 'whsec_...';

fair ferry
#

Webhook secret is to check whether the event is really sent from Stripe. Is there any reason why you don't want to perform event validation?

maiden tusk
#

can you help me how I listen event for webhook after this code
try{
$payment = $stripe->paymentIntents->create([
'amount' => $request->rent*100,
'currency' => 'usd',
'customer' => $user->stripe_customer_id,
'payment_method_types' => ['card', 'us_bank_account'],
'payment_method' => $request->payment_method_id,
]);
$payment = $stripe->paymentIntents->confirm(
$payment->id,
);
}catch(\Stripe\Exception\CardException $e){
return back()->with('error',$e->getError()->message);
}

#

can we use this code after this?
$stripe = new \Stripe\StripeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$stripe->webhookEndpoints->create([
'url' => 'https://example.com/my/webhook/endpoint',
'enabled_events' => [
'charge.failed',
'charge.succeeded',
],
]);

fair ferry
#

$stripe = new \Stripe\StripeClient(
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);
$stripe->webhookEndpoints->create([
'url' => 'https://example.com/my/webhook/endpoint',
'enabled_events' => [
'charge.failed',
'charge.succeeded',
],
]);

Webhook endpoint is only one time creation and you don't have to create using code. It can done in the dashboard