Skip to content

Lightbox Widget

After creating a financing request and receiving the href URL, the merchant displays the WeGetFinancing application to the customer. The recommended method is a lightbox modal provided by the wegetfinancing.js widget.

CDN widget: https://cdn.wegetfinancing.com/libs/1.0/wegetfinancing.js


The widget requires jQuery. Include both in the <head> of your page:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.wegetfinancing.com/libs/1.0/wegetfinancing.js"></script>

If your site already uses jQuery, omit the first line. If another library also defines $ (e.g. Prototype), enable jQuery noConflict mode:

<script>jQuery.noConflict();</script>

For sites with jQuery < 1.9, insert the migrate plugin between the two:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-migrate-1.4.1.js"></script>
<script src="https://cdn.wegetfinancing.com/libs/1.0/wegetfinancing.js"></script>

Pass the href returned by Create Request to the WeGetFinancing constructor along with two callbacks:

var onComplete = function() {
// Called when the customer finishes all steps and gets pre-approved.
// Redirect to a thank-you or order-confirmation page.
// Do NOT create the order here — wait for the server-side postback.
window.location.href = "/order-confirmation";
};
var onAbort = function() {
// Called when the customer closes the lightbox before completing.
// Offer the option to retry or choose a different payment method.
};
new WeGetFinancing(href, onComplete, onAbort);

Disable the checkout button for a few seconds after the first click to avoid creating duplicate requests:

<a href="#" id="wgf_checkout">Checkout with WeGetFinancing</a>
<script>
$("#wgf_checkout").one("click", function(e) {
e.preventDefault();
var btn = $(this);
// Re-enable after 5 seconds to allow retry
setTimeout(function() {
btn.one("click", function(ev) {
ev.preventDefault();
openWeGetFinancing();
});
}, 5000);
openWeGetFinancing();
});
function openWeGetFinancing() {
var href = "/* href returned by your server */";
new WeGetFinancing(href, onComplete, onAbort);
}
</script>

If the customer closes the lightbox and the cart data has not changed, the same href URL can be reused to re-open the application.


For platforms where a JavaScript lightbox is not practical:

<iframe
id="wgf_iframe"
src="https://partner.wegetfinancing.com/partner/loan/[YOUR_MERCHANT_ID]"
frameborder="0"
width="100%"
height="900px">
</iframe>

Query string parameters can be passed to pre-fill the form — see Link Integration.