Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PAYPAL PHP REST API SDK中使用对象_Php_Api_Rest_Paypal - Fatal编程技术网

在PAYPAL PHP REST API SDK中使用对象

在PAYPAL PHP REST API SDK中使用对象,php,api,rest,paypal,Php,Api,Rest,Paypal,我是RESTAPI的新手。我正在尝试通过php sdk rest api使用paypal express checkout创建支付。我已经下载并安装了他们的官方sdk 现在我可以创建一个正常的付款,一切正常。现在我想将登录页类型设置为billing。在文档页面中,我被告知将登录页类型设置为billing。如何在php脚本中实现这一点 链接: 我的php脚本看起来像 $transaction = new Transaction(); $transaction->setAmount($amou

我是RESTAPI的新手。我正在尝试通过php sdk rest api使用paypal express checkout创建支付。我已经下载并安装了他们的官方sdk

现在我可以创建一个正常的付款,一切正常。现在我想将登录页类型设置为billing。在文档页面中,我被告知将登录页类型设置为billing。如何在php脚本中实现这一点

链接:

我的php脚本看起来像

$transaction = new Transaction();
$transaction->setAmount($amount)
    ->setItemList($itemList)
    ->setDescription("Payment description")
    ->setInvoiceNumber(uniqid());



    $payment = new Payment();
    $payment->setIntent("sale")
        ->setPayer($payer)
        ->setRedirectUrls($redirectUrls)
        ->setTransactions(array($transaction));

    $payment->create($apiContext);
    $billing = new FlowConfig();
$billing->setLandingPageType("billing");
据我所知,我必须创建一个名为flow config的新对象,并向其中添加登录页

$transaction = new Transaction();
$transaction->setAmount($amount)
    ->setItemList($itemList)
    ->setDescription("Payment description")
    ->setInvoiceNumber(uniqid());



    $payment = new Payment();
    $payment->setIntent("sale")
        ->setPayer($payer)
        ->setRedirectUrls($redirectUrls)
        ->setTransactions(array($transaction));

    $payment->create($apiContext);
    $billing = new FlowConfig();
$billing->setLandingPageType("billing");

下一步怎么办?如何将此$billing集成到my$payment中要设置登录页类型,您应该创建一个支付体验并在请求中指定登录页:

PHP SDK示例:

响应中有一个付款体验配置文件ID。 然后将ExperienceProfileId添加到创建付款的请求中,如下所示:

$payment->setIntent("sale")
    ->setPayer($payer)
    ->setRedirectUrls($redirectUrls)
    ->setTransactions(array($transaction));
    ->setExperienceProfileId(**********)

要设置登录页类型,您应创建付款体验并在请求中指定登录页:

PHP SDK示例:

响应中有一个付款体验配置文件ID。 然后将ExperienceProfileId添加到创建付款的请求中,如下所示:

$payment->setIntent("sale")
    ->setPayer($payer)
    ->setRedirectUrls($redirectUrls)
    ->setTransactions(array($transaction));
    ->setExperienceProfileId(**********)