在 PAYPAL PHP REST API SDK 中使用对象
Using Objects in PAYPAL PHP REST API SDK
我是 Rest Api 的新手。我正在尝试通过 php sdk 使用 paypal 快速结帐创建付款 rest api.I 已经下载并安装了他们的官方 sdk。
现在我可以创建正常的付款并且一切正常 fine.Now 我想将登录页面类型设置为 billing.In 文档页面 我被告知将 landing_page_type 设置为计费。我怎样才能在我的 php 脚本中做到这一点。
Link : 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 的新对象并将登陆页面添加到 it.I 尝试了类似
$billing = new FlowConfig();
$billing->setLandingPageType("billing");
接下来要做什么?如何将此 $billing 整合到我的 $payment
要设置着陆页类型,您应该创建支付体验并在请求中指定着陆页:
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 添加到创建付款的请求中,如下所示:
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));
->setExperienceProfileId(**********)
我是 Rest Api 的新手。我正在尝试通过 php sdk 使用 paypal 快速结帐创建付款 rest api.I 已经下载并安装了他们的官方 sdk。
现在我可以创建正常的付款并且一切正常 fine.Now 我想将登录页面类型设置为 billing.In 文档页面 我被告知将 landing_page_type 设置为计费。我怎样才能在我的 php 脚本中做到这一点。
Link : 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 的新对象并将登陆页面添加到 it.I 尝试了类似
$billing = new FlowConfig();
$billing->setLandingPageType("billing");
接下来要做什么?如何将此 $billing 整合到我的 $payment
要设置着陆页类型,您应该创建支付体验并在请求中指定着陆页:
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 添加到创建付款的请求中,如下所示:
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));
->setExperienceProfileId(**********)