Jak zapobiec dodaniu duplikatu karty do paska za pomocą Laravel

public function checkBankingDetailsAlert()
  {
    $user = Auth::user();
    $stripe = new \Stripe\StripeClient(env('STRIPE_SECRET'));
    $cards = $stripe->paymentMethods->all(['customer' => $user->stripe_customer_id, 'type' => 'card']);
    $fingerprints = [];
    foreach ($cards as $card) {
       $fingerprint = $card['card']['fingerprint'];
        if (in_array($fingerprint, $fingerprints, true)) {
          $stripe->paymentMethods->detach($card['id']);
       } else {
         $fingerprints[] = $fingerprint;
       }
    }
    return response()->json([
      'status' => 'Success',
      'fingerprint' => $fingerprints,
    ]);
  }
 
Cruel Cottonmouth