Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleAuthenticationChallenge = async ({ clientSecret }) => {
let response = null
try {
console.log('Calling stripe.authenticatePaymentIntent()')
const authResponse = await stripe.authenticatePaymentIntent({
clientSecret,
})
console.log('stripe.authenticatePaymentIntent()', authResponse)
if (authResponse.status === 'requires_payment_method') {
response = {
message: 'Authentication failed, a new PaymentMethod needs to be attached.',
status: authResponse.status,
}
} else if (authResponse.status === 'requires_confirmation') {
response = {
message: 'Authentication passed, requires confirmation (server-side)',
status: authResponse.status,
}
} else {
response = {