I just started Braintree integration for one of our client. I am now checking with sandbox.
I am using the sample script as below
<?php
require_once './lib/Braintree.php';
// Instantiate a Braintree Gateway either like this:
$gateway = new Braintree_Gateway([
'environment' => 'sandbox',
'merchantId' => 'xxxxxxxxxxxxxxxx',
'publicKey' => 'xxxxxxxxxxxx',
'privateKey' => 'xxxxxxxxxxxxxxxxxxxxxxxx'
]);
$result = $gateway->transaction()->sale([
'amount' => '1000.00',
'paymentMethodNonce' => 'nonceFromTheClient',
'options' => [ 'submitForSettlement' => true ]
]);
if ($result->success) {
print_r("success!: " . $result->transaction->id);
} else if ($result->transaction) {
print_r("Error processing transaction:");
print_r("\n code: " . $result->transaction->processorResponseCode);
print_r("\n text: " . $result->transaction->processorResponseText);
} else {
print_r("Validation errors: \n");
print_r($result->errors->deepAll());
}
?>
2. But while executing this script this shows below error.
91565 - Unknown or expired paymentMethodNonce
3. Could you please suggest whether I need to generate ‘nonceFromTheClient' and need to include
If yes, how
Thanks
... View more