Team Gravity,
I'm hoping to get some help on how to implement a percentage discount code hack using a javascript option that I found on PayPal's development site. While this is designed to use hidden os0 and os1 values passed through a custom payment button, I've got to think there would be a way to mimic the behavior, just not sure how to implement it.
Here's the script:
<script language="JavaScript" >
var coup1="mydiscount";
var coup2="GOLD15";//you can use this for other discount codes
var coup3="GOLD20";
function CalculateOrder(form) {
if (form.text1.value == coup1)
{
form.discount_rate.value = "20";
form.discount_rate2.value = "20";
form.os1.value = "Discount 20%";
}
//determine the amount based on selection
if (form.text1.value == coup2)
{
form.discount_rate.value = "15";
form.discount_rate2.value = "15";
form.os1.value = "Discount 20%";
}
if (form.text1.value == coup3)
{
form.discount_rate.value = "20";
form.discount_rate2.value = "20";
form.os1.value = "Discount 20%";
}
//determine amount and name of product
if (form.baseoption.value == "23")
{
form.os0.value ="23 Day Diet (2 bottles)";
form.amount.value = 155;
}
if (form.baseoption.value == "40")
{
form.os0.value ="40 Day Diet (3 bottles)";
form.amount.value = 225;
}
if (form.baseoption.value == "1")
{
form.os0.value ="Single Bottle";
form.amount.value = 80;
}
if (selIndex == 1)
{
form.amount.value = Dollar (option1);
}
}
</script>
and the corresponding buy now button code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="xxxxxxxxxxxxxxxxxxxxxxxxxx"><<<<<<<business email addr or id
<input type="hidden" name="discount_rate">
<input type="hidden" name="discount_rate2">
<input type="hidden" name="item_name" value="--need name of item--">
<table>
<tr><td><input type="hidden" name="on0" value="SkinnyUp! HCG Drops">SkinnyUp! HCG Drops</td></tr>
<tr><td>
<input type="hidden" name="os0">
<select name="baseoption">
<option value="23">23 Day Diet (2 bottles) $155.00</option>
<option value="40">40 Day Diet (3 bottles) $225.00</option>
<option value="1">Single Bottle $80.00</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="Coupon Code">Coupon Code</td></tr>
<tr><td><input type="text" name="text1" maxlength="60"><input type="hidden" name="os1"></td></tr>
</table>
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" onclick="CalculateOrder(this.form)" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
BTW - I've spent the better part of today looking through the forum and the gf hooks suggested by Carl to accomplish this, but without guidance on where to insert new or modify exisitng code, I'm really at a loss.