在asp.net上检索客户信息时,条带上没有此类客户“客户ID”错误

时间:2015-01-03 06:41:38

标签: asp.net-mvc-3 razor stripe-payments

   [HttpPost]
    public ActionResult getCustomerPaymentInfo(string firstName,string lastName,string email)
    {                
        string fullName = firstName +" "+ lastName;

   //fetch customerID from database.
        var customerId = (from cpi in db.CustomerPaymentInfoes 
                                   where cpi.FullName == fullName && cpi.Email == email
                                   select new { cpi.CustomerId }).Single();

   //retrieve customer details from stripe payment gateway.

        var customerService = new StripeCustomerService(); 

   //When cursor is passing from above line it throws the error 

        StripeCustomer stripeCustomer = customerService.Get(customerId.ToString()); 


   // return customer ID to View
        return Json(customerId, JsonRequestBehavior.AllowGet); 
      }   
  到达customerService.Get(customerId.ToString())的光标后

;它抛出了没有这样的客户的错误。

1 个答案:

答案 0 :(得分:1)

您的代码看起来在语法上有效。为了调试这个,我首先验证customerId.ToString()的值,然后确认该客户确实存在于您的Stripe帐户中。

最佳, 拉里

PS我在Stripe的支持工作。

相关问题