Quick Links

Generate token from credit card Stripe.Net

Since Stripe.Net doesn't work anymore in the PCL side, we need to use DependencyServices<>. However, when I'm trying to generate a token from credit card information, it seems like... It's missing in the doc, I just can't find anything on the web or in the doc, is that normal?

Now that you have your data stored in a class, that the moment to generate a Stripe token from it ! For that, we'll use the DependencyServices<>. So we need need an interface IStripeServices in the shared code (PCL), and a service that inherit of it, in the subplatform.

Hey, I was looking into this recently and found this link and tutorial by Adam Pedley. I've used it for a test solution and think its very good.

xamarinhelp.com/stripe-in-xamarin/

Note: He recommends not storing the secret key in your app due to security concerns (app being decompiled etc..) but using it in a server hosted web API. This seems to be very smart as it means you never send the users actual credit card details only a token. I created a .net core web api project, and published it to Azure and have tested it and it's working. You can see how to do that here:

Now that you have your data stored in a class, that the moment to generate a Stripe token from it ! For that, we'll use the DependencyServices<>. So we need need an interface IStripeServices in the shared code (PCL), and a service that inherit of it, in the subplatform.

Hey, I was looking into this recently and found this link and tutorial by Adam Pedley. I've used it for a test solution and think its very good.

xamarinhelp.com/stripe-in-xamarin/

Note: He recommends not storing the secret key in your app due to security concerns (app being decompiled etc..) but using it in a server hosted web API. This seems to be very smart as it means you never send the users actual credit card details only a token. I created a .net core web api project, and published it to Azure and have tested it and it's working. You can see how to do that here: