#Jedburgh-CardField

1 messages · Page 1 of 1 (latest)

merry quail
#

Hi there, can you show me the code snippet?

restive condor
#

sure

#

dispatch(GlobalAction.createIntent({api_token: userToken}))
.then(async (responseData) => {
const {setupIntent, error} = await confirmSetupIntent(responseData.client_secret, {
type: 'Card',
billingDetails
});
if (error) {
console.log(error)
} else {
console.log({"success": setupIntent})
}
})
}

#

sorry can't get snippit to work

merry quail
#

How do you initialize the Stripe SDK? do you use <StripeProvider> anywhere in your code?

restive condor
#

yes

#

I had it working earlier today by doing the // Init Stripe in the useEffect that's commented out

#

but doesn't seem to be doing it anymore

#

sorry code is pretty messy

merry quail
#

OK, I'd recommend you to wrap the CardField inside the <StripeProvider> so that confirmSetupIntent knows where to get the card details

restive condor
#

okay I will try that

#

should I remove the one I have wrapping the whole app?

merry quail
#

Oh do you have one? because I don't see StripeProvider in your code/

restive condor
#

yes it's wrapping the root component

merry quail
#

OK, you just need one StripeProvider that wraps all Stripe Components in your code

restive condor