I am implementing a paypal payment within a project.
Following paypals instructions I built a procedural php file to get a users payment. This worked so I took the next step to make it a class.
Within this class I call a static method from a class provided by paypal. This call gives back an error:
Fatal error: Cannot access empty property in line xy.
By this line:
use PayPal\Api\Payment;
the class is made available.
This line throws the error:
/*xy=>*/ $this->payment = Payment::get ( $this->paymentId, $this->apiContext );
First I checked that $this->paymentId
and $this->apiContext
are populated and not empty.
( xy=>
is the line number ).
usually I separate variables by lines but the editor here does not support it so do not wonder why I only tried to experiment with paymentID and not with apiContext. This is because apiContext is in the next line (xy+1 ) within my source code.
I tried to transfer the volume of $this->paymentId
to a variable $abc
and then tried the call:
$abc = $this->paymentId;
/*xy=>*/ $this->payment = Payment::get ( $abc, $this->apiContext );
Then I tried to instantiate the paypal class before calling the funtion like:
$ppobj= new \PayPal\Api\Payment();
/*xy=>*/ $this->payment = $ppobj->Payment::get ( $this->paymentId, $this->apiContext );
And I tried a call like:
$this->payment = \PayPal\Api\Payment::get( $this->paymentId, $this->apiContext );
Please be so kind and tell me what I am doing wrong and what I am supposed to do.