Search code examples
phppaypalbraintreebraintree-sandbox

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

Solution

  • 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'
    ]);