i just started reading how to connect ur cart to paypal. i get the main idea but when i hit paypal buy button. data doesnt tranfer. so on paypal site it alway say to have 0 items in ur cart.

<?php
...
$x=1;
$pp_checkout_btn = '';
$pp_checkout_btn .= '
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="_cart">
        <input type="hidden" name="upload" value="1">
        <input type="hidden" name="business" value="abcdef@hotmail.com">
';

.....
while($row = mysql_fetch_assoc($item_cart_query))  
{
    $cart_id_db = $row['cart_id'];           //get item id,name,price,quantity etc from database
    .....

    //Dynamic CheckOut Btn Assembly
    $pp_checkout_btn .= '
        <input type="hidden" name="item_name_'.$x.'" value="$image_user_name_db">
        <input type="hidden" name="amount_'.$x.'" value="$price_db">
        <input type="hidden" name="quantity_'.$x.'" value="$qty_db">
        ';
    $x++;
}

$pp_checkout_btn .= '
    <input type="hidden" name="notify_url" value="https://www.yoursite.com/storescripts/my_ipn.php">
    <input type="hidden" name="return" value="https://www.yoursite.com/checkout_complete.php">
    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="cbt" value="Return to The Store">
    <input type="hidden" name="cancel_return" value="https://yoursite.com/paypal_cancel.php">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="currency_code" value="USD">
    <input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal">
    </form>';

....
    echo"$pp_checkout_btn;"
?>

Recommended Answers

All 2 Replies

Member Avatar for LastMitch

@hwoarang69

i just started reading how to connect ur cart to paypal. i get the main idea but when i hit paypal buy button. data doesnt tranfer. so on paypal site it alway say to have 0 items in ur cart.

Did you go to the PayPal forum before you came here? The reason why I ask because it's their product.

Read this:

https://www.paypal-community.com/t5/How-to-use-PayPal-Archive/HTML-to-connect-Website-to-PayPal-Account/td-p/40800

I think you need to understand something, anything that is related to integrate shopping cart or any payment plan will most likely not be answer because you are getting pay to do that and it's unfair for the rest of Daniweb members not getting the fair share. There's no free lunch!

thanks for the link.

o no i am not getting money for this. this site is on localhost for a project.

Be a part of the DaniWeb community

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