本文整理汇总了PHP中PayPal::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP PayPal::getById方法的具体用法?PHP PayPal::getById怎么用?PHP PayPal::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PayPal
的用法示例。
在下文中一共展示了PayPal::getById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: done
public function done(Request $request)
{
$id = $request->get('paymentId');
$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.
$request->session()->pull('likes', []);
return view('Main/index');
}
示例2: getDone
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);
\Cart::clear();
return view('frontend.checkout.done')->with('categories', Category::all())->with('pay', $executePayment);
}
示例3: getDone
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('register');
}
示例4: done
/**
* Done
*/
public function done(Request $request)
{
//je recupere les informations de retour de Paypal
$id = $request->get('paymentId');
$token = $request->get('token');
$payer_id = $request->get('PayerID');
$payment = PayPal::getById($id, $this->_apiContext);
$paymentExecution = PayPal::PaymentExecution();
//execution du paiment a partir du Payer
//Requete à Paypal: débit du montant de a transaction au Payer
$paymentExecution->setPayerId($payer_id);
$executePayment = $payment->execute($paymentExecution, $this->_apiContext);
// Clear the shopping cart,
$request->session()->pull('likes', []);
// Write database
// Thank the user for the purchase
return view('Cart/success');
}
示例5: getAgencyPaymentDone
public function getAgencyPaymentDone(Request $request)
{
if (!\Session::has('_temp_payment_sess')) {
return redirect(url('agency'))->with('flashMessage', ['class' => 'danger', 'message' => 'Your session has expired, please try again.']);
}
$data = session('_temp_payment_sess');
$id = $request->get('paymentId');
$token = $request->get('token');
$payer_id = $request->get('PayerID');
$payment = PayPal::getById($id, $this->paypalApiContext);
$paymentExecution = PayPal::PaymentExecution();
$paymentExecution->setPayerId($payer_id);
$executePayment = $payment->execute($paymentExecution, $this->paypalApiContext);
$agency = \Agency::getAgency();
try {
switch ($data['type']) {
case 'credit':
\Agency::updateCredit($agency, $data['xCreditAmount']);
break;
case 'contract':
\Agency::updateVIP($agency, true);
break;
default:
break;
}
session(['_sess_agency' => ['model' => $agency]]);
\Session::forget('_temp_payment_sess');
} catch (\Exception $e) {
// TODO: Need better error handler
// re-run try with queue?
\Session::forget('_temp_payment_sess');
return redirect(url('agency'))->with('flashMessage', ['class' => 'danger', 'message' => $e->getMessage()]);
}
return redirect(url('agency'))->with('flashMessage', ['class' => 'success', 'message' => $data['successMessage']]);
}