我用于获取交易状态的代码。...客户端ID和机密相同,并且在PayPal仪表板中交易成功,并且此函数中使用的所有变量都不为空,并且这些都是准确的< / p>
$paymentId = Session::get('paypal_payment_id');
/** clear the session payment ID **/
Session::forget('paypal_payment_id');
$payment = Payment::get($paymentId, $this->_api_context);
$execution = new PaymentExecution();
$payer_id=$request->input('PayerID');
$execution->setPayerId($payer_id);
$result = $payment->execute($execution, $this->_api_context);
if ($result->getState() == 'approved') {
\Session::put('success', 'Payment success');
return Redirect::route('success');
}
\Session::put('error', 'Payment failed');
return Redirect::route('failed');
答案 0 :(得分:0)
$paymentId = Session::get('paypal_payment_id');
Session::forget('paypal_payment_id');
$payment = Payment::get(Session::get('paypal_payment_id').....
由于您忘记了会话变量,因此最后一行应该是
$payment = Payment::get($paymentId.....
图片中AUTHENTICATION_FAILURE
响应的其他可能原因包括:
如果仍然有问题,请使用其他工具(例如curl或Postman)进行测试,并: