fix(paymentInput): don't proceed when modal closed
This commit is contained in:
@@ -126,10 +126,10 @@ const CheckoutForm = ({
|
|||||||
|
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
|
|
||||||
const { error } = await stripe.confirmPayment({
|
const { error, paymentIntent } = await stripe.confirmPayment({
|
||||||
elements,
|
elements,
|
||||||
confirmParams: {
|
confirmParams: {
|
||||||
// Make sure to change this to your payment completion page
|
// TO-DO: Handle redirection correctly.
|
||||||
return_url: viewerHost,
|
return_url: viewerHost,
|
||||||
payment_method_data: {
|
payment_method_data: {
|
||||||
billing_details: {
|
billing_details: {
|
||||||
@@ -151,10 +151,9 @@ const CheckoutForm = ({
|
|||||||
})
|
})
|
||||||
|
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
if (!error) return onSuccess()
|
if (error?.type === 'validation_error') return
|
||||||
if (error.type === 'validation_error') return
|
|
||||||
if (error?.type === 'card_error') return setMessage(error.message)
|
if (error?.type === 'card_error') return setMessage(error.message)
|
||||||
setMessage('An unexpected error occured.')
|
if (!error && paymentIntent.status === 'succeeded') return onSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
const showPayButton = () => {
|
const showPayButton = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user