With this php code, I send a request for payment with Paypal sandbox account. However when I go to the submit page I cant see what amount I am paying: https://i.imgur.com/iTra1SQ.png -> here in the red shoulld be displayed - 10.00(amountPayable).
How can I send it so it's showed?
use PayPal\Api\Amount;
use PayPal\Api\Payer;
use PayPal\Api\Payment;
use PayPal\Api\RedirectUrls;
use PayPal\Api\Transaction;
require 'bootstrap.php';
$payer = new Payer();
$payer->setPaymentMethod('paypal');
// Set some example data for the payment.
$currency = 'GBP';
$amountPayable = 10;
$invoiceNumber = uniqid();
$amount = new Amount();
$amount->setCurrency($currency)
->setTotal($amountPayable);
$transaction = new Transaction();
$transaction->setAmount($amount)
->setDescription('10 GBP payment')
->setInvoiceNumber($invoiceNumber);
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl($paypalConfig['return_url'])
->setCancelUrl($paypalConfig['cancel_url']);
$payment = new Payment();
$payment->setIntent('sale')
->setPayer($payer)
->setTransactions([$transaction])
->setRedirectUrls($redirectUrls);
try {
$payment->create($apiContext);
} catch (Exception $e) {
throw new Exception('Unable to create link for payment');
}
header('location:' . $payment->getApprovalLink());
exit(1);