Reputation: 1168
Is it possible to have a custom message in PayPal order summary page? I can put my custom description only if I don't use setItemList function.
Here is the payment function:
$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));
This is the summary window with setItemList method: Image
And the problem is that I need to get rid of all of this info (item description, item number etc.) and have only my custom description (some string or other variables).
And if I don't use setItemList I get this window. Image Now I can see my custom message but Item Total row with the total price of this purchase is gone. Is it possible to have the total price row with only my custom message, without any other info?
Upvotes: 1
Views: 760
Reputation: 6463
It is not possible to have a single row with just item name and description. Items are always shown as line items and its corresponding 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");
Upvotes: 1