#deondk-xamarin
1 messages ยท Page 1 of 1 (latest)
well I need some tips on how to get started. I have integrated the stripe sdk with my xamarin apps but the sdk is outdated so it doesnt have 3DS support so I need to custom build it. I assume sending it to a webview.
so I need to somehow know whether the card needs 3DS then send to a webview to confirm 3DS then send back to app for success
Which SDK are you referring to?
Stripe SDK should know by itself whether to open a 3DS page. As long as you use its method, it's automatically done
because stripe sdk is so outdated in xamarin I custom build all the dunctions of paying. so all is done via api in .net environment
getting a token from paymentintent and then using that to do payment
Which SDK is that? stripe.js?
I can see in the status message of intent in api that it needs firther authorization
so I guess I can use that to know whether to send to 3DS
let me see if I can find the stripe version
I think the one I use in android is the stripe android sdk V 8.7
does this help at all?
yes kind of rebuild for xamarin.
but an old one
so I will have to custom build the 3DS via a webview I think
maybe. We don't really know I'm afraid, we have no official support for Xamarin and we don't test anything there.
it's probably easier for you to do the PaymentIntent confirmation on the server side and get a 3D Secure URL (https://stripe.com/docs/payments/3d-secure#manual-redirect) that you can send back to the app if needed.
Ok I think I get that url
but my question then is when I redirect from the webview how will I get feedback back to the app if it was success or not?
you can set a return_url (see the docs linked above), and you'd have to use that. So for example, you might use shouldOverrideUrlLoading in the WebView to check the URLs being visited in the view, and when it's the return_url you specified, then you know to close the WebView and move on to the next step in your flow. I think that's what our SDK does.
ok thanks for the help
going to play around with it and let you know if I need help
thanks a lot
no worries! To be completely honest with you, this will be really hard and I would officially suggest that we just don't support Xamarin and you're going to have a lot of difficulty doing this.
I would either use native Android/iOS, or React Native, but beyond that if you have to use Xamarin, you might want to just do the payments on your website using stripe.js/Checkout and redirect out of your app for that part.
ok thanks for the advice. will have a look
do you mean then doing the whole payment flow in a webview in app?
I would personally do it outside of the app entirely just in the normal browser for maximum compatibility. For example Google Pay won't work in a WebView in Android
yeah in our use case we need it to be inside app.
I am using a 3ds card but for some reason my nextAction in paymentIntent is null
is there a way to manually make up the 3DS url if I have the paymentintent?
which card are you using?
4000000000003063
if next_action is null then it just means 3D Secure wasn't required , you don't need to force it.
what's the pi_xxx ID of the PaymentIntent?
yeh you have to confirm it first, just creating the PaymentIntent doesn't attempt a payment
you should pass Confirm=true in the creation params
you're using it ๐
ok that is a bit confusing as Im in app. so what would the return url be?
is that the return url after authentication is done?
yes
ok cool. can handle that
usually it's a URL on your server with a 'success' page. In an app you might want to do what I mentioned earlier and have the app detect in the webview when that page is visited
ok got the 3ds link
when I get to the success page is there a way to know whether 3DS is successfull or not?
anything passed in url?
I think there are some query parameters added to the URL, at least the PaymentIntent ID is there
yep, so if you want to check the status you can take the PaymentIntent ID and retrieve it from the API to check the status field for example
ok so this has thrown my logic up to now out the window. What Im doing currently without 3DS is creating paymentintent via api and then confirming the paymentintent on client side with clientsecret
yep, and that is generally the correct approach
problem is you're using Xamarin I suppose. Does throwing a 3D Secure card into your existing flow just break entirely?
well if I dont handle it it just goes thru as success
that seems unlikely
thats how I realized something was wrong it doesnt go thru as success on stripe backend
but doesnt throw an exception
just the status shows requires action
yeah, requires_action is not a success.
so how do I handle 3DS without confirming pi inside backend?
you can confirm it on the client side instead, but that won't work for you since you're using Xamarin with an old version of our Android library that doesn't support it.
overall my advice is to switch to using a normal web based(Elements or Checkout) integration and open that in a web page outside the app, in-app payments are just going to be incredibly difficult to get running on this unsupported(by Stripe) platform.
ok but I might be able to use stripe.net inside xamarin...
don't do that. It needs your secret key, and then you'd be distributing your secret key in your app, so no.
so after I get the requires action status, I can maybe send my secret key encrypted from api in backend
just no, sorry
don't do any of that
I have to run I'm afraid, my colleague can take over. My advice is what I mentioned, you'd get a much better experience by redirecting out of the app instead of trying to get any of this working with Xamarin.
Alternatively ,the other option is to integrate with server-side confirmation, (which is what I've been describing) and for 3D Secure ,send the URL to the app and have the app open it in a webview. It's really complex though and hard to implement and there are no guides. But it's combining https://stripe.com/docs/payments/accept-a-payment-synchronously with https://stripe.com/docs/payments/3d-secure#manual-redirect essentially.
Ok But my question then would be how do I handle non 3DS cards?
if I confirm on server side
Hi! For cards without 3DS, you can directly confirm the PaymentIntent on the backend and it should work.
something I have seen now I can maybe try and do is the following:
get paymentintent and client secret from api
confirm paymentintent on client side
then check the NextAction on client side if it has a url for redirect then I can send for 3DS
if not it should succeed
can you maybe check for me to which email this test account is linked to?
acct_1IgVWK2ZHju5IOtm
I am trying to do a test but cant find this test connect sccount
Hello. Taking over for soma as they have to step out
I can't provide that. I recommend you reach out to support for that info as they will be able to verify your identity (and make sure that is your account) to proceed.
Is there any easy way on backend to find accounts based on ID?
I have a lot of different accounts
You can use this endpoint: https://stripe.com/docs/api/accounts/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.