Php Braintree iOS:致命错误';Braintree#u配置';找不到
我想在我的iOS应用程序中集成Braintree支付。为此,我安装了以下composer composer文件夹是在本地创建的,我已将其放在服务器上 但是,当我运行Php Braintree iOS:致命错误';Braintree#u配置';找不到,php,ios,braintree,Php,Ios,Braintree,我想在我的iOS应用程序中集成Braintree支付。为此,我安装了以下composer composer文件夹是在本地创建的,我已将其放在服务器上 但是,当我运行payAmountUsingBraintree.php文件时,我得到以下错误: 致命错误:未找到类“Braintree\u配置” 使用BrainTree.php支付金额的内容 <?php //include '../config.php'; include 'db_config.php'; require_once 'v
payAmountUsingBraintree.php
文件时,我得到以下错误:
致命错误:未找到类“Braintree\u配置”
使用BrainTree.php支付金额的内容
<?php
//include '../config.php';
include 'db_config.php';
require_once 'vendor/autoload.php';
//echo 'Current PHP version: ' . phpversion();
$PartnerId = $_POST["PartnerId"];
$nonce = $_POST["Nonce"];
$amount = $_POST["Amount"];
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$SaveCard = $_POST["SaveCard"];
$number = $_POST["CardNumber"];
$postal_code = $_POST["postal_code"];
$CVV = $_POST["CVV"];
$MerchantAccountId = '';
$IsAvailable = 'no';
Braintree_Configuration::environment('sandbox'); // get error on this line
Braintree_Configuration::merchantId('2qyx6qtd9bvy82r');
Braintree_Configuration::publicKey('c9qvxk3nvhmd68b');
Braintree_Configuration::privateKey('6f8ca01bd95cc0c753e936148303de4');
我知道有点晚了。但是,让我为将来的读者添加这个解决方案,他们可能会在集成PHP技术以获取客户端令牌的同时寻找类似的解决方案 您需要先设置先决条件
- 需要PHP版本>=5.4.0
- 卷曲
- 多姆
- 散列
- openssl
- xmlwriter
<?php
require_once 'PATH_TO_BRAINTREE/lib/Braintree.php';
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('your_merchant_id');
Braintree_Configuration::publicKey('your_public_key');
Braintree_Configuration::privateKey('your_private_key');
$result = Braintree_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());
}
我也有这个问题。只有成功包含Braintree.php后,才会出现此错误。但是另一个文件,即Braintree.php/configuration.php,不包含在autoload.php中
这是一个无效的目录路径错误
您想在$file\u name中使用精确的目录分隔符,并更改
$fileName=dirname(\uuuu DIR\uuuu)。'/lib/'代码>
到
$fileName=dirname(\uuu DIR\uuu)。目录分隔符。'paypal'。目录分隔符代码>
我已经使用贝宝作为目录。所以你想怎么改就怎么改。如果出现同样的错误,请尝试打印完整的$filename,并更正目录路径。我在Braintree工作。对不起,我们没有回答你的问题。如果你已经解决了这个问题,你能发布一个答案并让我知道吗?否则,我建议你;他们会帮忙的。