简体   繁体   中英

php add to cart paypal button problem - problem with my amount

I have a paypal sandbox "Add to Cart" where if a user adds a particular product from a database into an account, it should display the price of that product based on what it is in the database.

Say I have these two products;

prodID: 1 product: Hat price: £5.00

prodID: 2 product: socks price: £3.00

however, when I add these products to cart in sandbox, its says they are £0.50 when they clearly are not. Here is my code;

        <form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="7UCL9YCYYXL3J">
    <input type="hidden" name="item_name" value="<?php echo $row['product']; ?>">
    <input type="hidden" name="item_number" value="<?php echo $row['prodID']; ?>">
    <input type="hidden" name="amount" value="<?php echo $row['price']; ?>">
    <input type="hidden" name="currency_code" value="GBP">
    <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </form>

it seems this has the problem (i dont know how to handle the _s-xclick:

<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="7UCL9YCYYXL3J">

instead, this has not:

<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="youremail@yahoo.gr">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM