0

我对编程很陌生,对条纹很陌生。我目前正在尝试创建一个基本页面,我可以在其中创建客户。我目前使用的是 stripe.net dll,我很难让这个页面正常工作。这就是我所拥有的。我没有收到任何错误,也没有创建任何记录。

使用条纹;

 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);

        }


    }

还有一点帮助(因为我失去了我尝试的任何东西)关于我将如何拉出我拥有的当前习俗的清单并展示它们会很棒。

4

1 回答 1

0

我猜你正在使用这个: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);

    }
}

Makre 确定StripeApiKey存在于您的配置文件中。

于 2015-02-11T01:04:12.267 回答