Hello I try to set up a braintree payement on my website but I have an error when i create my Transaction sale : Unknown paymentMethodNonce. I generate a client token like an example from Braintree support (They sand me a mail with an example) :
<?php
require_once("../lib/Braintree.php");
$clientToken = Braintree_ClientToken::generate(); ?>
...
<script>
var clientToken = "<?php echo $clientToken; ?>";
braintree.setup(clientToken, "dropin", {
container: "payment-form"
});
</script>
And on my checkout page :
require_once("../lib/Braintree.php");
$nonce = $_POST["payment_method_nonce"];
$result = Braintree_Transaction::sale([
'amount' => "100",
'paymentMethodNonce' => $nonce,
'options' => [
'submitForSettlement' => True
]
]);
I try to remove configuration line, it's work but the account merchant is not mine and if I set up the account in sale with :
'merchantAccountId' => 'MyAccount',
or to configure before :
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('xxx');
Braintree_Configuration::publicKey('xxx');
Braintree_Configuration::privateKey('xxxxx');
But I have an error : Exception need to be catch .
Thanks for your help