#shsolutions - Stripe in .NET
1 messages ยท Page 1 of 1 (latest)
Hello, I appreciate the help. I'm a bit confused currently...
You can take a look at our Quickstart application and select the .NET server language
But even better would be to go through our initial "Accept a Payment" walk through.
In that case you select the server-side language in the code snippet windows
Thank you. I did look at those, but they are for web based solutions or where Stripe is actually defining the UI. So I can't really use that because there's no web frontend, it's a desktop application. I already made the UI and I'm just looking for how the class should be developed to process the payments when I pass the values to it... I can't find anything like that anywhere.
The closest thing I found was the Quickstart here: https://stripe.com/docs/development/quickstart/dotnet
But that doesn't even assign the credit card number anywhere, so I don't see how that code could actually do anything.
Right, because storing credit card numbers locally is a huge legal risk and not something you should ever do
So we don't recommend it
I'm not storing them anywhere. They would be entered in, passed to the class and processed.
There is no web frontend, the front end is my application UI layer. So I have controls in place for the necessary values, and a class (ideally) to process the payment with Stripe. So the class should accept the values necessary to process the payment. It can't rely on web UI elements that aren't going to be there.
Okay there is a way to do it but it's using older APIs. In that case your class would need to pass the data to our Tokens API to create a payment method based on the card information.
https://stripe.com/docs/api/tokens/create_card
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Oh, OK. So the newer API's only work with the controls library?
Will these older API's continue to be supported?
I'll take a look at that link now too.
We will always support our older APIs since some of our very first customers still use them
Wait, nevermind, you can use actual card info to create the more current Payment Method object: https://stripe.com/docs/api/payment_methods/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Oh, Ok. Well that's a relief.
I'm in the process of switching our payment processor, and want to switch to Stripe.
But we're a national franchise system, so I need to integrate it into the desktop application that all of the offices use / will use, as well as the website...
It's a bit daunting to change processors and I'm very nervous that there will be issues...
Oh, let me check that right now. Thank you for that as well!
I really appreciate all of your help and your patience with all of my questions.
Sure thing! make sure you avail yourself of our .NET client library as the functions there encapsulate a lot of our API logic so you don't have to re-invent the wheel we spent so much time and effort building ๐
That's the Stripe.net dll sdk, correct? I've got that added to the desktop project now. I'm really hopeful to get this switched over as soon as possible. Stripe sounds like a great company to partner with for our processing.
We try our best to make our users successful. Yes you've got the right one. We also open-source this so you can get a better understand of what it does.
https://github.com/stripe/stripe-dotnet
I'm very sorry to bother you again. Using your recommendations, and some other code samples on the Stripe site, I put together this demo code. Does this look right? I guess I'm really unsure because I'm creating these 3 different objects (Card, Item, Price), but when I'm looking at the examples, I don't see any where these object get combined or are sent to "charge" the card?
And I also don't see where the result would be returned. So, I would want to wrap that in a try / catch, but I don't see where the error would actually generate so I think I'm missing something.
I'm sorry again for bothering you...
Stripe.StripeConfiguration.ApiKey = AccessToken;
//Card Details
var optionsCard = new Stripe.PaymentMethodCreateOptions
{
Type = "card",
Card = new Stripe.PaymentMethodCardOptions
{
Number = CCNumber,
ExpMonth = ExpMonthInt,
ExpYear = ExpYearInt,
Cvc = CCCVV,
},
};
var service = new Stripe.PaymentMethodService();
service.Create(optionsCard);
//Transaction Details
var optionsProduct = new Stripe.ProductCreateOptions
{
Name = "Services",
Description = "[Invoice] - Name/Address",
};
var serviceProduct = new Stripe.ProductService();
Stripe.Product product = serviceProduct.Create(optionsProduct);
//Price Details
var optionsPrice = new Stripe.PriceCreateOptions
{
UnitAmount = DollarsAndCentsInt,
Currency = "USD",
Product = product.Id
};
var servicePrice = new Stripe.PriceService();
Stripe.Price price = servicePrice.Create(optionsPrice);
Hi ๐ I'm jumping in as my teammate needed to step away. Please bear with me a moment while I catch up on the context here.
Alright, so I understand that you're looking to build a desktop application (not a web application) and integrate that with Stripe. There are a couple key points that I want to call out before going too much further down that path.
First, you'll want to make sure you read up on PCI compliance requirements, because if your application is handling raw card data then you will need to ensure you meet those requirements and are prepared to handle the compliance burden that comes with them.
https://stripe.com/guides/pci-compliance
https://stripe.com/docs/security/guide
Additionally, what is your the targeted geo for your application? I'm asking because Europe now requires the use of SCA/3DS, which means your application would also need to be able to handle those challenge/authentication flows.
Thank you for your help.
Our software is targeting North America / The United States.
And we do meet the PCI Compliance standards, as no data is stored that isn't supposed to be stored. The form doesn't save anything during the card processing step, it only passes it to a class that processes it on Stripe.
The raw card details touching any part of your system, regardless of storage, could have PCI compliance implications.
And additionally, is it safe to assume that you're setting up a backend for your application to interact with in between your frontend and the Stripe service? Just making sure that you're not planning on embedding your private api key in a program that you intend to distribute.
I have a class that will process the payment, but I won't be distributing our private key with it.
Each office will need to sign up for a Stripe account and provide their own details, which will be encrypted.
Our software is not cloud based either, it is locally installed and ran, so no data is communicated outside of the form during proessing.
Gotcha
So the core objects that are now used for processing payments, are Payment Intents. Those are what you will use to create and use to process payments.
https://stripe.com/docs/payments/intents
https://stripe.com/docs/api/payment_intents/create
Thank you for your help. I will read both of those pages now.
So, after I create the other objects, I pass them to the PaymentIntents object?
Is that also where I will get the response code to confirm successful processing?
The way Stripe has structured their SDK seems to be very versatile, but I'm just having a hard time wrapping my head around it I think. So I do apologize for all of the questions.
No worries, it's also going to be a bit tricky because the approach you're taking is not what most of our documentation is written for. Yes, the Payment Intent will be the object that carries the lifecycle of the payment, and has fields on it such as last_payment_error to help you keep track of what is happening.
https://stripe.com/docs/api/payment_intents/object#payment_intent_object-last_payment_error
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thank you very much. I will read through everything you sent and work on this some more this afternoon.
I really appreciate your help!
Any time! Wishing you the best of luck with your project.