Embedding for Developers

If you have a stronger knowledge of HTML and Javascript, you may prefer to tweak our embed code to fit your specific requirements. This page will help you. If not, refer to our embedding wizard for a pain-free installation.

Base Code

All installations require the following piece of code, preferably just before the </body> tag in your HTML document. It is used to allow everything else to work. Do not edit this code.

<script type="text/javascript">
(function(){
	var node = document.createElement("script");
	node.setAttribute("type", "text/javascript");
	node.setAttribute("src", "https://www.landlordsecure.co.uk/js/integration.js");
	document.getElementsByTagName("head")[0].appendChild(node);
})();
</script>

Modifiable Options

The behaviour of the widget can be modified by tweaked the json array ls_options which needs to be declared before your the base code script has loaded. The following is a simple example demonstrating how the options can be used to display an instant reference form on your page.

<div id="reference-form"></div>
<script type="text/javascript"<
var ls_options = {
	mode: 'iframe',
	product: "instant",
	iframe_container: 'reference-form',
	iframe_autoresize: true,
	api_key: 'YOUR_API_KEY' };
</script>

Option Values

The follwoing table describes each option in detail...

Option Default Description Required
mode (string) "iframe" Determines the basic behaviour of the widget. Currently, only "iframe" is accepted. Yes
product (string) null The product or page to be displayed. The following options are available:
References: 'instant', 'express', 'comprehensive', 'advanced', 'guarantor'
Insurance: 'rg'
Pages: 'page_products', 'page_documents'
Yes
api_key (string) "API_KEY" The API key unique to each agent. Your unique ID can be found at the bottom of this page. Yes
allow_credits (bool) false Not Recommended When true, allows end-user to pay by credits that you have pre-purchased. Respects broker configuration for security. No
prepopulate_data (Array) null Product-dependant array object be used to pre-populate forms using your own data. See Below No
prepopulate_restrict (Bool) false If enabled, the fields that have been populated using prepopulate_data will not be editable by the user. No

If in iframe mode...

Option Default Description Required
iframe_container (string) null Inserts contents of iframe into the element with the ID provided. Yes
iframe_stylesheet (string) false Enter a direct link to a CSS stylesheet on your own server which allows you to apply some custom branding to your forms No
iframe_autoresize (bool) true Recommended If set to true, the iframe will automatically size itself to fit inside the iframe_container. If false, you will need to resize the iframe yourself using CSS or javascript. No

Pre-populating forms

The prepopulate_data field is used to populate forms, each form is unique and the data you provide will need to in a unique format.


Select which type of product you need to prepopulate to view the format. For an explanation of the fields, you may wish to refer to their respective forms on our website, as they are directly related.

prepopulate_data: { reference: {
// Applicant data
applicant: [{
title: "Mr", // Mr | Miss | Mrs | Ms | Dr
first_name: "",
last_name: "",
telephone_number: "",
mobile_number: "",
e_mail_address: "",
proposed_monthly_rent: "", // string|int

// Note: accepts multiple addresses
address_history: [
		{
			address: {
				apartment_number: "",
				building_number: "",
				street: "",
				town: "",
				county: "",
				post_code: ""
			},
			from: { Date_Month: "01", Date_Year: "1970" },
			to: { Date_Month: "01", Date_Year: "1970" },
			rent: ""
		}
],

dobDay: "01", dobMonth: "01", dobYear: "1970", // Date of Birth
NI_number: "",
bank_sort_code: "",
bank_account_no: "",
adverse_credit_history: "0", // 0 | 1 - 0 = Applicant declared good history
has_ccjs: "0", // 0 | 1 - 1 = Applicant has declared CCJS

residential_status: "private_tenant", // private_tenant | family_friends | property_owner
defaulted_on_mortgage_payments: "", // Only required if property owner - 1 = Applicant has defaulted on mortgage payments

// Employment Information - Only required if comprehensive or guarantor reference
employment_status: "employed", // employed | self | self_noaccountant | retired | dss | unemployed
employed: {
	company: "",
	employer_address_id: {
		apartment_number: "",
		building_number: "",
		street: "",
		town: "",
		county: "",
		post_code: ""
	},
	contact_name: "",
	contact_position: "",
	contact_phone: "",
	contact_fax: "",
	contact_email: "",
	position: "",
	gross_income: "",
	other_income: ""
},
employed_fromMonth: "",
employed_fromYear: "",

// Accountant Data - only required if employment_status = self
accountant: {
	company_name: "",
	contact_name: "",
	phone: "",
	fax: "",
	email: "",
	gross_income: "",
	other_income: ""
},
accountant_fromMonth: "01",	accountant_fromYear: "1970",


employment: {
	savings: "",	// Value of savings
	notes: ""	// Additional notes about applicant's employment/income
},

// Previous Landlord Information - Only required if Comprehensive reference
landlord: {
	name: "",
	email: "",
	phone: "",
	fax: "",
	address_id: {
		apartment_number: "",
		building_number: "",
		street: "",
		town: "",
		county: "",
		post_code: ""
	}
}
}],

// Proposed Property data
risk_address: {
property_id: {
	apartment_number: "",
	building_number: "",
	street: "",
	town: "",
	county: "",
	post_code: ""
},
num_bedrooms: "",
agent_ref: ""
},
move_in_dateDay: "01", move_in_dateMonth: "01", move_in_dateYear: "1970",

// Proposed Property Landlord
landlord: {
user_role:"tenant", // tenant | landlord
name: "",
email: "",
phone: "",
address_id: {
	apartment_number: "",
	building_number: "",
	street: "",
	town: "",
	county: "",
	post_code: ""
}
}

}}