Home content top
 
 

How do I enable users to pay money online into my Paypal account

Users can pay directly into a Standard paypal account by creating a link to your account. This can be used to take donations online. See receiving Donations on your web site for other ways you can take donations online.

 

Paypal will give you code to add to your web site that will link to your paypal account. This code however needs to be modified to work within the Insight platform. Below are instructions on how to do this.

 

Here's some typical Paypal code:

 

<form id="ppForm" method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" value="_s-xclick" name="cmd" /> <input type="hidden" value="ABCD1EFGH2IJK" name="hosted_button_id" />
<table>
<tbody>
<tr>
<td><input type="hidden" value="Tickets" name="on0" />Tickets</td>
</tr>
<tr>
<td><select name="os0">
<option value="Standard">Standard &pound;20.00</option>
<option value="Concessions">Concessions &pound;15.00</option>
</select> </td>
</tr>
</tbody>
</table>
<input type="hidden" value="GBP" name="currency_code" /> <input border="0" type="image" alt="PayPal - The safer, easier way to pay online." name="submit" src="https://www.paypal.com/en_GB/i/btn/btn_paynowCC_LG.gif" /> <img width="1" height="1" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" alt="" />
</form>

 

Making your Paypal code Insight friendly

 

To make it Insight-friendly, follow these steps:

  1. Add this javascript function to an article source.
    Don't forget to remove the opening and closing
    <script>
    tags if you're inserting the code in a pre-existing javascript code area.

    <script type="text/javascript">
    function formToUrl(btn)
    {
    var action;
    while(btn.nodeName != 'BODY' && btn.nodeName != 'FORM' && !action)
    {
    btn = btn.parentNode;
    var action = btn.action || btn.getAttribute('action');
    }
    if(btn.nodeName == 'BODY' || btn.nodeName == 'FORM') return false;
    var inputs = btn.getElementsByTagName('input');
    var selects = btn.getElementsByTagName('select');
    var textareas = btn.getElementsByTagName('textarea');
    var str = '';
    for(n = 0;n < inputs.length; ++n) str += inputs[n].name + '=' + encodeURIComponent(inputs[n].value) + '&';
    for(n = 0;n < textareas.length; ++n) str += textareas[n].name + '=' + encodeURIComponent(textareas[n].innerHTML) + '&';
    for(n = 0;n < selects.length; ++n)
    {
    for(opt = 0; opt < selects[n].options.length; ++opt)
    if(selects[n].options[opt].selected)
    str += selects[n].name + '=' + encodeURIComponent(selects[n].options[opt].value) + '&';
    }
    str = str.substr(0,str.length - 1);
    var url = action + (action.indexOf('?') == -1 ? '?' : '&') + str;
    var target = btn.target || btn.getAttribute('target');
    if(target && target != '_self')
    window.open(url, target);
    else
    self.location.href = url;
    }
    </script>

  2. Look for the <form> tags and change them to <div> tags (or <span> if you prefer). See example below.

    <div id="ppForm" method="post" action="https://www.paypal.com/cgi-bin/webscr">
    <input type="hidden" value="_s-xclick" name="cmd" /> <input type="hidden" value="ABCD1EFGH2IJK" name="hosted_button_id" />
    <table>
    <tbody>
    <tr>
    <td><input type="hidden" value="Tickets" name="on0" />Tickets</td>
    </tr>
    <tr>
    <td><select name="os0">
    <option value="Standard">Standard &pound;20.00</option>
    <option value="Concessions">Concessions &pound;15.00</option>
    </select> </td>
    </tr>
    </tbody>
    </table>
    <input type="hidden" value="GBP" name="currency_code" /> <input border="0" type="image" alt="PayPal - The safer, easier way to pay online." name="submit" src="https://www.paypal.com/en_GB/i/btn/btn_paynowCC_LG.gif" /> <img width="1" height="1" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" alt="" />
    </div>
  3. Add a hidden button to the form to stop Insight preventing you from publishing the article.

    <div id="ppForm" method="post" action="https://www.paypal.com/cgi-bin/webscr">
    <input type="hidden" value="_s-xclick" name="cmd" /><input type="hidden" value="ABCD1EFGH2IJK" name="hosted_button_id" />
    <table>
    <tbody>
    <tr>
    <td><input type="hidden" value="Tickets" name="on0" />Tickets</td>
    </tr>
    <tr>
    <td><select name="os0">
    <option value="Standard">Standard &pound;20.00</option>
    <option value="Concessions">Concessions &pound;15.00</option>
    </select> </td>
    </tr>
    </tbody>
    </table>
    <input type="hidden" value="GBP" name="currency_code" /> <input border="0" type="image" alt="PayPal - The safer, easier way to pay online." name="submit" src="https://www.paypal.com/en_GB/i/btn/btn_paynowCC_LG.gif" /> <img width="1" height="1" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" alt="" /><input type="button" style="display:none">
    </div>
  4. Add the following code – onclick="formToUrl(this)";return false – to the main button, which in this case is an <input> tag with a type="image" .

    Here's what the code will now look like:

    <div id="ppForm" method="post" action="https://www.paypal.com/cgi-bin/webscr">
    <input type="hidden" value="_s-xclick" name="cmd" /> <input type="hidden" value="JSDW3JCVG8SFG" name="hosted_button_id" />
    <table>
    <tbody>
    <tr>
    <td><input type="hidden" value="Tickets" name="on0" />Tickets</td>
    </tr>
    <tr>
    <td><select name="os0">
    <option value="Standard">Standard &pound;20.00</option>
    <option value="Concessions">Concessions &pound;15.00</option>
    </select> </td>
    </tr>
    </tbody>
    </table>
    <input type="hidden" value="GBP" name="currency_code" /> <input border="0" type="image" alt="PayPal - The safer, easier way to pay online." name="submit" src="https://www.paypal.com/en_GB/i/btn/btn_paynowCC_LG.gif" onclick="formToUrl(this);return false" /> <img width="1" height="1" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" alt="" /><input type="button" style="display:none">
    </div>

 

Tip: If you want the Paypal screen to open in a new window, add target="_blank" to the opening div (which used to be a <form> tag). E.g. <div id="ppForm" method="post" action="https://www.paypal.com/cgi-bin/webscr" target="_blank">