public function getPaymentStatus() { // Get the payment ID before session clear $payment_id = Session::get('paypal_payment_id'); // clear the session payment ID Session::forget('paypal_payment_id'); if (empty(Input::get('PayerID')) || empty(Input::get('token'))) { return Redirect::route('original.route')->with('error', 'Payment failed'); } $payment = Payment::get($payment_id, $this->_api_context); // PaymentExecution object includes information necessary // to execute a PayPal account payment. // The payer_id is added to the request query parameters // when the user is redirected from paypal back to your site $execution = new PaymentExecution(); $execution->setPayerId(Input::get('PayerID')); //Execute the payment $result = $payment->execute($execution, $this->_api_context); echo '<pre>'; print_r($result); echo '</pre>'; exit; // DEBUG RESULT, remove it later if ($result->getState() == 'approved') { // payment made return Redirect::route('original.route')->with('success', 'Payment success'); } return Redirect::route('original.route')->with('error', 'Payment failed'); }