Versatile Logo
IntroductionGetting StartedUsing The SDKConfigurationFlowsAPI Reference

Getting Started

Using The SDK

Include the SDK Script

The SDK script should be placed at the body of the <body> tag.

<script src="https://js.versatilecredit.com/js/commerce/storefront-sdk-0.9.1.min.js"></script>

Create the VCredit object

var vcredit = VCredit.create({
secureSessionUrl: 'https://yourbackend.com/sessions'
target: '_blank'
})

Register Listeners

vcredit.on('ready', function () {
console.log('VCredit ready')
})
vcredit.on('application.end', function (event) {
console.log('Application Result: ', event.data);
})
vcredit.on('flow.end', function (event) {
console.log('Flow End')
})

Launch a Flow

vcredit.launch('application', {
prefill: {
primaryApplicant: {
firstName: "John",
lastName: "Smith"
}
}
})