public function execute($payPalId, $payerID = null) { if ($payerID == null) { $payerID = $this->getPayer->getPayerInfo()->getPayerId(); } if ($this->getStatus($payPalId) == "created") { $payment = $this->getPayment($payPalId); $execution = PaypalPayment::PaymentExecution(); $execution->setPayerId($payerID); try { $payment->execute($execution, $this->_apiContext); } catch (\PayPal\Exception\PPConnectionException $ex) { echo "Exception: " . $ex->getMessage() . PHP_EOL; dd($ex->getData()); exit(1); } } }