paypal / PayPal-PHP-SDK

PHP SDK for PayPal RESTful APIs
https://developer.paypal.com/docs/api/
Other
27 stars 100 forks source link

Getting: 'undefined id' on PaymentExecution execute() #46

Closed younes0 closed 10 years ago

younes0 commented 10 years ago

When trying to execute the Payment :

$payerId = Input::get('PayerID');
$payment = new Payment($paymentId);
$execution = (new PaymentExecution)->setPayer_id($payerId);
// Fails (with fine apiContext)
$payment->execute($execution, $apiContext); 

I get :

ErrorException Object {
    protected message: "Undefined index: id", 
    protected code: 8, 
    protected file: "/www/apkf/app/vendor/paypal/sdk-core-php/lib/PayPal/Common/PPModel.php", 
    protected line: 14,
    protected severity: 0
} 

Dashboard shows Payments staying on "Create" state.

What am I doing wrong ?

younes0 commented 10 years ago

This Guide shows:

$payment = new Payment($paymentId);

which doesn't work in my setup, unlike

$payment = Payment::get($paymentId, $apiContext);

which solved my issue.

PS: Using dev-stable