简体   繁体   中英

PayPal Adaptive Payments and shipping address

I've been struggling with this over the past 5 hours, so let's see if someone can help me out here.

I'm using PayPal's Adaptive Payments for making a Chained Payment (just me and a secondary receiver). The problem is: I can't figure out how to force the buyer to put a shipping address.

Here's how I'm making the calls:

$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);

The response of the SetPaymentOptionsRequest for the pay key obtained in the Pay() call is success, but when I proceed to the payment, the shipping address is not asked for.

Any help will be much appreciated.

Thanks!

I have the same experience and got a reply from PayPal support that it is not possible.

This feature only works in the Embedded flow (lightbox or popup instead of redirect). Same with receiverOptions (if you wanted to display additional details about the products). Only displayOptions (for eg setting the business name) works after the redirect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM