I have a screen in my ASP.NET MVC web application in which I ask the user for their credit card information. They type it in.
Adhering to PCI guidelines, I am using Stripe.js to send this credit card information to stripe and get back a stripe token.
I then post this stripe token to my ASP.NET MVC application. In the application, I would like to create a customer. I would not like to charge the customer just now. I simply want to create a customer so I can charge them later using their Stripe customerId
.
The documentation provided here makes it look simple. However, the client library that I am using (Stripe
NuGet package version 1.12.0) does not offer the StripeCustomerCreateOptions
class and many other classes mentioned in that document.
Instead, it has these two methods that help you create a customer:
public StripeObject CreateCustomer(ICreditCard card = null,
string coupon = null,
string email = null,
string description = null,
string plan = null,
DateTimeOffset? trialEnd = default(DateTimeOffset?));
public StripeObject CreateCustomerToken(string customerId);
As you can see, none of the methods are of any help to me. The first one requires the server to pass credit card information, which I am not doing as it is against PCI guidelines.
The second one assumes that you already have a customer and you want a token for the customer to use someplace else.
How do I create a customer from within my ASP.NET MVC application if I already have a credit card token for him that I got from Stripe.js?
card
parameter of theCreateCustomer()
method. – YwainCreditCardToken
that implements theICreditCard
interface and so it can be passed in place of thecard
parameter. TheCreditCardToken
class represents such a token and can be instantiated by giving to its ctor thestring
token you received from Stripe. I was able to do this immediately after writing the question. Just didn't have the time to update this question with an answer. If you will, I will mark it as the right one. – Water Cooler v2