I just made my paypal payments using RestAPI and the following examples of the SDK.
First (get paypal url for send customer) https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/payments/CreatePaymentUsingPayPal.php
Last (returning url to my server for authorized customer) https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/payments/ExecutePayment.php
In the comments of the last, are info about the add more cost based on the shipping address, but i don't know how to get.
// ### Optional Changes to Amount
// If you wish to update the amount that you wish to charge the customer,
// based on the shipping address or any other reason, you could
// do that by passing the transaction object with just `amount` field in it.
// Here is the example on how we changed the shipping to $1 more than before.
By the way, I only get the address of the customer when I execute the payment, then I get the payed object as $result->payer
$result = $payment->execute($execution, $apiContext);
How I can get the payer before executing for check the shipping cost based on the Address of customer?.
Thanks.
In reply of my question, the object located in var $payment have the address and all the user data before the payment is executed.
$payment = Payment::get($paymentId, $apiContext);
print_r($payment);