我是编程新手,也是stripe新手。我目前正在尝试创建一个基本的页面,在那里我可以只创建客户。我现在使用的是stripe.net动态链接库,我很难让这个页面正常工作。这是我所拥有的。我没有收到任何错误,也没有创建任何记录。
使用条带;
private StripeCustomer GetCustomer()
{
var mycust = new StripeCustomerCreateOptions();
mycust.Email = "thisisit@overhere.com";
mycust.Description = "One Time";
mycust.CardName = "Full Name";
var customerservice = new StripeCustomerService(System.Web.Configuration.WebConfigurationManager.AppSettings["StripeApiKey"]);
return customerservice.Create(mycust);
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
StripeCustomer current = GetCustomer();
var mycharge = new StripeChargeCreateOptions();
string key = System.Web.Configuration.WebConfigurationManager.AppSettings["StripeApiKey"];
Response.Redirect("/services/donate/thanks.aspx");
}
catch (StripeException ex)
{
//lblerror.Text = (ex.Message);
}
}还有一点帮助(因为我迷路了,我试过了),关于我将如何去拉出我当前拥有的海关列表并展示它们,那将是很棒的。
发布于 2015-02-11 09:04:12
我猜你在用这个:https://github.com/jaymedavis/stripe.net#list-all-customers
在您的GetCustomer方法中,您正在创建一个客户,相反,您希望执行以下操作:
private IEnumerable<StripeCustomer> GetCustomers()
{
var customerservice = new StripeCustomerService(System.Web.Configuration.WebConfigurationManager.AppSettings["StripeApiKey"]);
return customerservice.List();
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
StripeCustomer list = GetCustomers();
//show this list somewhere
}
catch (StripeException ex)
{
//lblerror.Text = (ex.Message);
}
}确保StripeApiKey存在于您的配置文件中。
https://stackoverflow.com/questions/28442452
复制相似问题