Hi,
I have a form on my web page that allows users to make a charitable donation.
However when I try to replace the Sandbox URL to the live account URL, the page I get from PayPal is different.
Using the Sandbox URL I get a page that contains the amount I would like to donate to the charity (this is specified in the hidden fields of the form) and the PayPal page shows that amount with a button to login to the PayPal account to complete the payment, however using the live URL I don't get the same, instead I get a page that asks me to specify the amount to donate.
The form I am using is below. The commented out form tag is what I believe to be the live URL and the live form tag is to my sandbox account which gives me the expected result.
I populate the hidden fields on the form using javascript which I have also shown below.
I have changed sensitive data in the form and put the description in brackets () same with the javascript
Can anyone point me in the right direction please.
Nick
--------------- form ------------
@*<form method="post" action="https://www.paypal.com/cgi-bin/webscr">*@ <form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr"> <input type="hidden" name="cmd" value="_donations" /> <input type="hidden" name="business" value="(business)" /> <input type="hidden" id="currency_code" name="currency_code" value="GBP" /> <input type="hidden" name="item_name" value="(name)" /> <input type="hidden" id="amount" name="amount" value="" /> <input type="hidden" id="return" name="return" value=""> <input type="image" src="~/images/PayPalSponsor.png" width="230" height="50" /> </form> -------------- end form --------------
-------------- javascript to populate hidden fields before submission -------- <script> function CalculateAmount(currency) { if (currency == 'dollars') { try { document.getElementById("currency_code").value = "USD"; var dollarAmount = "@Model.SponsorshipAmountDollars"; document.getElementById("amount").value = dollarAmount; document.getElementById("paypal").style.visibility = "visible"; document.getElementById("virgingiving").style.visibility = "hidden"; var amt = document.getElementById("amount").value; var cur = document.getElementById("currency_code").value; } catch (err) { alert(err.message);
} } if (currency == 'pounds') { try { document.getElementById("currency_code").value = "GBP"; var poundAmount = "@Model.SponsorshipAmountPounds"; document.getElementById("amount").value = poundAmount; document.getElementById("virgingiving").style.visibility = "visible"; //document.getElementById("paypal").style.visibility = "hidden"; var amt = document.getElementById("amount").value; var cur = document.getElementById("currency_code").value; } catch (err) { alert(err.message);
} } SetReturnURL();
} function SetReturnURL() { var userName = "@Model.UserName"; var numberOfStudents = "@Model.NumberOfStudents"; var sponsorshipAmountShillings = "@Model.SponsorshipAmountShillings"; var sponsorEmail = "@Model.EmailAddress";
document.getElementById("return").value = "(return URL)?userName=" + userName + "&numberOfStudents=" + numberOfStudents + "&sponsorshipAmountShillings=" + sponsorshipAmountShillings + "&sponsorEmail=" + sponsorEmail; } </script>
-------------- end javascript ----------
... View more