【发布时间】:2017-01-03 21:05:27
【问题描述】:
我在尝试使用 laravel 配置 paypal 时遇到此错误
Paypalel.php 第 32 行中的 FatalErrorException:非抽象方法 App\Http\Controllers\Paypalel::getCheckout() 必须包含正文
这是代码:
public function getCheckout($title,$disc,$price);
{
// get the id of the product
$payer = PayPal::Payer();
$payer->setPaymentMethod('paypal');
$amount = PayPal:: Amount();
$amount->setCurrency('USD');
$amount->setTotal($price); // 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($disc);
$redirectUrls = PayPal:: RedirectUrls();
$redirectUrls->setReturnUrl(action('ProductController@getDone'));
$redirectUrls->setCancelUrl(action('ProductController@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 );
}
【问题讨论】: