Php PayumBundle安全标头无效
我在symfony2中配置PayumBundle,但不起作用:) 我没有重定向到贝宝网站 我得到错误-'错误','付款失败'在哪里我可以找到一些信息 更新1 i foud错误:在变量转储中($status) 'L_SHORTMESSAGE0'=>字符串“安全错误”(长度=14) “L_LONGMESSAGE0'=>string”安全标头无效(长度=28) 当我在配置沙盒中关闭时,im重定向到paypal,但我没有填写金额、付款名称-如何配置它 我从这个例子中配置它 配置:Php PayumBundle安全标头无效,php,symfony,payum,Php,Symfony,Payum,我在symfony2中配置PayumBundle,但不起作用:) 我没有重定向到贝宝网站 我得到错误-'错误','付款失败'在哪里我可以找到一些信息 更新1 i foud错误:在变量转储中($status) 'L_SHORTMESSAGE0'=>字符串“安全错误”(长度=14) “L_LONGMESSAGE0'=>string”安全标头无效(长度=28) 当我在配置沙盒中关闭时,im重定向到paypal,但我没有填写金额、付款名称-如何配置它 我从这个例子中配置它 配置: payum:
payum:
security:
token_storage:
ed\partnerBundle\Entity\PayumSecurityToken:
doctrine:
driver: orm
contexts:
frei_payment:
paypal_express_checkout_nvp:
api:
options:
username: 'myusername'
password: 'mypass'
signature: 'mysing'
sandbox: true
storages:
ed\partnerBundle\Entity\PaymentDetails:
doctrine:
driver: orm
路由:
payment_start:
pattern: /payment
defaults: { _controller: edpartnerBundle:Payment:preparePaypalExpressCheckoutPayment }
edpartner_payment_done:
pattern: /payment/done
defaults: { _controller: edpartnerBundle:Payment:done }
付款控制器中的操作:
public function doneAction(){
$request = $this->getRequest();
$token = $this->get('payum.security.http_request_verifier')->verify($request);
$payment = $this->get('payum')->getPayment($token->getPaymentName());
$status = new BinaryMaskStatusRequest($token);
$payment->execute($status);
if ($status->isSuccess()) {
$this->getUser()->addCredits(100);
$this->getRequest()->getSession()->getFlashBag()->set(
'notice',
'Payment success. Credits were added'
);
} else if ($status->isPending()) {
$this->getRequest()->getSession()->getFlashBag()->set(
'notice',
'Payment is still pending. Credits were not added'
);
} else {
$this->getRequest()->getSession()->getFlashBag()->set('error', 'Payment failed');
}
return $this->redirect('homepage');
}
/**
*/
public function preparePaypalExpressCheckoutPaymentAction(){
$paymentName = 'my_payment';
$storage = $this->get('payum')->getStorageForClass(
'ed\partnerBundle\Entity\PaymentDetails',
$paymentName
);
/** @var \ed\partnerBundle\Entity\PaymentDetails $paymentDetails */
$paymentDetails = $storage->createModel();
$paymentDetails['PAYMENTREQUEST_0_CURRENCYCODE'] = 'USD';
$paymentDetails['PAYMENTREQUEST_0_AMT'] = 1.23;
$storage->updateModel($paymentDetails);
$captureToken = $this->get('payum.security.token_factory')->createCaptureToken(
$paymentName,
$paymentDetails,
'edpartner_payment_done' // the route to redirect after capture;
);
$paymentDetails['INVNUM'] = $paymentDetails->getId();
$paymentDetails['RETURNURL'] = $captureToken->getTargetUrl();
$paymentDetails['CANCELURL'] = $captureToken->getTargetUrl();
$storage->updateModel($paymentDetails);
return $this->redirect($captureToken->getTargetUrl());
}
我在浏览器中转到/payment url,im重定向到主页我在数据库中看到新记录-但我不付款-为什么我不重定向到paypal进行付款 发现错误时正常-这是沙盒错误-正常api键-不允许沙盒模式-
遗憾的是,bundle安装手册中没有对其进行描述,而且bundle不会引发任何异常,简单的重定向没有信息…在这里被多次询问。实际上,payum会将所有信息保存到您的详细信息模型中。您必须找到文本为“Security header invalid”的L_ERRORLONG0(类似于此)字段。遇到问题时,请检查详细信息。它必须包含payum可以从网关获取的所有详细信息。您可以检查此问题,例如: