[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())的光标后;它抛出了没有这样的客户的错误。
答案 0 :(得分:1)
您的代码看起来在语法上有效。为了调试这个,我首先验证customerId.ToString()的值,然后确认该客户确实存在于您的Stripe帐户中。
最佳, 拉里
PS我在Stripe的支持工作。