没有详细信息和小计的PayPal结账

时间:2018-03-14 12:40:57

标签: paypal express-checkout

我使用PayPal SDK for PHP,并希望在没有显示细节和总数而不是小计的情况下进入结账(如左图所示)。 谢谢!

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();

1 个答案:

答案 0 :(得分:0)

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

相关问题