Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is the method I use to create discount coupons for PayPal buttons:</p> <p>Use this code for your button:</p> <pre><code>&lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="this.target = 'paypal'; return ReadForm (this);"&gt; &lt;input type="hidden" name="cmd" value="_xclick" /&gt; &lt;input type="hidden" name="add" value="1" /&gt; &lt;input type="hidden" name="business" value="YOUR MERCHANT ACCOUNT ID NUMBER HERE" /&gt; &lt;input type="hidden" name="item_name" value="10 sessions" /&gt; &lt;input type="hidden" name="amount" value="773.00" /&gt; &lt;input type="hidden" name="currency_code" value="USD" /&gt; &lt;input type="hidden" name="baseamt" value="773.00" /&gt; &lt;input type="hidden" name="basedes" value="10 sessions" /&gt; Enter Coupon code &lt;input type = "text" size = "10" name = "coupcode"; /&gt; &lt;input type="button" value="Check code" onclick="coupval =this.form.coupcode.value; ChkCoup();" /&gt;&lt;br/&gt;&lt;br/&gt; &lt;input type="image" id="xx" disabled="disabled" 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!"&gt; &lt;img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/scr/pixel.gif" width="1" height="1"&gt; &lt;/form&gt; </code></pre> <p>Create a Javascript file and copy and paste this code into it:</p> <pre><code>&lt;!-- var discnt = 0; // no default percent discount var coupons = new Array ( // place to put coupon codes "coup1", // 1st coupon value - comma seperated "coup2", // 2nd coupon value - add all you want "coup3" // 3rd coupon value ); var coupdc = new Array ( // place to put discounts for coupon vals 5, 10, 15 ); var coupval = "(blanket)"; // what user entered as coupon code function ChkCoup () { // check user coupon entry var i; discnt = 0; // assume the worst for (i=0; i&lt;coupons.length; i++) { if (coupval == coupons[i]) { discnt = coupdc[i]; // remember the discount amt alert ("Valid coupon number! \n\n" + discnt + "% discount now in effect."); return; } } alert ("'" + coupval + "' is not a valid code!"); } function Dollar (val) { // force to valid dollar amount var str,pos,rnd=0; if (val &lt; .995) rnd = 1; // for old Netscape browsers str = escape (val*1.0 + 0.005001 + rnd); // float, round, escape pos = str.indexOf ("."); if (pos &gt; 0) str = str.substring (rnd, pos + 3); return str; } function ReadForm (obj1) { // apply the discount var amt,des; amt = obj1.baseamt.value*1.0; // base amount des = obj1.basedes.value; // base description if (discnt &gt; 0) { // only if discount is active amt = Dollar (amt - (amt * discnt/100.0)); des = des + ", " + discnt + "% dis, COUP = " + coupval; } obj1.amount.value = Dollar (amt); obj1.item_name.value = des; } //--&gt; </code></pre> <p>Save the file as discount.js or whatever you want it to be called and upload it to your server. Then call the script by putting this line in the &lt; head > section of your website:</p> <pre><code>&lt;script type="text/javascript" src="http://yourwebsite.com/discount.js"&gt;&lt;/script&gt; </code></pre> <p>You can read the blog post I wrote on this topic at <a href="http://icode4you.net/how-to-create-a-coupon-discount-for-paypal-buttons" rel="nofollow">http://icode4you.net/how-to-create-a-coupon-discount-for-paypal-buttons</a> for more information on how to specify your discount passwords and the discount amounts that are applied when the correct password is entered, as well as how to pack the Javascript to make your passwords more secure.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload