Hi all, I really need help, it's important. I have code like this: <?php
require 'app/start.php';
use PayPal\Api\Payer;
use PayPal\Api\Item;
use PayPal\Api\ItemList;
use PayPal\Api\Details;
use PayPal\Api\Amount;
use PayPal\Api\Transaction;
use PayPal\Api\RedirectUrls;
use PayPal\Api\Payment;
use PayPal\Api\Presentation;
use PayPal\Api\Tax;
use PayPal\Api\ShippingAddress;
use PayPal\Api\PaymentOptions;
$product = 'test';
$price = 22.00;
$shipping = 2.00;
$total = $shipping + $price;
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$tax = new Tax();
$tax->setPercent(23);
$item = new Item();
$item->setName($product)
->setCurrency('USD')
->setQuantity(1)
->setDescription('[Size: XL][Color: Black]')
->setTax(23)
->setPrice($price);
$itemList = new ItemList();
$itemList->setItems(array($item));
$details = new Details();
$details->setShipping($shipping)
->setSubtotal($price);
$amount = new Amount();
$amount->setCurrency('USD')
->setTotal($total)
->setDetails($details);
$payee = new PayPal\Api\Payee();
$payee->setEmail("xdd");
$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription('PIY Royale Skateboards')
->setInvoiceNumber(uniqid())
->setPayee($payee);
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl(SITE_URL . 'pay.php?success=true')
->setCancelUrl(SITE_URL . 'pay.php?success=false');
$payment = new Payment();
$payment->setIntent('sale')
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));
$presentation = new Presentation();
$presentation->setLogoImage("http://dcsv.xaa.pl/sklep/assets/images/piu.png")
->setBrandName("PIY Royale Skateboards")
->setLocaleCode("US");
$shipping_address = new ShippingAddress();
$shipping_address->setCity('Warsaw')
->setCountryCode('PL')
->setPostalCode('05075')
->setLine2('Polna 15a')
->setLine1('Polna 15a');
$itemList->setShippingAddress($shipping_address);
$PaymentOptions = new PaymentOptions();
$PaymentOptions->setheaderImageUrl("http://dcsv.xaa.pl/sklep/shop/paypal/piu_logo.png");
try {
$payment->create($paypal);
} catch(Exception $e) {
die($e);
}
$approvalUrl = $payment->getApprovalLink();
header('Location:'.$approvalUrl); first, how I can add tax. setTax(23); didin't work. And next think. how I can add custom image or custom texr on payment title
... View more