PayPal自适应付款和送货地址

时间:2013-06-09 22:33:53

标签: php paypal shipping paypal-adaptive-payments

在过去的5个小时里,我一直在努力解决这个问题,所以让我们看看是否有人可以帮助我。

我正在使用PayPal的自适应付款进行链式付款(仅限我和次要接收方)。问题是:我无法弄清楚如何强迫买家提供送货地址。

以下是我打电话的方式:

$primaryReceiver = new \Receiver();
$primaryReceiver->email = 'primary.receiver@mail.com';
$primaryReceiver->primary = 'true';
$primaryReceiver->paymentType = 'SERVICE';
$primaryReceiver->amount = 100;

$secondaryReceiver = new \Receiver();
$secondaryReceiver->email = 'secondary.receiver@mail.com';
$secondaryReceiver->primary = 'true';
$secondaryReceiver->paymentType = 'GOODS';
$secondaryReceiver->amount = 90;

$receiverList = new \ReceiverList(array($primaryReceiver, $secondaryReceiver));

$payRequest = new \PayRequest(
    new \RequestEnvelope('en_US'),
    'CREATE',
    'http://my.site.url/pay/cancel',
    'USD',
    $receiverList,
    'http://my.site.url/pay/success'
);

// maybe this Pay() call is wrong? should it be some other method?
$paymentResponse = $service->Pay($payRequest);

// setting payment options
$payOptions = new \SetPaymentOptionsRequest(new \RequestEnvelope("en_US"), $paymentResponse->payKey);
$payOptions->senderOptions = new \SenderOptions();
$payOptions->senderOptions->requireShippingAddressSelection = 'true';
$payOptionsResponse = $service->setPaymentOptions($payOptions);

SetPaymentOptionsRequest对Pay()调用中获得的付款密钥的响应是成功的,但是当我继续付款时,不会要求发货地址。

非常感谢任何帮助。

谢谢!

1 个答案:

答案 0 :(得分:1)

我有相同的经验并得到PayPal支持的答复,这是不可能的。

此功能仅适用于嵌入式流程(灯箱或弹出窗口而非重定向)。与receiverOptions相同(如果您想显示有关产品的其他详细信息)。只有displayOptions(例如设置商家名称)才能在重定向后使用。