我试图在Laravel 5.4上使Paymain Wall的API工作,但我无法设置。
我将其直接添加到根文件夹文件夹结构Sense中,文档表示需要将其添加到我构建的应用程序中。我还尝试设置我的root composer.json这样:
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\": "app/",
"Paymentwall\": "paymentwall-php-master/paymentwall-php-master/lib"
}
},
dmblauto 我称之为itlike t
namespace AppHttpControllers;
使用Paymentwall;
使用照明 http request;CheckoutController扩展控制器{
public static function checkout(){
return view('rent.checkout.checkout');
}
public function paymentDrive(request $request){
Paymentwall_Config::getInstance()->set(array(
'private_key' => 'xxxxxxxx'
));
echo print_r($_POST, true);
$cardInfo = array(
'email' =>'iwds.rheman@gmail.com',
'amount' => 10,
'currency' => 'USD',
'token' => $_POST['brick_token'],
'fingerprint' => $_POST['brick_fingerprint'],
'description' => 'Order #123'
);
$charge = new Paymentwall_Charge();
$charge->create($cardInfo);
$response = $charge->getPublicData();
if ($charge->isSuccessful()) {
if ($charge->isCaptured()) {
// deliver s product
} elseif ($charge->isUnderReview()) {
// decide on risk charge
}
} else {
$errors = json_decode($response, true);
}
echo $response;
}
}
,但我仍会遇到此错误Class 'AppHttpControllersPaymentwall_Config' not found
我真的很想了解这是如何完成的。 btw 此API软件包使用不同的文件夹结构,使我感到困惑。
您应该运行:
composer require paymentwall/paymentwall-php
在您的控制台中,这应该是所有内容(您不必手动复制包装文件(。
您不需要为此手动更新composer.json
。该库可在Packagist上找到:https://packagist.org/packages/paymentwall/paymentwall/paymentwall-php