eCommerce Integration
Section 4: Include the eLayaway Calculator
The calculator is a required part of the integration process and cannot be bypassed. It extracts data from all of the previously created fields to allow your customer to calculate their payment schedule. It then modifies the appropriate fields and submits your new form to the secure eLayaway checkout process. Including the calculator within the eCommerce Integration package is as easy as copying and pasting some generated JavaScript. You will also need to download and host a button image.
Complete the following steps:
1. Include the eLayaway client library (eLayaway uses a single namespace and will have no effect on existing javascript). Place the following JavaScript on your cart's page:
2. Add the following lines of HTML code to the body of the page. The code should be placed outside of the previously created form. Note: The fields listed are explained in detail further down on this page.
Field Descriptions
Once you have copied the above HTML to the body of your checkout page, you will have to modify the calculator's variables in each field that is described below. Please read the description for detailed information on each field:
| Field | Description | Inclusion |
|---|---|---|
| amount | This field is used by the calculator to display the monthly payment amount. It specifies a string containing DOM IDs or classes that are inspected to determine the total amount. (e.g. '#amount_1 * #quantity_1') Any DOM ID or IDs within your cart page may be referenced so how this value is obtained is flexible. Note that this value does not alter the total which is passed through to our checkout, merely what appears in the calculator. | Required |
| merchant_name | Specify the name you would like to appear in the calculator. 'BE SURE TO ONLY USE SINGLE QUOTES.' | Required |
| max_lay_length | The maximum number of months you would like to offer your products on eLayaway. Default is 12. | Required |
| min_lay_length | The minimum number of months you would like to offer your products on eLayaway. Default is 2. No eLayaway orders can be less than 2 months. | Required |
| eci_form | The DOM ID of the HTML form which you just created. In the previous steps this ID was set to "eci_form" however this may be modified if for some reason this ID conflicts with a pre-existing ID in your cart. | Required |
| months_field | The DOM ID of field named 'months' that will be posted as part of the ECI transaction. (The customer chosen months value is written to this field just before the form is submitted) | Required |
| payment_frequency | The DOM ID of field named 'payment_frequency' that will be posted as part of the ECI transaction. (The customer chosen payment frequency is written to this field just before the form is submitted) | Required |
| currency_code | The international currency code for the type of currency used in the transaction. At this time eLayaway only accepts U.S. dollars, so set this value to 'USD'. | Required |
| src="ImageLocation" | Image location for eLayaway button. Replace ImageLocation with the URL of the image you choose to use. | Required |
Select Your Button
You will need to download an appropriate image from your eLayaway merchant account. The image location will then need to be added to the src="Image Location" portion of the preceding code.
Note: Please review our accepted graphics standards if you need to alter the button to fit on your site.
Here are the eLayaway buttons to choose from:
eLay_L_Now_194x137
eLay_M_Now_162x32
eLay_S_Now_125x24
eLay_L_Checkout_225x41
eLay_M_Checkout_169x29
eLay_S_Checkout_140x25
Move on to Section 5: Testing
You have now completed eCommerce Integration.