Paypal REST API: Unable to set landing page to bil

2019-04-09 12:18发布

I'm building a donate function for a charity using the Paypal REST API with the PHP SDK. I've been attempting to set the landing page type to 'Billing' but nothing seems to change. This is my code for defining the web experience profile (as per http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payment-experience/CreateWebProfile.html):

use PayPal\Api\FlowConfig;
use PayPal\Api\Presentation;
use PayPal\Api\InputFields;
use PayPal\Api\WebProfile;

$flow = new FlowConfig();
$flow->setLandingPageType('Billing');

$presentation = new Presentation();
$presentation->setLogoImage('xxxxxxxx')
    ->setBrandName('xxxxxxxx')
    ->setLocaleCode('GB');

$inputFields = new InputFields();
$inputFields->setNoShipping(1)
    ->setAddressOverride(0);

$webProfile = new WebProfile();
$webProfile->setName('xxxxxxxx' . uniqid())
    ->setFlowConfig($flow)
    ->setPresentation($presentation)
    ->setInputFields($inputFields);

try {
    $createProfileResponse = $webProfile->create($paypal);
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
    die($ex);
}

$profileId = $createProfileResponse->getId();

Then later on:

$payment = new Payment();
$payment->setIntent('sale')
    ->setPayer($payer)
    ->setRedirectUrls($redirectUrls)
    ->setTransactions([$transaction])
    ->setExperienceProfileId($profileId);

The logo image comes up fine on the resulting page, so I know the ID is valid. I've also tried clearing cookies as per a suggestion I found online, but that had no effect. Thanks in advance for any advice.

标签: php rest paypal
1条回答
叛逆
2楼-- · 2019-04-09 12:50

In PayPal's new checkout style, as below, LandingPage setting can't work. It's a known issue in PayPal's side. Sorry about the inconvenience. But in old style, LandingPage can work.enter image description here

查看更多
登录 后发表回答