我有一个 ExpressCheckout 正在运行。现在我想让用户有机会在以后付款。例如,他关闭了我保存数据的贝宝流程。
我想这一定很简单,但不知何故它不会再将我重定向到贝宝。到目前为止,我唯一做的就是使用标识符来查找现有模型,而不是创建新模型。这部分有效,因此它将找到 PaypalExpressPaymentDetails 表的特定记录。但正如我所说,它不会重定向到贝宝。这是代码:
$paymentName = 'demo_paypal';
$storage = $this->get('payum')->getStorageForClass(
'Demo\UserBundle\Entity\PaypalExpressPaymentDetails',
$paymentName
);
/** @var $paymentDetails PaymentDetails */
$paymentDetails = $storage->createModel();
$paymentDetails->setPaymentrequestCurrencycode(0, $currency);
$paymentDetails->setPaymentrequestAmt(0, $amount);
$storage->updateModel($paymentDetails);
$captureToken = $this->getTokenFactory()->createCaptureToken(
$paymentName,
$paymentDetails,
'payments_transaction_success'
);
$paymentDetails->setReturnurl($captureToken->getTargetUrl());
$paymentDetails->setCancelurl($captureToken->getTargetUrl());
$paymentDetails->setInvnum($paymentDetails->getId());
$storage->updateModel($paymentDetails);
执行控制器:
...
$identificator = new Identificator($entity->getId(), 'Demo\UserBundle\Entity\PaypalExpressPaymentDetails');
$captureToken = $this->payLateByPaypal($entity->getAmount(), "USD", $entity->getId(), $identificator);
return $this->redirect($captureToken->getTargetUrl());
有任何想法吗?