简体   繁体   中英

Fatal Error: Uncaught Braintree Exception in PHP

I am using XAMPP latest version for mac and I am trying from this site https://www.appcoda.com/braintree-ios-integration/

PHP code is

<?php
require 'vendor/autoload.php';

Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('**********');
Braintree_Configuration::publicKey('**********');
Braintree_Configuration::privateKey('************');

// Get the credit card details submitted by the form
$paymentMethodNonce =  $_POST['payment_method_nonce'];
echo $paymentMethodNonce;

$amount = $_POST['amount'];
echo $amount;

$result = Braintree_Transaction::sale([
  'amount' => $amount,
  'paymentMethodNonce' => $paymentMethodNonce,
  'options' => [
    'submitForSettlement' => True
  ]
]);

echo json_encode($result);
?> 

Why am I getting this error? I didn't understand from this site braintreegateway Uncaught exception

Fatal error: Uncaught Braintree\\Exception\\SSLCertificate: Couldn't resolve host 'api.sandbox.braintreegateway.com' in /opt/lampp/htdocs/donate/vendor/braintree/braintree_php/lib/Braintree/Http.php:168 Stack trace: #0 /opt/lampp/htdocs/donate/vendor/braintree/braintree_php/lib/Braintree/Http.php(99): Braintree\\Http->_doUrlRequest('POST', ' https://api.san ...', '_doRequest('POST', '/merchants/fxd6...', 'post('/merchants/fxd6...', Array) #3 /opt/lampp/htdocs/donate/vendor/braintree/braintree_php/lib/Braintree/TransactionGateway.php(48): Braintree\\TransactionGateway->_doCreate('/transactions', Array) #4 /opt/lampp/htdocs/donate/vendor/braintree/braintree_php/lib/Braintree/TransactionGateway.php(290): Braintree\\TransactionGateway->create(Array) #5 /opt/lampp/htdocs/dona in /opt/lampp/htdocs/donate/vendor/braintree/braintree_php/lib/Braintree/Http.php on line 168

Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support .

The error you are seeing is due to the fact that your server is not using TLSv1.2. As of December 13, 2016, we are no longer accepting connections using SSL (any version), TLSv1.0, or TLSv1.2 for the Sandbox environment. You can find more information about this change in our blog post . These changes will affect our Production environment soon as well.

To find the OpenSSL information for cURL, run:

php -r 'echo json_encode(curl_version(), JSON_PRETTY_PRINT);'

You can take a look at the PayPal Guideline for updating your SSL/TSL libraries and information for updating the OpenSSL version on your machine as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM