【问题标题】:Stripe.Net Create and Update userStripe.Net 创建和更新用户
【发布时间】:2015-04-11 02:55:13
【问题描述】:

我对编程和条带非常陌生。我目前正在尝试创建一个基本页面,我可以在其中创建客户。我目前使用的是 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);

        }


    }

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

【问题讨论】:

    标签: c# stripe-payments stripe.net


    【解决方案1】:

    我猜你正在使用这个: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 存在于您的配置文件中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-19
      • 2016-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-12
      • 1970-01-01
      相关资源
      最近更新 更多