suess0r Posted May 7, 2007 Share Posted May 7, 2007 Hi, I'm building a site that a user can upload his/her documents, tell me what type of document it is (student / academic, business, personal doc, etc) and a specific % is multiplied by the # of words of that document. All said and done, I show the user a Quote for how much it will cost and they can click "Buy now" or "Checkout" and pay for it right then. The only way I've ever used paypal is when I have a specific Item, with a Specific Price involved by using the "Buy Now" buttons single item purchase. The problem is that I don't know how to post the new price value to the https://www.paypal.com/cgi-bin/webscr since all the prices will vary from the number of words with the different types of documents, I called paypal and the rep told me that he didn't think it could be done. But that's ridiculous, can anyone shed some light? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/50424-passing-a-different-price-value-to-paypal/ Share on other sites More sharing options...
pocobueno1388 Posted May 8, 2007 Share Posted May 8, 2007 Wherever your code is on the page that should look something like this: <form action="https://www.paypal.com/cgi-bin/youbscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="email@whatever.com"> <input type="hidden" name="item_name" value="Widget One"> <input type="hidden" name="item_number" value="Wid-001"> <input type="hidden" name="amount" value="1.00"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="image" src= "https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit> </form> You need to add the "amount" input type...which is in the above code. <input type="hidden" name="amount" value="1.00"> Just change the value up to fit what you need. I was dealing with this issue a while back, but I can't remember exactly how I handled it. I know I found a website that had all the paypal codes to do everything...so if this doesn't help, then I will search for it for you. Quote Link to comment https://forums.phpfreaks.com/topic/50424-passing-a-different-price-value-to-paypal/#findComment-247689 Share on other sites More sharing options...
suess0r Posted May 8, 2007 Author Share Posted May 8, 2007 Hey poco, Thanks a bunch, that's what I assumed would be how to do it but I wanted to double check. The only thing I have a question about is this... Say i run my php like so.. <input type="hidden" name="amount" value="<?php $docz = $_POST['document']; $wordsz = $_POST['num-words']; if($docz == "book") $calcz = $wordsz * .005; if($docz == "student") $calcz = $wordsz * .01; if($docz =="biz") $calcz = $wordsz * .025; if($docz == "personal") $calcz = $wordsz * .03; echo $calcz; ?> "> How do i set the $calcz = to limit it to only 2 decimal spaces X.XX - Because it works, except when the amount is 3 decimal spaces or more. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/50424-passing-a-different-price-value-to-paypal/#findComment-247722 Share on other sites More sharing options...
pocobueno1388 Posted May 8, 2007 Share Posted May 8, 2007 Well...are your numbers always going to be set up in this fasion?: x.xxxxxx If so, then just do this: $calcz = substr($calcz, 0, 3); Quote Link to comment https://forums.phpfreaks.com/topic/50424-passing-a-different-price-value-to-paypal/#findComment-247728 Share on other sites More sharing options...
suess0r Posted May 8, 2007 Author Share Posted May 8, 2007 No, they're not always going to be. There's no way just to limit the decimals to round to the 10th decimal spot? .XX ? Quote Link to comment https://forums.phpfreaks.com/topic/50424-passing-a-different-price-value-to-paypal/#findComment-247746 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.