src/Payum/Paypal/Rest/Action/CaptureAction.php
public function execute($request)
    {
        /** @var $request Capture */
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaypalPayment $model */
        $model = $request->getModel();

        if (
            false == isset($model->state) &&
            isset($model->payer->payment_method) &&
            'paypal' == $model->payer->payment_method
        ) {
            $model->create($this->api);

            foreach ($model->links as $link) {
                if ($link->rel == 'approval_url') {
                    throw new HttpRedirect($link->href);
                }
            }
        }

        if (
            false == isset($model->state) &&
            isset($model->payer->payment_method) &&
            'credit_card' == $model->payer->payment_method
        ) {
            $model->create($this->api);
        }

        if (
            true == isset($model->state) &&
            isset($model->payer->payment_method) &&
            'paypal' == $model->payer->payment_method
        ) {
            $execution = new PaymentExecution();
            $execution->payer_id = $_GET['PayerID'];

            //Execute the payment
            $model->execute($execution, $this->api);
        }
    }
public function execute($request)
    {
        /** @var $request Capture */
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaypalPayment $model */
        $model = $request->getModel();

        if (
            false == isset($model->state) &&
            isset($model->payer->payment_method) &&
            'paypal' == $model->payer->payment_method
        ) {
            $model->create($this->api);

            foreach ($model->links as $link) {
                if ($link->rel == 'approval_url') {
                    throw new HttpRedirect($link->href);
                }
            }
        }

        if (
            false == isset($model->state) &&
            isset($model->payer->payment_method) &&
            'credit_card' == $model->payer->payment_method
        ) {
            $model->create($this->api);
        }

        if (
            true == isset($model->state) &&
            isset($model->payer->payment_method) &&
            'paypal' == $model->payer->payment_method
        ) {
            $execution = new PaymentExecution();
            $execution->payer_id = $_GET['PayerID'];

            //Execute the payment
            $model->execute($execution, $this->api);
        }
    }
{@inheritDoc}