PayPal\Api\Payment::execute PHP Method

execute() public method

Executes, or completes, a PayPal payment that the payer has approved. You can optionally update selective payment information when you execute a payment.
public execute ( PaymentExecution $paymentExecution, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : Payment
$paymentExecution PaymentExecution
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPalRestCall is the Rest Call Service that is used to make rest calls
return Payment
    public function execute($paymentExecution, $apiContext = null, $restCall = null)
    {
        ArgumentValidator::validate($this->getId(), "Id");
        ArgumentValidator::validate($paymentExecution, 'paymentExecution');
        $payLoad = $paymentExecution->toJSON();
        $json = self::executeCall("/v1/payments/payment/{$this->getId()}/execute", "POST", $payLoad, null, $apiContext, $restCall);
        $this->fromJson($json);
        return $this;
    }

Usage Example

Esempio n. 1
0
 /**
  * @throws \InvalidArgumentException
  *
  * @return Payment
  */
 private function payment() : Payment
 {
     if ($this->payment === null) {
         $this->payment = $this->return->payment();
         $this->payment->execute($this->execution(), $this->context);
     }
     return $this->payment;
 }
All Usage Examples Of PayPal\Api\Payment::execute