#mykola5123
1 messages · Page 1 of 1 (latest)
Hello! Can you provide more details? Not sure what you're trying to do.
Hi, sure. I build a markatplace app with connect payment by stripe.
Like this:
so now if the customer try to pay I need to generate stripe paymentSheet from @stripe/stripe-react-native package with stripeAccountId.
each time I need to fetch stripeAccountId depends on market where the customer want to pay
Is ist enought clear?
Yep, you can do that.
That's likely because you're trying to use a Payment Intent that exists on a different account.
Which account did you create that Payment Intent on, your platform or a connected account?
const BasketScreen = ({ navigation }) => {
const [dispatch, t] = useInit()
const companyId = navigation.getParam('companyId')
const [isOpenedModal, setOpenModal] = useState(false)
const accountState = useSelector(state => state.account)
const table = navigation.getParam('table')
const [stripeAccountId, setStripeAccountId] = useState('')
const {
baskets,
removeBasket,
changeItemCount,
removeItem,
changeIngredientsCount,
isLoading,
} = useBasketsManager({
companyId,
table,
navigation,
})
....
useEffect(() => {
readStripeAccountId(companyId)
}, [companyId])
const readStripeAccountId = async companyId => {
const { stripeAccountId } = await fetchStripeAccountId(companyId)
setStripeAccountId(stripeAccountId)
}
const openPaymentSheet = async orderId => {
await initializePaymentSheet(orderId)
const { error } = await presentPaymentSheet()
return error
}
return (
<StripeProvider
publishableKey="pk_test_mmmm"
stripeAccountId={stripeAccountId}
>
....
</StripeProvider>
)
}
the connected account. If I set the account as constant, it works.
Can you log out the account ID you're trying to use and see if it contains the value you expect just before you use it?
yes, I get the account ID as response. But I think it can be to late?
the method works asynchronously