public function preparePaypalExpressCheckoutPaymentAction(Request $request, Formule $formule) { $user = $this->getUser(); $paymentName = 'paypal_payment'; $storage = $this->get('payum')->getStorage('challenge\\PaymentBundle\\Entity\\Orders'); /** @var $paymentDetails Orders */ $paymentDetails = $storage->create(); $paymentDetails->setNumero(uniqid()); $paymentDetails->setcurrencyCode('EUR'); $paymentDetails->setamount($formule->getPrix()); $paymentDetails->setdescription($formule->getLobby()->getDescription()); $paymentDetails->setuser($user); $paymentDetails->setFormule($formule); $paymentDetails['PAYMENTREQUEST_0_CURRENCYCODE'] = 'EUR'; $paymentDetails['PAYMENTREQUEST_0_AMT'] = $formule->getPrix(); $paymentDetails['NOSHIPPING'] = Api::NOSHIPPING_NOT_DISPLAY_ADDRESS; $paymentDetails['REQCONFIRMSHIPPING'] = Api::REQCONFIRMSHIPPING_NOT_REQUIRED; $paymentDetails['L_PAYMENTREQUEST_0_ITEMCATEGORY0'] = Api::PAYMENTREQUEST_ITERMCATEGORY_DIGITAL; $paymentDetails['L_PAYMENTREQUEST_0_AMT0'] = $formule->getPrix(); $paymentDetails['L_PAYMENTREQUEST_0_NAME0'] = $formule->getName(); $paymentDetails['L_PAYMENTREQUEST_0_DESC0'] = $formule->getLobby()->getDescription(); $storage->update($paymentDetails); $captureToken = $this->getTokenFactory()->createCaptureToken($paymentName, $paymentDetails, 'payment_done'); $paymentDetails['INVNUM'] = $paymentDetails->getId(); $storage->update($paymentDetails); return $this->redirect($captureToken->getTargetUrl()); }