由于某种原因,PayPal没有收到我分配给交易的总价。
我正在使用NetShell的PayPal模块。
我的控制器看起来像这样:
class PayPalController 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('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('What are you selling?');
$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 );
}
// Other functions here. Removed for question.
}
getCheckout()
在路线`/ paypal / checkout'
当我去/paypal/checkout
时没有价格。
我错过了什么吗?任何帮助,将不胜感激。
谢谢!
答案 0 :(得分:0)
它可能与价格类型有关。价格必须以浮动方式声明。 尝试,
THREE.AmbientLight
然后检查一下,我写了关于将paypal express集成到laravel,