user1012181
user1012181

Reputation: 8726

Stripe payment went through even though the stripe card id was null

I'm trying to charge a customer's specific credit card using laravel.

I've tried this:

$charge = Charge::create([
                'amount' => $amount*100,
                'currency' => $currency,
                'card' => $stripe_card,
                'customer' => $customer_id
            ]);

But the payment is went through even though the card id $stripe_card was null. How can this happen? Is it taking the customer's default card?

Upvotes: 0

Views: 111

Answers (1)

Matthew Arkin
Matthew Arkin

Reputation: 4648

If $stripe_card was null, the Stripe API Library would not have sent the card property as part of the API call. If you do not specify a card id for the customer, the default card would be charged.

Upvotes: 2

Related Questions