paypal - Braintree integration

shanthini
Contributor
Contributor

I just started Braintree integration for one of our client. I am now checking with sandbox.

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

Login to Me Too
1 REPLY 1

MTS_Justin
Moderator
Moderator

Hello,

 

There was another user with the same issue in this thread where a solution was provided


Was my post helpful? If so, please give me a kudos!
Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.