Stripe billing class not found - Laravel

时间:2015-05-24 21:49:08

标签: php laravel-4 stripe-payments

I have added the Stripe library to my composer.json file, ran all commands just to check... update, dump-autoload etc.

In my classmap file the library is shown:

'Stripe\\Account' => $vendorDir . '/stripe/stripe-php/lib/Account.php',

and so on...

In my app folder i have my classes folder etc:

app
  motivate
    Billing
      BillingInterface.php
      StripeBilling.php

In my StripeBilling file I reference Stripe like so:

<?php

namespace Motivate\Billing;

class StripeBilling implements BillingInterface
{
  public function __construct()
  {
    Stripe::setApiKey(Config::get('stripe.secret_key'));
  }

This throws the error:

Class 'Motivate\Billing\Stripe' not found

So my next thought was:

use \Stripe as Stripe;

Which returns class Stripe not found.

Where is this going wrong? Thanks :)

1 个答案:

答案 0 :(得分:2)

According to the documentation:

To use your API key, you need only call \Stripe\Stripe::setApiKey() with your key. The PHP library will automatically send this key in each request.

So, just try using use \Stripe\Stripe as Stripe; instead.