#thesarimbhatti
1 messages · Page 1 of 1 (latest)
hi! what can I help with exactly?
$paymentIntent = \Stripe\PaymentIntent::create([ 'amount' => $cents, 'currency' => 'usd', 'customer' => $customer_id, 'payment_method_types' => ['card'], 'payment_method' => $payment_method->id, "statement_descriptor_suffix" => $item->stripe_statement_descriptor, 'application_fee_amount' => $connect_cents, 'confirm' => true, 'metadata' => ['reg_id' => $rp_id], 'setup_future_usage' => 'off_session' ], [ 'stripe_account' => $item->stripe_connect_account_id, ]);
this is how I am creating payment intent
but the declined payent with this message
"The payment method you provided is attached to a customer so for security purpose you must provide the customer in the request."
log the value of $customer_id, it's probably null.
It give me that error sometimes
the error is basically that you need to pass the cus_xxx ID of the customer that the PaymentMethod is attached to. So with that code you mention, it would happen if the $customer_id variable is null, so I imagine that's the problem.
ok let me see and one more thing
please guide me about this message
actually I am saving customer card token to use if for future payment and when I tried to charge that customer the payment remain incomplete
that can happen, sometimes an off-session payment on a saved card can require 3D Secure.
if you want to test the case where that does not hapen and 3D Secure is not required on the off-session payment, make sure you're using the appropriate test card 4000002500003155 https://stripe.com/docs/testing#authentication-and-setup , as the first step.
how can I avoid the 3D Secure ?
well if you follow the guide https://stripe.com/docs/payments/save-during-payment?platform=web and use the test card I mentioned, that will be a payment flow that accepts and saves a card, and then subsquent payments don't need 3D Secure.