Alex Rohr
Alex Rohr

Reputation: 277

StripeException: Invalid API Key provided: Stripe.Net

My program successfully creates a token and passes it. It then creates all of the relevant information for a customer for Stripe.

                var customer = new StripeCustomerCreateOptions();

            customer.Email = $"{user.Email}";
            customer.Description = $"{user.Email} [{userId}]";
            customer.PlanId = planId;
            customer.SourceToken = stripeToken;
            customer.Quantity = 1;
            var customerService = new StripeCustomerService();
            StripeCustomer stripeCustomer = customerService.Create(customer);

I confirmed that all of those are passing their values properly to the customer object but, I get the error in the title. What am I missing?

Upvotes: 3

Views: 3056

Answers (1)

Alex Rohr
Alex Rohr

Reputation: 277

ugh... I am an idiot... I was missing a line to set my API secret key like so:

StripeConfiguration.SetApiKey(StripePrivateKey);

Upvotes: 6

Related Questions