#mykola5123

1 messages · Page 1 of 1 (latest)

frigid nimbusBOT
unique fractal
#

Hello! Can you provide more details? Not sure what you're trying to do.

boreal hollow
#

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?

unique fractal
#

Yep, you can do that.

boreal hollow
#

Nice 🙂

#

... but right now I get this error

#

I share the code... one moment

unique fractal
#

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?

boreal hollow
#

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>
  )
}

boreal hollow
unique fractal
#

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?

boreal hollow
#

acct_1NYuI5QooA0KkmHc

boreal hollow
#

the method works asynchronously