未找到条纹计费 class - Laravel

Stripe billing class not found - Laravel

我已将 Stripe 库添加到我的 composer.json 文件中,运行 所有命令只是为了检查...更新、转储自动加载等

在我的 classmap 文件中,库显示为:

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

等等...

在我的应用程序文件夹中有我的 classes 文件夹等:

app
  motivate
    Billing
      BillingInterface.php
      StripeBilling.php

在我的 StripeBilling 文件中,我这样引用 Stripe:

<?php

namespace Motivate\Billing;

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

这会引发错误:

Class 'Motivate\Billing\Stripe' not found

所以我的下一个想法是:

use \Stripe as Stripe;

未找到 returns class 条带。

这是哪里出错了?谢谢:)

根据 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.

因此,请尝试使用 use \Stripe\Stripe as Stripe;