#tikam-rn-connect
1 messages · Page 1 of 1 (latest)
helki, the error message is
'pm_1JyuwPEZYfCMYXmKz7rvOCOJ'; OAuth key or Stripe-Account header was used but API request was provided with a platform-owned payment method ID.
does that help you?
You are making a Connect request but using a PaymentMethod from your Platform account?
Account is platform's account
using test credentials
Connect Feature of Stripe
yes I understand that
what I'm trying to get at is that you haven't integrated correctly so let's start here, what fund flow are you trying to use on Connect?
Direct Charges? Destinatoin Charges?
Direct Charges
yeah so there are two things to do there
you need to create a PaymentIntent on the Connect account
you need to create the PaymentMethod also on the Connect account
so both your client-side and server-side code need to use the stripeAccount parameter
yes, we are using it.
const stripe = await loadStripe( PUBLIC_KEY, { stripeAccount: state.payment_method.account_id } );
const response = await stripe .confirmCardPayment(data.stripe_client_secret)
This is web implementation and we need its compatible in React Native
yeah so you need to do this in ReactNative
pass stripeAccountId on StripeProvider
https://stripe.dev/stripe-react-native/api-reference/interfaces/StripeProviderProps.html#stripeAccountId
Documentation for @stripe/stripe-react-native
<StripeProvider publishableKey="PUBLISHABLE_KEY" stripeAccountId= {stripeAccountId} > <Screen order={order} /> </StripeProvider>
we are using it
ah well the card you sent me https://dashboard.stripe.com/test/logs/req_y1wswmcns2TGsv
that was not created through your ReactNative SDK so where did you get that from, looks like it was created with Checkout
We have saved Cards on web implementation, and we are using direct payment method, and for payment intent we are cloning method. Using confirmCardPayment method on web to process payment. So how do we do the same payment intent process on react native.
well ok we're talking conflicting things here
We have saved Cards on web implementation, and we are using direct payment method, and for payment intent we are cloning method
direct PaymentMethod vs cloning method, these are two opposite things
so can you explain what you mean by that
how can your integration be doing opposite things for 1 integration
direct Payment Type. We are using payment type as Direct. Direct Charges
yeah sorry we are not using the right terms here, that does not answer my question
like your earlier statement was "we do a, and we do z" so they were contradictory statements
I understand you are using Direct Charges, are you only using Direct Charges with Cloning cards?
or are you also directly creating PaymentMethods on the Connect account and NOT cloning?
Hey, let me describe the current flow from start
-
We have a connect system with standard accounts for the businesses.
-
Now we are storing customers and their cards info [payment method] on the platform account.
-
For payment we are using Direct Charges. For that we first clone the paymentMethod to the connected account and then create a PaymentIntent where connected_stripe_account and payment_method [id of the cloned method] is set
Now in our web flow we use the client secret generated from above along with connected_stipe_account to process that PaymentIntent using the function confirmCardPayment()
Now we want to process the PaymentIntent we generated above in mobile app [react native] too. So for that which function should we use?
reading over one sec
ah ok so this is the main part
- For payment we are using Direct Charges. For that we first clone the paymentMethod to the connected account and then create a PaymentIntent where connected_stripe_account and payment_method [id of the cloned method] is set
you first create a PaymentMethod on platform, then clone it down
so given that - you do NOT need to do this:
instead, your RN app will also remove stripeAccountId and create PaymentMethods on the Platform
server-side you will clone that PaymentMethod to the Connect account
and then create PaymentIntents like you said here
then create a PaymentIntent where connected_stripe_account and payment_method [id of the cloned method] is set
Yes so PaymentIntent is not changed as it’s created on server side. So all the process I listed above is same and then the client secret is sent to client where we want to call the function confirmCardPayment(client_secret).
So like you said if I do the whole payment method cloning and creating a PaymentIntent on the connected account. How do I process that PaymentIntent on React Native
How do I process that PaymentIntent on React Native
what have you integrated on your RN app, from Stripe SDK?
CardField? CardForm? PaymentSheet?
That’s our doubt what should we use, as on our web client there’s only the call to the function confirmCardPayment() no UI
And as the cloned payment method is already set in PaymentIntent during its creation on server so what exactly should we use on React Native client side
well then on ReactNative you can also just call confirmPayment() on the PaymentIntent with the "cloned" PaymentMethod ID
Okay and is this the right way to call just the function or should we use any UI components. Asking for both Web and React Native
you would use UI components if you want your customers to enter in a new card.
e.g. if this cloned card + confirmPayment() fails, how can your customer enter a new card in that case?
UI components like PaymentElement in web or CardForm in ReactNative, or even PaymentSheet in RN
We have a separate module for customer to add card in which we are using
stripe.checkout.Session.create(
payment_method_types=['card'],
mode='setup',
customer=customer_id,
success_url=success_url,
cancel_url=cancel_url
)
And using the session.url, stripes pre built page to let customer add card
So first customer will add card using this module and then will make payment by selecting which card [from list of his saved card] he wants to use and we will clone that particular PaymentMethod to the connected account
ok makes sense! (you are using Checkout to collect the card details)
but if the payment fails still (using the cloned PaymentMethod) as decline chances are always there, your customers have to go back to using Checkout then?
nothing wrong with that, just curious. As it seems easier to also add Stripe UI into your webpage or ReactNative app where you call confirmPayment() in case there is a decline
but up to you!
Yes, so according to you if our card declines what Stripe UI should we use in case of a decline. Also if there’s a pre built screen available for RN and web that we can use in case of a decline.
Also if there’s a pre built screen available for RN and web that we can use in case of a decline.
PaymentElement (web) and PaymentSheet (on mobile/RN)
this doc shows both integrations
Web -> https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
RN -> https://stripe.com/docs/payments/accept-a-payment?platform=react-native