I have developed my own shopping cart and now I want to integrate Paypal to allow the payment process to happen once the customer has clicked on the 'buy now' button.
How is it possible so that the item details are reciprocated in Paypal on the left hand side? I need to pass the item details over to Paypal based on what the customer has added to their cart.
After researching, I noticed that you can have buy now buttons on individual items and do it that way - but I have my own cart which allows for multiple items. So how can I pass these over to Paypal dynamically?
My attempt is below but when testing - the 'buy now' button does nothing when clicked on.
<?php
$checkout = "<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>";
$checkout .= "<input type='hidden' name='cmd' value='_cart'><input type='hidden' name='upload' value='1'>";
$checkout .= "<input type='hidden' name='business' value='derrysnurseries@hotmail.co.uk'>";
$count = 1;
$checkout .= "<input type='hidden' name='item_name_" + $count + "' value='" + $product['common_name']+ "'>";
$checkout .= "<input type='hidden' name='item_number_" + $count + "' value='" + $count + "'>";
$checkout .= "<input type='hidden' name='quantity_" + $count + "' value='" + $item['quantity'] + "'>";
$checkout .= "<input type='hidden' name='amount_" + $count + "' value='" + $product['price'] + "'>";
$count = $count + 1;
?>
<input type='hidden' name='currency_code' value='GBP'>
<input type='hidden' name='lc' value='GB'>
<input type='hidden' name='return' value='http://www.derrysnurseries.co.uk/checkout?confirm=Confirm&confirmTerms=on'>
<input type='hidden' name='cancel_return' value='http://www.derrysnurseries.co.uk/checkout'>
<input type='hidden' name='notify_url' value='http://www.derrysnurseries.co.uk/checkout?confirm=Confirm&confirmTerms=on'>
<div class='securePayment'>Click <input class='securePaymentButton' type='submit' value='here'> to continue to secure payment site</div>
<?php $checkout .= "</form>"; ?>