Vicky Gill
Vicky Gill

Reputation: 734

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:

$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).

Upvotes: 4

Views: 11936

Answers (2)

Alessandro
Alessandro

Reputation: 575

I use 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.

I solved deleting config cache:

php artisan config:clear

But the real problem in my case was Laravel config cache generation.

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). In production mode the .env parameters must be called only from config files..

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.

Upvotes: 0

Lairen
Lairen

Reputation: 551

Full disclosure: I work at Braintree. If you have any further questions, feel free to contact [support][support]

The merchant ID is a required API credential for all Braintree API Calls, along with with the public and private key. 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.

When using our SDKs, you will need to set up your API Credentials appropriately. You can find the API Credentials for your account by following the instructions in our documentation. 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'
]);

Upvotes: 2

Related Questions