0

I'm trying to process a credit card payment and I get this error: Must provide source or customer.

I'm not sure what Stripe means by this and I've tried the solution posted here: Stripe: Must provide source or customer

public function store(Request $request)
    {
        try {
            $charge = Stripe::charges()->create([
                // 'amount' => getNumbers()->get('newTotal') / 100,
                'currency' => 'UK',
                'source' => $request->stripeToken,
                'description' => 'Thank you for your purchase.',
                'receipt_email' => $request->email,
                'customer' => $request->email, 
                'metadata' => [
                    // 'contents' => $contents,
                    'quantity' => Cart::count(),
                ],
            ]);

            Cart::destroy();

            return redirect()->route('confirmation.index')->with('success_message', 'Thank you! Your payment has been successfully accepted!');
        } catch (CardErrorException $e) {
            return back()->withErrors('Error! ' . $e->getMessage());
        }
    }

As you can see, I do have a source and a customer. If I change the $customer property to equal something like 'person', Stripe will return this: No such customer: person

What exactly am I doing wrong here?

EDIT: The library I'm using is cartalyst/stripe-laravel: https://github.com/cartalyst/stripe-laravel

Thanks

0 Answers0