protected function verifyPayment()
    {
        try {

            /** 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 (!$this->refId() || !$this->trackingCode()) {
                return false;
            }
            $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($this->refId);
            /**Execute the payment **/
            $result = $payment->execute($execution, $this->_api_context);
            /** dd($result);exit; /** DEBUG RESULT, remove it later **/
            if ($result->getState() == 'approved') {

                /** it's all right **/
                /** Here Write your database logic like that insert record or value in database if you want **/

//            \Session::put('success','Payment success');
                return true;
            }

            return false;
        } catch (\Exception $e) {
            $this->transactionFailed();
            $this->newLog('PaypalException', $e->getMessage());
            throw $e;
        }
    }
protected function verifyPayment()
    {
        try {

            /** 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 (!$this->refId() || !$this->trackingCode()) {
                return false;
            }
            $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($this->refId);
            /**Execute the payment **/
            $result = $payment->execute($execution, $this->_api_context);
            /** dd($result);exit; /** DEBUG RESULT, remove it later **/
            if ($result->getState() == 'approved') {

                /** it's all right **/
                /** Here Write your database logic like that insert record or value in database if you want **/

//            \Session::put('success','Payment success');
                return true;
            }

            return false;
        } catch (\Exception $e) {
            $this->transactionFailed();
            $this->newLog('PaypalException', $e->getMessage());
            throw $e;
        }
    }
protected function verifyPayment ( ) { try { /** 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 ( ! $ this -> refId ( ) || ! $ this -> trackingCode ( ) ) { return false ; } $ 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 ( $ this -> refId ) ; /**Execute the payment **/ $ result = $ payment -> execute ( $ execution , $ this -> _api_context ) ; /** dd($result);exit; /** DEBUG RESULT, remove it later **/ if ( $ result -> getState ( ) == 'approved' ) { /** it's all right **/ /** Here Write your database logic like that insert record or value in database if you want **/ //            \Session::put('success','Payment success'); return true ; } return false ; } catch ( \ Exception $ e ) { $ this -> transactionFailed ( ) ; $ this -> newLog ( 'PaypalException' , $ e -> getMessage ( ) ) ; throw $ e ; } }
Verify user payment from paypal server

@return bool
Verify user payment from paypal server