When trying to execute my code I always get the error:
Uncaught exception 'Braintree\Exception\Configuration' with message 'Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway)
The error occurs at:
Braintree\Transaction::sale(Array) #4 {main} thrown in /braintree_folder/lib/Braintree/Configuration.php on line 260
My PHP Code is:
<?php
require 'lib/Braintree.php';
$gateway = new Braintree_Gateway([
'environment' => 'sandbox',
'merchantId' => '*********',
'publicKey' => '********',
'privateKey' => '*********'
]);
$paymentMethodNonce = $_POST['payment_method_nonce'];
$amount = $_POST['amount'];
$result = Braintree_Transaction::sale([
'amount' => $amount,
'paymentMethodNonce' => $paymentMethodNonce,
'options' => [
'submitForSettlement' => True
]
]);
echo json_encode($result);
?>
Could you tell me what I have to change?