#Shivam Kumar
1 messages · Page 1 of 1 (latest)
This is just payment intent creation. You'd need to send the client secret to the frontend and render Payment Element to complete ACH payment: https://stripe.com/docs/payments/quickstart?platform=web&client=html&lang=php
Only after ACH payment is completed, you'll set up Webhook with the guide here for the payment outcome: https://stripe.com/docs/webhooks/quickstart
can we use webhook without $endpoint_secret = 'whsec_...';
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?
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',
],
]);
$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
After you create the webhook endpoint, then you write code in your server to process the events sent to your server: https://stripe.com/docs/webhooks/quickstart