Search code examples
stripe-paymentslaravel-6laravel-cashier

Stripe payment charge


I want to charge payment using paymentMethod as a source but it does not charge, how do I get token as the source using payment method? I tried to charge using

\Stripe\Stripe::setApiKey('sk_test_**************');
\Stripe\Charge::create([
    'amount' => $menuPrice*100,
    'currency' => 'usd',
    'customer' => $user->stripe_id,
    'source' => 'pm_*************'
]);

Solution

  • Charges are the older way of doing this; the new way is Payment Intents (with Payment Methods). You can find out about the differences here: https://stripe.com/docs/payments/payment-intents/migration