@rezaulhreza Dude, no. You should not be handling credit card details on your server at all!
Please read the Stripe docs as you’re clearly missing some fundamentals.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am getting the below error
This PaymentIntent could not be captured because it has a status of requires_action. Only a PaymentIntent with one of the following statuses may be captured: requires_capture.
This is my code to create a 3d secure payment gateaway using stripe.
if ($this->paymentMethod == 'pay') {
$stripe = Stripe::make(env('STRIPE_SK'));
try {
$token = $stripe->tokens()->create([
'card' => [
'number' => $this->card_no,
'exp_month' => $this->exp_month,
'exp_year' => $this->exp_year,
'cvc' => $this->cvc,
]
]);
if (!isset($token['id'])) {
session()->flash('stripe_error', 'Token not generated');
$this->order_success = 0;
}
$customer = $stripe->customers()->create([
'name' => $this->fname . ' ' . $this->lname,
'email' => $this->email,
'phone' => $this->contact,
'address' => [
'line1' => $this->door_number . ' ' . $this->road_name,
'postal_code' => $this->post_code,
'state' => $this->address,
'city' => $this->city,
'country' => $this->country,
],
'shipping' => [
'name' => $this->fname . ' ' . $this->lname,
// 'email' => $this->email,
'phone' => $this->contact,
'address' => [
'line1' => $this->door_number . ' ' . $this->road_name,
'postal_code' => $this->post_code,
'state' => $this->address,
'city' => $this->city,
'country' => $this->country,
],
],
'source' => $token['id']
]);
$paymentIntent = $stripe->paymentIntents()->create([
'customer' => $customer['id'],
'currency' => 'GBP',
'amount' => session()->get('checkout')['total'],
'description' => 'Paid for Order No. ' . $order->id,
'confirm' => true,
'capture_method' => 'automatic',
'confirmation_method' => 'automatic',
]);
$charge = $stripe->paymentIntents()->capture($paymentIntent['id']);
if ($paymentIntent['status'] == 'succeeded') {
$this->makeTransaction($order->id, 'approved');
$this->resetCart();
} else {
session()->flash('stripe_error', 'Payment not done');
$this->order_success = 0;
}
} catch (Exception $e) {
# code...
session()->flash('stripe_error', $e->getMessage());
$this->order_success = 0;
}
}
@rezaulhreza Dude, no. You should not be handling credit card details on your server at all!
Please read the Stripe docs as you’re clearly missing some fundamentals.
Please or to participate in this conversation.