StripeException:无效 API 提供的密钥:Stripe.Net
StripeException: Invalid API Key provided: Stripe.Net
我的程序成功创建了一个令牌并传递了它。然后它为 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);
我确认所有这些都正确地将它们的值传递给了客户object但是,我在标题中发现了错误。我错过了什么?
呃...我是个白痴...我错过了一行来设置我的 API 密钥,如下所示:
StripeConfiguration.SetApiKey(StripePrivateKey);
我的程序成功创建了一个令牌并传递了它。然后它为 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);
我确认所有这些都正确地将它们的值传递给了客户object但是,我在标题中发现了错误。我错过了什么?
呃...我是个白痴...我错过了一行来设置我的 API 密钥,如下所示:
StripeConfiguration.SetApiKey(StripePrivateKey);