Jump to content

Recommended Posts

  1. Tally The Total Error When I tally the total with an quantity of 2 my php calculate turn short up in php...But when I press the checkout button to paypal everything adds up correctly.....
  2. Shipment Trouble When I can add 2 or more items to my cart and checkout with paypal my shipment increase to another 10.00 dollars How would I fix that to remain 10.00?
  3. Tax calculate error the more items I add to my database my shipment changes from 0.08% to 0.02%

How Would I fix these errors without any bugs ?

$shipTotal="10.00";

$taxRate ="0.08";

$pricetotal = $price * $each_item['quantity'];

$getTax = $price * $taxRate;

$cartTotal = $pricetotal + $getTax + $shipTotal + $cartTotal ;

setlocale(LC_MONETARY, "en_US");

$pricetotal = money_format("%10.2n", $pricetotal);

// Dynamic Checkout Btn Assembly

$x = $i + 1;

$pp_checkout_btn .= '<input type="hidden" name="item_name_' . $x . '" value="' . $product_name . '">

<input type="hidden" name="amount_' . $x . '" value="' . $price . '">

<input type="hidden" name="quantity_' . $x . '" value="' . $each_item['quantity'] . '">

<input type="hidden" name="shipping_'. $x . '"value="'. $shipTotal .'">

<input type="hidden" name="tax_'. $x . '"value="'. $taxRate * $price .'"> ';

// Create the product array variable

$product_id_array .= "$item_id-".$each_item['quantity'].",";

Link to comment
https://forums.phpfreaks.com/topic/271153-php-tally-the-total-nasty-bug/
Share on other sites

If that form is presented to the user and then submitted directly to PayPal, you're going to end up giving away a lot of free stuff. It's absolutely trivial for an end user to alter any of those values to anything they want. It will never be in your favor either, I guarantee that.

Ideally, store it in the $_SESSION superglobal array, and write the items/quantities to a database when a customer confirms the order, along with the amounts they actually are being charged. Then send it to paypal directly. I'm not familiar with the specific methods PayPal allows, but to allow the end user to have any access to the manipulate price of something is suicide and can never be allowed.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.