Append parameters to your URL
For example your URL to your donation form is: http://www.myorga.com/donate.html so you can just append the parameters to your URL.
- pro: this is the most easiest way
- con: the parameters are visible to the user, so of course these can be manipulated in the URL
http://www.myorga.com/donate.html?amount=12.34&interval_fix=6&fb_item_id=789
Append parameters to your Javascript-Embed-Code
If you want to do a "hidden" prepopulation you can also add the parameters to your embed code. This is helpful e.g. to set default values or if you don't want the parameters to appear in the URL.
<script type="text/javascript" src="https://api.fundraisingbox.com/app/paymentJS?hash={your_form_hash}&amount=12.34&interval_fix=6&fb_item_id=789"></script>
Use session for prepopulation
After you created a session with the Session-API you can append the session hash to prepopulate the the form. Use the parameter "fbSessionHash" to do this.
http://www.myorga.com/donate.html?fbSessionHash={your_session_hash}
Donation box example
Place this donation box widget on your site. If the user fills out the amount and clicks „donate now“, he/she is automatically forwarded to the corresponding donation form. All details from the donation box are already prepopulated.
<input id="amount" />
<select id="interval">
<option value="1">monthly</option>
<option value="0">once</option>
</select>
<input type="submit" value="donate now" onclick="processFormData(); return false;" />
<script type="text/javascript">
function processFormData()
{
var embedUrl = 'http://www.myembedurl.com/donate'; // url to your form
var amount_element = document.getElementById('amount');
var interval_element = document.getElementById('interval');
var interval = interval_element.value;
var amount = amount_element.value;
if(amount == '')
{
alert("Please enter an amount.");
}
else
{
location.href = embedUrl+'?amount='+amount+'&interval='+interval;
}
}
</script>