I am a beginner with this, I am developing an e-commerce website. My problem is that I am trying to fetch the cart total into Paypal when checked out with Paypal, however, it is still showing me the default 0.01 NZD and not my cart amount. The tutorial I am following is https://github.com/EvolutedNewMedia/paypal-example/blob/master/payment-successful.html[1] . I asked a question few hours ago: PayPal integration to PHP eCommerce site not working. And as @Preston PHX asked me to follow some steps. I am struggling with this for 2 weeks now and its my final year project. I am not that great at coding, so If I could get some help for this, it would be much appreciated.
Asked
Active
Viewed 164 times
-3
-
The question is too vague and broad atm. We're glad to help you sort out specific and concrete issues you might run into with your code, but then you need to post the relevant code (in the question itself), explain where/how it fails, example data, expected result and what currently happens. Just posting links to some code on github doesn't tell us much about your implementation. However, if the question is more "how do I use this third party service", the question should rather be directed towards their support (since we're not it). – M. Eriksson Nov 18 '21 at 09:56
-
Hi, thank you for the response @M. Eriksson, well I am referring to a lot of tutorials, and the link on GitHub is the best one I found so far. However, I am an absolute beginner and this is my final year project, since the requirement was to choose a language we were never taught at uni, I chose PHP, I was given 4 months of time to finish my project, and so I did not have time enough to learn PHP. I just have 10 days left. Sorry if my question is not descriptive enough, As you can see I am new to StackOverflow as well. – Himani Gajjar Nov 19 '21 at 05:52
1 Answers
0
Since you only have 10 days left, you may wish to use something basic (but works)
Please use the following form :
(1) replace the value of "business" by your paypal email account
(2) replace the value of $itemAmount by your shopping cart total
(3) If necessary , replace the $custom by a custom variable (string or number) so that you can use it later on (if you do not need this one, just ignore this $custom value
(4) success.php and cancelled.php are the two pages when the user completed the transaction and Cancelled the transaction, respectively.
<form id=form1 action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="xxxxxx@xxxxxx.com">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Purchase Item">
<input type="hidden" name="amount" value="<?php echo $itemAmount; ?>">
<input type="hidden" name="currency_code" value="NZD">
<input type="hidden" name="custom" value="<?php echo $custom; ?>">
<input type="hidden" name="return" value="success.php">
<input type="hidden" name="cancel_return" value="cancelled.php">
</form>
<script>
document.getElementById('form1').submit();
</script>
If you have time , you may switch to use other more sophisticated paypal API.

Ken Lee
- 6,985
- 3
- 10
- 29