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

// Set some example data for the payment.
$currency = 'GBP';
$amountPayable = 10;
$invoiceNumber = uniqid();

$amount = new Amount();

$transaction = new Transaction();
->setDescription('10 GBP payment')

$redirectUrls = new RedirectUrls();

$payment = new Payment();

try {
} catch (Exception $e) {
throw new Exception('Unable to create link for payment');

header('location:' . $payment->getApprovalLink());

Your code seems fine. It does however not show how you are loading the cart menu. The code should be updated on that page to "refresh" your cart menu with the amount.

Please post the code where your cart is created.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.