【问题标题】:Error with getCheckout function in netshel paypalnetshel paypal 中的 getCheckout 函数出错
【发布时间】: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 );
}

【问题讨论】:

    标签: php laravel paypal


    【解决方案1】:

    有一个分号;

    public function getCheckout($title,$disc,$price); {
                                                    ^
    

    删除那个

    public function getCheckout($title,$disc,$price) {
    

    【讨论】:

      猜你喜欢
      • 2017-01-03
      • 2020-04-02
      • 2015-01-10
      • 2018-12-25
      • 1970-01-01
      • 2015-04-22
      • 2017-10-07
      • 2014-07-11
      • 2016-11-07
      相关资源
      最近更新 更多