设置 Braintree 以使用 Laravel 管理付款

发布于 2025-01-12 06:26:54 字数 714 浏览 3 评论 0原文

我正在尝试设置 Braintree 来管理 Laravel 中的付款,但我遇到了很大的困难。 我尝试通过在 Laravel 中的 AppServiceProvider 中设置网关来遵循在线教程。

问题是我仍然遇到未定义类型 Braintree\Gateway 的错误,尽管我已经安装了 SDK:

composer require braintree/braintree_php

这是我的代码:

$this->app->singleton(Gateway::class, function($app){
        return new Gateway(
            [
                'enviroment' => 'sandbox',
                'merchantId'=> 'fcbw9x3mcdzygrq8',
                'publicKey' => 'bgzxhtjd5zfhh7fn',
                'privateKey' => 'f55752441b22915c8c10b437a3e4376d'
            ]
            );
    });

我什至使用以下命令导入它:

use Braintree\Gateway;

我做错了什么?

I am trying to set up Braintree to manage payments in Laravel, and I am having a really hard time.
I tried to follow a tutorial online by setting the gateway in AppServiceProvider in Laravel.

The problem is that I continue to have an error with undefined type Braintree\Gateway although i already installed the SDK with:

composer require braintree/braintree_php

This is my code:

$this->app->singleton(Gateway::class, function($app){
        return new Gateway(
            [
                'enviroment' => 'sandbox',
                'merchantId'=> 'fcbw9x3mcdzygrq8',
                'publicKey' => 'bgzxhtjd5zfhh7fn',
                'privateKey' => 'f55752441b22915c8c10b437a3e4376d'
            ]
            );
    });

I even imported it with:

use Braintree\Gateway;

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文