【问题标题】:Using Objects in PAYPAL PHP REST API SDK在 PAYPAL PHP REST API SDK 中使用对象
【发布时间】:2015-11-05 05:08:01
【问题描述】:

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

现在我可以创建正常付款,一切正常。现在我想将登录页面类型设置为计费。在文档页面中,有人告诉我将landing_page_type 设置为计费。我怎样才能在我的 php 脚本中做到这一点。

链接:https://developer.paypal.com/docs/api/#flowconfig-object

我的 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);

所以据我了解,我必须创建名为 flow config 的新对象并向其添加登录页面。我尝试了类似

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

接下来要做什么?如何将此 $billing 集成到我的 $payment 中

【问题讨论】:

    标签: php api rest paypal


    【解决方案1】:

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

    https://developer.paypal.com/docs/integration/direct/rest-experience-overview/ https://developer.paypal.com/docs/api/#payment-experience

    PHP SDK 示例: https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/payment-experience/CreateWebProfile.php

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

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

    【讨论】:

      猜你喜欢
      • 2020-07-01
      • 2021-07-05
      • 2014-09-16
      • 2016-05-20
      • 2015-02-05
      • 2013-08-25
      • 2013-11-26
      • 2013-08-24
      • 1970-01-01
      相关资源
      最近更新 更多