Uttam
Uttam

Reputation: 25

no such customer "customer ID" error on stripe when retriving customer information on asp.net

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

after reaching the cursor at the customerService.Get(customerId.ToString()); it throw the error that no such customer.

Upvotes: 0

Views: 1304

Answers (1)

Larry Ullman
Larry Ullman

Reputation: 2271

Your code looks to be syntactically valid. To debug this, I'd start by verifying the value of customerId.ToString() and then confirm that this customer does exist in your Stripe account.

Best, Larry

PS I work on Support at Stripe.

Upvotes: 1

Related Questions