Class ‘Stripe’ not found — Laravel

  laravel, stripe-payments

I’ve run command ‘composer require stripe/stripe-php’

I am getting this error —- Class ‘Stripe’ not found.

Here’s my controller-

namespace AppHttpControllers;
use IlluminateHttpRequest;
use Validator;
class StripeController extends Controller
{
    public function stripePost(Request $request)
    {
        StripeStripe::setApiKey ( 'sk_test_51IqDEDyMvZ4TU4ArtfN0olk7c9oXEGgATFIueO8SIEmrTv3vZFEMgBXOy4wNNCCSA4lueR84PyEwbzpp6W2QW' );
    try {
        StripeCharge::create ( array (
                "amount" => $request->amount * 100,
                "currency" => "usd",
                "source" => $request->input ( 'stripeToken' ), // obtained with Stripe.js
                "description" => "Test payment." 
        ) );
        Session::flash ( 'success-message', 'Payment done successfully !' );
        return Redirect::back ();
    } catch ( Exception $e ) {
        Session::flash ( 'fail-message', "Error! Please Try again." );
        return Redirect::back ();
    }
}

Source: Laravel

Leave a Reply