0

I started today Stripe in Laravel 6. I used below code and ran it two times.

$stripeCustomer = $this->User->createOrGetStripeCustomer();

As per the instructions here same user can't be created two times but after running the code 2 times, it created the duplicate customer.

Please check the screenshot below.

Can I delete the customer from stripe? I saw the Laravel library. But seems like there is no delete stripe customer function in cashier

enter image description here

Am I missing anything? Why did it create the duplicate customer?

Pankaj
  • 9,749
  • 32
  • 139
  • 283
  • This can help you? https://stackoverflow.com/questions/29222249/stripe-api-checking-for-existing-card – STA Jun 14 '20 at 18:22
  • use `email` as a `unique` – A.A Noman Jun 14 '20 at 18:37
  • Email is already a unique column. When I added first time, It created the customer as well as the customer in stripe but after that I rollback the transaction. In this way the customer created in database gets deleted automatically and lives only in stripe. When I repeat the same process, it create the duplicate customer in stripe. Are you following my point? – Pankaj Jun 14 '20 at 18:45
  • Email isn't a unique constraint in Stripe, so this is something specific to Cashier - and I'm unfortunately not sure what the problem is as I'm not familiar enough with Cashier. – floatingLomas Jun 15 '20 at 01:40

0 Answers0