将数据传递到控制器的最安全方法?

时间:2015-06-13 07:37:05

标签: laravel laravel-5

我将PayPal整合到我的Laravel 5网站中。

我有这个功能:

public function getCheckout() {
    $payer = PayPal::Payer();
    $payer->setPaymentMethod('paypal');

    return Input::all();
    $amount = PayPal:: Amount();
    $amount->setCurrency('USD');
    $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('Bid Purchase');

    $redirectUrls = PayPal:: RedirectUrls();
    $redirectUrls->setReturnUrl(action('PayPalController@getDone'));
    $redirectUrls->setCancelUrl(action('PayPalController@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);
}

我希望能够在转到setTotal之前选择getCheckout()金额。

这样做最安全的方法是什么,这样价值才能被篡改?

由于

0 个答案:

没有答案