#Shivam Kumar
1 messages · Page 1 of 1 (latest)
can you elaborate?
I am creating payment intent like this
public function processPayment(Request $request) {
$stripe_secret_key = PaymentGateway::value('stripe_secret_key');
Stripe::setApiKey($stripe_secret_key);
$payment = null;
$stripe = new \Stripe\StripeClient($stripe_secret_key);
$booking = Booking::where('id',$request->booking_id)->first();
try{
$payment_intent = $stripe->paymentIntents->create([
'amount' => $request->amount * 100,
'currency' => 'usd',
'payment_method' => $request->payment_method_id,
'payment_method_types' => ['card', 'us_bank_account'],
'customer' => $booking->stripe_customer_id,
'application_fee_amount' => 123,
'confirm' => true,
],
['stripe_account' => $booking->landlord->stripe_connected_account_id]
);
}catch(\Stripe\Exception\CardException $e) {
return back()->with('error',$e->getError()->message);
}
I want to track payment status using webhook, my current webhook not working
switch ($event->type) {
case 'payment_intent.succeeded':
$paymentIntent = $event->data->object;
$stripe = new \Stripe\StripeClient($stripe_secret_key);
$payment_details = $stripe->paymentIntents->retrieve(
$paymentIntent->id
);
$webhook = new Webhook;
$webhook->type = 'payment_succeeded';
$webhook->content = json_encode($payment_details);
$webhook->save();
break;
case 'payment_intent.payment_failed':
$payment_failed = $event->data->object;
$webhook = new Webhook;
$webhook->type = 'payment_failed';
$webhook->content = json_encode($payment_failed);
$webhook->save();
break;
default:
error_log('Received unknown event type');
}
http_response_code(200);
this is my webhook code.
what doees "not working" mean, what do you expect to happen and what happens instead?
I want to get payment intent status using webhook.
Give me one answer please which event to listen payment intent using webhook for connected account?
you're not making sense, sorry
make sure you read https://stripe.com/docs/connect/webhooks , since you need to set up the webhook correctly to get events from connected accounts