Php Braintree\Configuration::需要设置merchantId(或者需要将accessToken传递给Braintree\Gateway)
现在我犯了错误Php Braintree\Configuration::需要设置merchantId(或者需要将accessToken传递给Braintree\Gateway),php,paypal,braintree,braintree-sandbox,Php,Paypal,Braintree,Braintree Sandbox,现在我犯了错误 Uncaught exception 'Braintree\Exception\Configuration' with message 'Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway). 问题是,若我的商户ID不是如何创建子商户的,因为我可以在仪表板中看到子商户帐户,但我要打电话 此方法: $webhookNo
Uncaught exception 'Braintree\Exception\Configuration' with message 'Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway).
问题是,若我的商户ID不是如何创建子商户的,因为我可以在仪表板中看到子商户帐户,但我要打电话
此方法:
$webhookNotification = Braintree\WebhookNotification::parse($sampleNotification['bt_signature'], $sampleNotification['bt_payload']);
上面说
Uncaught exception 'Braintree\Exception\Configuration' with message 'Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway).
充分披露:我在Braintree工作。如果您有任何进一步的问题,请随时联系
[支持][支持]
是所有Braintree API调用所需的API凭据,以及公钥和私钥。您可以在没有商户ID的情况下在仪表板中看到子管理员,因为我们的系统将您登录仪表板识别为有效身份验证,而不是依赖API凭据
当使用我们的SDK时,您需要。您可以通过以下操作找到帐户的API凭据。我们现在支持两者
班级级别示例
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');
$gateway = new Braintree_Gateway([
'environment' => 'sandbox',
'merchantId' => 'use_your_merchant_id',
'publicKey' => 'use_your_public_key',
'privateKey' => 'use_your_private_key'
]);
实例方法示例
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');
$gateway = new Braintree_Gateway([
'environment' => 'sandbox',
'merchantId' => 'use_your_merchant_id',
'publicKey' => 'use_your_public_key',
'privateKey' => 'use_your_private_key'
]);
我用拉威尔。在我的例子中,问题来自配置文件缓存。出于某些原因,Laravel无法从命令生成配置缓存:
php-artisan-config:cache
我解决了删除配置缓存的问题:
php artisan config:clear
但在我的例子中,真正的问题是Laravel配置缓存的生成
我希望它有用
更新
我的配置缓存没有工作,因为我没有将env()
帮助程序放在配置文件中,而是放在其他文件中(在我的例子中是:AppServiceProvider)。
在生产模式下,只能从配置文件调用.env参数
如果在部署期间使用config:cache命令,则必须
确保您只从内部调用env函数
配置文件,而不是来自应用程序中的任何其他位置