简体   繁体   English

需要设置Braintree\Configuration::merchantId(或者需要将accessToken传给Braintree\Gateway)

[英]Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway)

Now I got Error现在我得到了错误

Uncaught exception 'Braintree\Exception\Configuration' with message 'Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway).

Question is that if my merchant ID is not how its creating sub merchant because i able to see sub merchant account in my dashboard but i am going to call this method:问题是,如果我的商户 ID 不是它创建子商户的方式,因为我可以在我的仪表板中看到子商户帐户,但我将调用此方法:

$webhookNotification = Braintree\WebhookNotification::parse($sampleNotification['bt_signature'], $sampleNotification['bt_payload']);

it says它说

Uncaught exception 'Braintree\Exception\Configuration' with message 'Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway).

Full disclosure: I work at Braintree.全面披露:我在布伦特里工作。 If you have any further questions, feel free to contact [support][support]如果您有任何其他问题,请随时联系[support][support]

The merchant ID is a required API credential for all Braintree API Calls, along with with the public and private key. 商家 ID是所有 Braintree API 调用所需的 API 凭据,连同公钥和私钥。 You are able to see submerchants in your dashboard without the merchant ID because our system recognizes your login to the Dashboard as valid authentication instead of relying on the API Credentials.您可以在没有商户 ID 的情况下在仪表板中看到子商户,因为我们的系统将您登录仪表板视为有效身份验证,而不是依赖于 API 凭据。

When using our SDKs, you will need to set up your API Credentials appropriately .使用我们的 SDK 时,您需要适当地设置 API 凭据 You can find the API Credentials for your account by following the instructions in our documentation .您可以按照我们文档中的说明找到您帐户的 API 凭据。 We now support both class level and instance methods .我们现在支持类级别和实例方法

Class Level Example类级别示例

Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('use_your_merchant_id');
Braintree_Configuration::publicKey('use_your_public_key');
Braintree_Configuration::privateKey('use_your_private_key');

Instance Method Example实例方法示例

$gateway = new Braintree_Gateway([
    'environment' => 'sandbox',
    'merchantId' => 'use_your_merchant_id',
    'publicKey' => 'use_your_public_key',
    'privateKey' => 'use_your_private_key'
]);

I use Laravel.我使用 Laravel。 In my case, the problem was from Config file Cache.就我而言,问题出在配置文件缓存中。 For some reason Laravel not generate the config cache from command: php artisan config:cache .出于某种原因,Laravel 不会从命令生成配置缓存: php artisan config:cache

I solved deleting config cache:我解决了删除配置缓存:

php artisan config:clear

But the real problem in my case was Laravel config cache generation.但在我的案例中,真正的问题是 Laravel 配置缓存生成。

I hope it's useful.我希望它有用。

UPDATE更新

My config cache not worked because I put the env() helper NOT in the configuration files, but in others (in my case: AppServiceProvider).我的配置缓存不起作用,因为我没有将env()助手放在配置文件中,而是放在其他文件中(在我的例子中:AppServiceProvider)。 In production mode the.env parameters must be called only from config files..在生产模式下,.env 参数只能从配置文件中调用。

If you are using the config:cache command during deployment, you must make sure that you are only calling the env function from within your configuration files, and not from anywhere else in your application.如果在部署期间使用 config:cache 命令,则必须确保仅从配置文件中调用 env 函数,而不是从应用程序的其他任何地方调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM