#sreekanth_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1232672295886258307
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- sreekanth_api, 2 hours ago, 39 messages
- sreekanth_api, 3 hours ago, 33 messages
- sreekanth_api, 1 day ago, 80 messages
- sreekanth_api, 2 days ago, 46 messages
hi
Hi, let me help you with this.
Could you elaborate please? What do you mean by "what i should show"?
I am trying to implement payment authentication in the frontend. If it fails authentication in the backend, what are the details that I should send to the frontend?
const CheckoutForm: React.FC<CheckoutFormProps> = () => {
const stripe = useStripe();
const elements = useElements();
const router = useRouter();
const [isProcessing, setIsProcessing] = useState<boolean>(false);
const [succeeded, setSucceeded] = useState<boolean>(false);
const secret = "pi_3P94WiJKyfLg4PX00hlBtRsZ_secret_0IHLqligPX1lEoohDbRjCGp8O";
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (!stripe || !elements) {
// Stripe.js has not yet loaded.
// Make sure to disable form submission until Stripe.js has loaded.
return;
}
setIsProcessing(true);
const cardElement = elements.getElement(CardElement);
if (cardElement) {
const { error, paymentIntent } = await stripe.confirmCardPayment(secret,);
if (error) {
toast.error(error.message);
setIsProcessing(false);
} else if (paymentIntent && paymentIntent.status === 'succeeded') {
setSucceeded(true);
router.push(`${window.location.origin}/success?payment_intent=${paymentIntent.id}&method=${paymentIntent.payment_method_types[0]}`);
}
}
setIsProcessing(false);
};
return (
<div className="payment_container">
<form onSubmit={handleSubmit}>
<div className="card-element-container" style={{width:"400px"}}>
<CardElement />
</div>
<button type="submit" disabled={isProcessing}>
{isProcessing ? "Processing..." : "Pay Now"}
</button>
</form>
</div>
);
};
do i need to pass any adidtional parameters here => const { error, await stripe.confirmCardPayment(secret,);
Do you need specifically only card authentication handling flow?
Or simply accept payments?
For saved cards, we handle transactions on the backend. For authenticated flows, we're attempting to notify users via email to authenticate
Basically, if an off-session charge fails, you're trying to bring customers on-session to confirm the payment again?
yes, We save customers' cards in Stripe and display the same saved cards for payments. However, for cards with 3D Secure, payment cannot be completed without authentication from the user.
you can check previous conversations...
.
Hi there ๐ jumping in as my teammate needs to step away. Please bear with me a moment while I catch up on the discussion here.
okay sure
If the payment fails, you'll need to get your customers to come back on-session to complete the payment. The failed payment is the indicator you'll receive that you need to do so.
confirmCardPayment seems like a valid approach for your frontend code, as long as you're only processing card payments. You'll need to ensure the Payment Method you're using is attached to the Payment Intent on the backend before doing the client-side confirmation, or you'll need to provide the ID of the Payment Method to use when making the confirmation request:
https://docs.stripe.com/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-data-payment_method
yes, i did that
why we need to pass, payment_method: {
card: cardElement,
billing_details: {
name: 'Jenny Rosen',
},
}, ?
i dont understand, why we need to pass cardElement here....
You don't do that if you want to use an existing Payment Method, you pass the ID of the existing Payment Method instead of the instance of the Card Element.
like this => = await stripe.confirmCardPayment(secret,
{
payment_method: "pm_1P904xJKyfLg4PX0nG4c0X34",
setup_future_usage: 'off_session',
}
);
It sounds like you're using an already set up Payment Method, so you won't want to use setup_future_usage.
Ask the user what?
If a user has subscribed to pay monthly or annually, in the case of 3D Secure payments, will the amount be automatically deducted each month, or do we need to ask the user to authenticate each month?
The payment is automatically attempted each month. If the payment fails, you'll need to bring your customers back on session to complete the payment.
okay
Do we have any email services provided by Stripe for 3D Secure payments, to notify users to authenticate?
Yup, you can review those settings and make adjustments to them here:
https://dashboard.stripe.com/settings/billing/automatic
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
okay, thanks toby