public function confirm(Request $request) { $cart = $this->cartRepository->getCart(['cartItems.product']); $order = Order::find($request->get('id')); $gateway = \Omnipay::gateway('paypal'); $settings = $gateway->getDefaultParameters(); //dd($settings); $desc = ''; foreach ($cart->cartItems as $item) { $desc .= "> " . $item->product->title . "\r\n"; } $card = \Omnipay::creditCard($order->toArray()); $response = \Omnipay::purchase(['currency' => 'GBP', 'amount' => $order->total, 'returnUrl' => 'http://google.co.uk', 'cancelUrl' => 'http://google.co.uk', 'description' => $desc, 'transactionId' => $order->id, 'card' => $card])->send(); //dd($response); // $purchaseRequest = $this->omnipay->purchase($data); // // // Grab the parameters // $purchaseParameters = $purchaseRequest->getData(); // // // Add our additional parameters // $purchaseParameters['MC_paymentType'] = 'payment'; // // // Send off the request // $response = $purchaseRequest->sendData($purchaseParameters); // Check we got a redirect response if ($response->isRedirect()) { // If so redirect the user $response->redirect(); } else { // Broken data dd($response); throw new Exception(); } }
function doPaymnet() { $amount = 0; $return_url = ''; $cardInput = array('number' => Input::get('cc_number'), 'firstName' => Input::get('firstName'), 'lastName' => Input::get('lastName'), 'expiryMonth' => Input::get('expiryMonth'), 'expiryYear' => Input::get('expiryYear'), 'cvv' => Input::get('cvv')); $card = Omnipay::creditCard($cardInput); $response = Omnipay::purchase(['amount' => $amount, 'returnUrl' => $return_url, 'cancelUrl' => $cancel_url, 'card' => $cardInput]); }