I have an ExpressCheckout up and running. Now I want to give the user the chance to make the payment at a later time. For example he closes the paypal process I keep data saved.
I guess this must be pretty straightforward but somehow it wont redirect me to paypal anymore. The only thing I did so far is to use the identifier to find an existing model instead of creating a new one. This part works so it'll find the specific record of the PaypalExpressPaymentDetails table. But as I said it wont redirect to paypal. Here is the code:
$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);
Executed Controller:
...
$identificator = new Identificator($entity->getId(), 'Demo\UserBundle\Entity\PaypalExpressPaymentDetails');
$captureToken = $this->payLateByPaypal($entity->getAmount(), "USD", $entity->getId(), $identificator);
return $this->redirect($captureToken->getTargetUrl());
Any ideas?