Starting the Apply Flow
- Add the following code to the area on your page where you would like the Apply Now button to appear:
<img class="my-chargeafter-apply-button" src="https://progleasing.com/sites/progleasingsite/files/prog-web-11-205x42-Apply-Now-Wh02.jpg">
<style>.my-chargeafter-apply-button{cursor: pointer;}</style>
- Add the following script to the bottom of the page:
<script>
// Init ChargeAfter Apply
function presentApply() {
const opt = {
// optional configurations
};
ChargeAfter.apply.present(opt);
}
// Add event listener
function onScriptLoaded() {
const applyButtonElements = document.querySelectorAll('.my-chargeafter-apply-button');
applyButtonElements.forEach(function(el) {
el.addEventListener('click', function(e) {
presentApply();
});
});
}
// Load ChargeAfter SDK
function onLoadChargeAfterSDKScript() {
var config = {
// Required: if not provided the SDK will not be initilized
apiKey: 'public-api-key',
onLoaded: onScriptLoaded
};
ChargeAfter.init(config);
}
var script = document.createElement('script');
script.src = 'https://cdn.chargeafter.com/web/v2/chargeafter.min.js?t=' + Date.now();
script.type = 'text/javascript';
script.async = true;
script.onload = onLoadChargeAfterSDKScript;
document.body.appendChild(script);
</script>
- Update line 24 with your Public API Key.
- Your done!
Updated 4 months ago