【问题标题】:PayPal Checkout without Details and Subtotal没有详细信息和小计的 PayPal 结帐
【发布时间】:2018-08-23 00:02:30
【问题描述】:

我使用适用于 PHP 的 PayPal SDK 并希望在结账时不显示详细信息和总计而不是小计(如左图所示)。 谢谢!

Example Picture

这是我使用的代码。

$arrPrices = $this->getPrices();

$apiContext = $this->getApiContext();

$payer = new \PayPal\Api\Payer();
$payer->setPaymentMethod("paypal");

$arrItems = [];

$item = new \PayPal\Api\Item();

$item->setName($saveValues['title'])->setCurrency('EUR')->setQuantity(1)->setPrice($arrPrices['raw']);

$arrItems[] = $item;

$itemList = new \PayPal\Api\ItemList();
$itemList->setItems($arrItems);

$details = new \PayPal\Api\Details();
$details->setTax($arrPrices['tax'])->setSubtotal($arrPrices['raw']);

$amount = new \PayPal\Api\Amount();
$amount->setCurrency("EUR")->setTotal($arrPrices['total'])->setDetails($details);

$transaction = new \PayPal\Api\Transaction();
$transaction->setAmount($amount)->setItemList($itemList)->setDescription("Vielen Dank für Deine Buchung & bis bald!");

$redirectUrls = new \PayPal\Api\RedirectUrls();

$url = \Environment::get('url') . '/' . $GLOBALS['SCRIPT_URL'];
$redirectUrls->setReturnUrl("$url?success=true")->setCancelUrl("$url?success=false");

$payment = new \PayPal\Api\Payment();
$payment->setIntent("sale")->setPayer($payer)->setRedirectUrls($redirectUrls)->addTransaction($transaction);

try {
    $payment->create($apiContext);
}
catch (\Exception $ex) {
    return $ex->getData();
}

return $payment->getApprovalLink();

【问题讨论】:

    标签: paypal express-checkout


    【解决方案1】:

    如果您不提供详细信息,您将看不到详细信息?没有办法让您提供详细信息,然后在贝宝批准页面(您正在显示屏幕截图)上显示它

    【讨论】:

      猜你喜欢
      • 2013-09-06
      • 1970-01-01
      • 2013-03-27
      • 1970-01-01
      • 2013-08-27
      • 2018-06-09
      • 2013-07-19
      • 2015-02-27
      • 2018-05-30
      相关资源
      最近更新 更多