You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
spa_instat_tv/src/features/BuyMatchPopup/store/hooks/useStripe3DSecure.tsx

20 lines
546 B

import type { PaymentIntentResult } from '@stripe/stripe-js'
import { useStripe } from '@stripe/react-stripe-js'
export const useStripe3DSecure = () => {
const stripe = useStripe()
const handleConfirmationResult = (result: PaymentIntentResult) => {
if (result.error) {
return Promise.reject(result.error)
}
return Promise.resolve(result.paymentIntent)
}
const handle3DSecure = (clientSecret: string) => (
stripe?.confirmCardPayment(clientSecret).then(handleConfirmationResult)
)
return { handle3DSecure }
}