Php PayPal REST API订单摘要自定义说明
是否可以在PayPal订单摘要页面中显示自定义消息? 只有在不使用setItemList函数的情况下,我才能输入自定义描述 以下是付款功能:Php PayPal REST API订单摘要自定义说明,php,api,rest,paypal,paypal-rest-sdk,Php,Api,Rest,Paypal,Paypal Rest Sdk,是否可以在PayPal订单摘要页面中显示自定义消息? 只有在不使用setItemList函数的情况下,我才能输入自定义描述 以下是付款功能: $payer = new Payer(); $payer->setPaymentMethod($type); $item = new Item(); $item->setName($this->record['title']); $item->setCurrency('GBP');
$payer = new Payer();
$payer->setPaymentMethod($type);
$item = new Item();
$item->setName($this->record['title']);
$item->setCurrency('GBP');
$item->setQuantity(1);
$item->setSku($order['id']);
$item->setPrice($price);
$item->setDescription($price);
$itemList = new ItemList();
$itemList->setItems(array($item));
$amount = new Amount();
$amount->setCurrency('GBP');
$amount->setTotal($order['price']);
$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setItemList($itemList);
$transaction->setDescription("My custom description");
$baseUrl = SITE_URL.FrontendNavigation::getURLForBlock($this->module, 'Callback');
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl($baseUrl.'?success=true');
$redirectUrls->setCancelUrl($baseUrl.'?success=false');
$payment = new Payment();
$payment->setIntent("sale");
$payment->setPayer($payer);
$payment->setRedirectUrls($redirectUrls);
$payment->setTransactions(array($transaction));
这是使用setItemList方法的摘要窗口:
问题是,我需要去掉所有这些信息(项目描述、项目编号等),而只有我的自定义描述(一些字符串或其他变量)
如果我不使用setItemList我会得到这个窗口。现在我可以看到我的自定义消息,但包含此购买总价的Item Total行已消失。是否可以将总价行仅包含我的自定义消息,而不包含任何其他信息?不可能仅包含项目名称和说明的单行。 项目始终显示为行项目及其相应的总计
$item1 = new Item();
$item1->setName('My Custom Description')
->setCurrency('USD')
->setQuantity(1)
->setPrice(7.5);
$itemList = new ItemList();
$itemList->setItems(array($item1));
$amount = new Amount();
$amount->setCurrency("USD")
->setTotal(7.5);
$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription("Payment description");