Created
March 5, 2018 18:14
-
-
Save jjgriff93/6e18881089b63e6f6478696cf9aad38d to your computer and use it in GitHub Desktop.
Stripe API - add new customer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create the user in Stripe using the Stripe API | |
| StripeConfiguration.SetApiKey(StripeAPIKey); | |
| var options = new StripeCustomerCreateOptions | |
| { | |
| //Add the customer's email address to Stripe | |
| Email = model.Email, | |
| }; | |
| var service = new StripeCustomerService(); | |
| //Returns us a customer object with a unique Stripe ID for them | |
| StripeCustomer customer = service.Create(options); | |
| //Create the user object with the ID returned from Stripe | |
| var user = new ApplicationUser() { UserName = model.UserName, StripeId = customer.Id }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment