Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Paypal promotional code

Options
  • 23-08-2010 10:42pm
    #1
    Registered Users Posts: 601 ✭✭✭


    Hi

    I am trying to add a promotional code to paypal buttons. So when the person clicks buy and enters the correct promotional code a fixed amount or % is taken off the balance.

    Can't figure out how to do it. Is it possible?


Comments

  • Registered Users Posts: 443 ✭✭maceocc2


    Hi,

    PayPal don't have code that does this, however they do have HTML variables that you can use to apply the discount you can find those in the variable reference in the PayPal WPS developer guide.

    To dynamically apply the discount depending on a code, you would need to use a scripting language such as Javascript or PHP for example. I have added a sample piece of code below that uses Javascript:
    <html>
    <!-- Start of Script -->
    <head>
    <SCRIPT language=javascript>
    function CalculateOrder(form) {
    
     if (form.coup.value == "coup1")
     {
     form.discount_rate.value = "10";
     form.discount_rate2.value = "10";
     }
      if (form.coup.value == "coup2")
     {
     form.discount_rate.value = "15";
     form.discount_rate2.value = "15";
     }
      if (form.coup.value == "coup3")
     {
     form.discount_rate.value = "20";
     form.discount_rate2.value = "20";
     }
    }
    </SCRIPT>
    <!-- End of Script -->
    </head>
    
    <!-- Start of Button Code Form -->
    <body>
    
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target = _blank>
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="your@youremailaddress.com">
    <input type="hidden" name="item_name" value="test">
    <input type="hidden" name="amount" value="6.00">
    <input type="hidden" name="discount_rate">
    <input type="hidden" name="discount_rate2">
    <input type="text" name="coup" value="coup1">
    <input type="image" src="https://www.paypal.com//en_US/i/btn/sc-but-01.gif" border="0" onclick=CalculateOrder(this.form) name="submit" alt="PayPal - The safer, easier way to pay online!">
    
    </form>
    <!-- End of Button Code Form -->
    
    </body>
    </html>
    


  • Registered Users Posts: 601 ✭✭✭honeymonster


    Thank you for this.


Advertisement