- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在 https://packagist.org/packages/netshell/paypal 中进行了所有配置用paypal付款但是我有这个错误
FatalErrorException in paywithpaypal.php line 15: Class 'App\Http\Controllers\PayPal' not found
这是代码
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use PayPal;
use Redirect;
use App\Http\Requests;
class paywithpaypal extends Controller {
private $_apiContext;
public function __construct()
{
$this->_apiContext = PayPal::ApiContext(
config('services.paypal.client_id'),
config('services.paypal.secret'));
$this->_apiContext->setConfig(array(
'mode' => 'sandbox',
'service.EndPoint' => 'https://api.sandbox.paypal.com',
'http.ConnectionTimeOut' => 30,
'log.LogEnabled' => true,
'log.FileName' => storage_path('logs/paypal.log'),
'log.LogLevel' => 'FINE'
));
}
public function getCheckout() {
$payer = PayPal::Payer();
$payer->setPaymentMethod('paypal');
$amount = PayPal:: Amount();
$amount->setCurrency('EUR');
$amount->setTotal(42); // This is the simple way,
// you can alternatively describe everything in the order separately;
// Reference the PayPal PHP REST SDK for details.
$transaction = PayPal::Transaction();
$transaction->setAmount($amount);
$transaction->setDescription('What are you selling?');
$redirectUrls = PayPal:: RedirectUrls();
$redirectUrls->setReturnUrl(action('paywithpaypal@getDone'));
$redirectUrls->setCancelUrl(action('paywithpaypal@getCancel'));
$payment = PayPal::Payment();
$payment->setIntent('sale');
$payment->setPayer($payer);
$payment->setRedirectUrls($redirectUrls);
$payment->setTransactions(array($transaction));
$response = $payment->create($this->_apiContext);
$redirectUrl = $response->links[1]->href;
return Redirect::to( $redirectUrl ); }
public function getDone(Request $request) {
$id = $request->get('paymentId');
$token = $request->get('token');
$payer_id = $request->get('PayerID');
$payment = PayPal::getById($id, $this->_apiContext);
$paymentExecution = PayPal::PaymentExecution();
$paymentExecution->setPayerId($payer_id);
$executePayment = $payment->execute($paymentExecution, $this->_apiContext);
// Clear the shopping cart, write to database, send notifications, etc.
// Thank the user for the purchase
return view('checkout.done'); }
public function getCancel() {
// Curse and humiliate the user for cancelling this most sacred payment (yours)
return view('checkout.cancel'); } }
最佳答案
你一定没有添加
'aliases' => array(
// ...
'Paypal' => 'Netshell\Paypal\Facades\Paypal',
)
到 aliases
数组中的 app/config/app.php
,如 docs 中所述.
另外,你可以尝试换行
use PayPal;
到
use Netshell\Paypal\Facades\Paypal;
在您的 paywithpaypal
Controller 中。
关于php - netshell paypal配置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39181399/
我在 https://packagist.org/packages/netshell/paypal 中进行了所有配置用paypal付款但是我有这个错误 FatalErrorException in p
因此,在使用 Laravel 执行 composer update 后,我的 Netshell/Paypal 包似乎出现问题。并且在 checkout Paypal 交易时未按预期运行。 错误似乎发生
我在尝试使用 laravel 配置 paypal 时出现此错误 FatalErrorException in Paypalel.php line 32: Non-abstract method App
在 netshell 中,我们使用这样的东西: http add urlacl url=https://+:{0}/ user={1} 我需要在 Powershell 或 netsh 以外的任何工具中
我是一名优秀的程序员,十分优秀!