Search code examples
react-nativestripe-paymentsstripe-payment-intent

I am using react native stripe SDK, How Can I charge payment in stripe connected account?


I am using the React Native CLI to implement Stripe Connect. I've encountered an issue when creating a payment intent on a connected account. The problem arises because I haven't defined the connected account in my client side, leading to an error that states 'no such payment intent'. Despite this, I can see the payment intent on the Stripe dashboard. This issue occurs because, while I create the payment intent on a connected account, I do not pass any connected account ID in the client side. Consequently, the system attempts to find the payment intent on the main account, resulting in an error.

How Can I pass the conncted account id in client side? I couldn't find any documentation. Here is a screenshot of my client side.

Screenshot

I am unable to find any documentation regarding this payment intent on stripe connected account.


Solution

  • Since you are using Direct Charges where all the requests happen on the connected account, you have to ensure that you set the connected account id properly in each request. You mentioned you do this right server-side already which is documented here. Below we have a separate section explaining how you configure this in client-side applications and there's a specific tab for React Native: https://stripe.com/docs/connect/authentication?client=create-client-react-native#adding-the-connected-account-id-to-a-client-side-application

    The way our ReactNative SDK works is that you don't really configure this on a per-request basis or in the CLI but instead configure it in your client-side code when you load Stripe itself like this:

    import {StripeProvider} from '@stripe/stripe-react-native';
    
    function App() {
      return (
        <StripeProvider
          publishableKey="pk_test_123456"
          stripeAccountId="acct_1234"
        >
          // Your app code here
        </StripeProvider>
      );
    }