我刚刚使用RestAPI和SDK的以下示例进行了PayPal付款。
首先(获取发送客户的PayPal网址) https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/payments/CreatePaymentUsingPayPal.php
最后(将核心网址返回给我的服务器以获取授权客户) https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/payments/ExecutePayment.php
在上一篇评论中,有关根据送货地址增加更多费用的信息,但我不知道如何获取。
// ### 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.
顺便说一句,我只在执行付款时获得客户的地址,然后我将付款对象作为$ result->付款人
$result = $payment->execute($execution, $apiContext);
如何在执行前获取付款人以根据客户地址检查运费?
感谢。
答案 0 :(得分:0)
在回答我的问题时,var $ payment中的对象在付款执行前有地址和所有用户数据。
$payment = Payment::get($paymentId, $apiContext);
print_r($payment);