Versatile Logo
IntroductionGetting StartedConfigurationFlowsAvailable FlowsLaunching FlowsApplication FlowCheckout FlowLookup FlowAPI Reference

Flows

Flows are UI experiences provided by the SDK that can be launched from your website.

Available Flows

The available flows are the following

  • application - A financing application where the user can apply for financing with one or more providers.
  • checkout - Provides the user experience need to authorize a financed purchase
  • lookup - Provides the user experience to locate a financing account

Launching Flows

var vcredit = VCredit.create({
secureSessionUrl: 'https://yourbackend.com/sessions',
target: '_blank'
})
vcredit.on('ready', function () {
vcredit.launch('application')
})

Application Flow

This flow launches a credit application in an iFrame.

Options

NameTypeDescription
prefillObjectPrefill data for the application
prefill.expectedPurchaseAmountIntegerExpected Purchase Amount in Cents
prefill.primaryApplicantApplicantPrimary Applicant (see Applicant table below)
prefill.jointApplicantApplicantJoint Applicant (see Applicant table below)
modeStringApplication mode, `full` or `prequalify`. The default mode is full. Please note that `prequalify` is not available in all cases.
prequalificationIdUUIDId of the pre-qualification, which is also used for prefill. Any other field specified, will override the values in the pre-qualification
directToLtoBooleanIf true, this will trigger the application to skip directly to the first Lease-to-own provider in the cascade.
checkoutObjectThe same options passed into to the checkout. If this is set, the user will be able to directly transition to a checkout flow

Applicant Object Fields

NameTypeDescription
firstNameStringApplicant First Name
lastNameStringApplicant Last Name
middleInitialStringApplicant Middle Initial
addressAddressApplicant Street address. See Address Table below
emailStringApplicant Email Address
dateOfBirthStringApplicant Date of Birth. Format is YYYY-MM-DD
homePhoneStringApplicant home phone number
mobilePhoneStringApplicant mobile phone number
workPhoneStringApplicant work phone number

Address Object Fields

NameTypeDescription
addressLine1StringFirst line of address
addressLine2StringSecond line of address
cityStringAddress city
stateString2-digit state code
postalCodeStringZip Code

Events

application.start

Fired when the application has started.

application.end

Fired when the application is completed. The data that is returned contains the following fields:

NameTypeDescription
statusStringThe status code of the application, one of: approved, declined, pending, error, canceled, abandoned
applicationIdUUIDVersatile-assigned id of the application created. This id can be passed to your backend to lookup details
accountIdUUIDVersatile-assigned accountId
amountIntegeramount approved in cents

application.{status}

A version of the application.end event that's fired for a specific status. For example, application.approved is fired when the application has been approved. This allows the client to avoid conditional status logic.

prequalification.start

Fired when the pre-qualification view is displayed. This event is fired for every pre-qualification in the cascade.

prequalification.end

Fired when the pre-qualification is done. This event is fired for every pre-qualification in the cascade. The data that is returned contains the following fields:

NameTypeDescription
statusStringThe status code of the pre-qualification, one of: prequalified, nooffer, error, canceled, abandoned
prequalificationIdUUIDAn identifier that can be used to prefill an application

prequalification.{status}

A version of the prequalification.end event that's fired for a specific status. For example, prequalification.prequalified is fired when the user has been pre-qualified. This allows the client to avoid conditional status logic.

Example

var vcredit = VCredit.create({
secureSessionUrl: 'https://yourbackend.com/sessions'
})
vcredit.on('application.end', function(event) {
post('https://yourbackend.com/application/result', event.data)
event.element.destroy()
});
vcredit.on('application.approved', function(event) {
event.element.destroy()
});
vcredit.launch('application', {
prefill: {
expectedPurchaseAmount: 100000, // $1000
primaryApplicant: {
firstName: "John",
middleInitial: 'C',
lastName: "Smith",
address: {
addressLine1: '4900 Ritter Rd',
addressLine2: 'Apt 4',
city: 'Mechanicsburg',
state: 'PA',
postalCode: '17055'
},
email: 'johnsmith@fakemail.net',
dateOfBirth: '1991-01-01',
homePhone: '5556667777',
mobilePhone: '5556667777',
workPhone: '5556667777'
},
jointApplicant: {
// ...
}
}
})

Checkout Flow

This flow launches a checkout UI used to prepare a payment.

Options

NameTypeDescription
applicationIdUUIDIf set, the checkout will use the account associated with the application
accountIdUUIDIf set, the customer account id will be used
amountIntegeramount in cents representing the total purchase price
invoiceNumberStringa number that can be used to track the order with the provider
paymentModeStringIndicates how payments are covered.A value of 'full' indicates that the payment is expected to be fully covered by the amount. A value of 'split' indicates that payment will either cover the lesser of the full amount or the open to buy. Default value is 'full'.
itemsArray<item>A list of order items
items[].categoryStringOrder item Category (eg. Electronics)
items[].productCodeStringOrder item product code
items[].priceIntegerOrder item unit price in cents
items[].quantityIntegerOrder item quantity
skipVerificationBooleanIf true, skips account verification. Only applicable if either accountId or applicationId is set
shippingAddressAddressA customer shipping address
shippingAddress.firstNameStringThe address's first name
shippingAddress.lastNameStringThe address's last name
shippingAddress.addressLine1StringAddress line 1
shippingAddress.addressLine2StringAddress line 2
shippingAddress.cityStringAddress city
shippingAddress.stateStringAddress 2-digit state
shippingAddress.postalCodeStringAddress Zip
customObjecta map holding custom data that will be returned on the checkout.end event

Events

checkout.start

Fire when the checkout flow has started.

checkout.end

Fired when the checkout flow is completed. The data that is returned contains the following fields:

NameTypeDescription
statusStringThe status code of the checkout, one of: success, canceled, error
checkoutIdUUIDVersatile-assigned id of the checkout created. This id should be passed to your backend to complete the checkout and create a payment
accountNumberLast4StringLast 4 digits of account number
providerPlanCodeStringThe provider's plan identifier
splitPaymentBooleanFlag whose true value indicates that payment was partially covered. In 'full' paymentMode, this is always false.
amountCoveredIntegerThe amount (in cents) that was covered by the checkout. In 'full' paymentMode, this is always the amount passed into to the checkout flow. In 'split' paymentMode, this is the lesser of the amount and the open to buy.
customObjectthe custom map passed into the options for checkout
signaturesArray<Signature>array of electronic signatures
signatures[].datetimeStringISO 8601 date/time of the signature
signatures[].bodyStringsignature body
termsArray<Term>array of terms/disclosures that were agreed to during checkout
terms[].bodyStringterms verbiage

checkout.{status}

A version of the checkout.end event that's fired for a specific status. For example, checkout.success is fired when the user has successfully completed the checkout process.

Example

var vcredit = VCredit.create({
secureSessionUrl: 'https://yourbackend.com/sessions'
})
vcredit.on('checkout.end', function(event) {
var result = event.data
console.log('Status:', result.status, 'Checkout Id:', result.checkoutId)
});
vcredit.launch('checkout', {
amount: 80000,
applicationId: "asdf9kj234243432",
invoiceNumber: "1234",
items: [
{
"productCode": "9213i499843",
"description": "couch"
"price": 80000,
"quantity": 1
}
],
shippingAddress: {
"addressLine1": "300 Welcome Way",
"city": "Mechanicsburg"
"state": "PA"
"postalCode": "17050"
}
})

Lookup Flow

This flow performs an account lookup.

Options

There are no options at this time.

Events

account.lookup

Fired when a search has been performed. The data that is returned contains the following fields.

NameDescription
statusOne of `found`, `notfound`, `error`
accountIdThe id of the account, if any.

account.{status}

Variation of account.lookup that fires on the specified status. For example, account.found is fired only when an account has been found.

Example

var vcredit = VCredit.create({
secureSessionUrl: 'https://yourbackend.com/sessions'
})
vcredit.on('account.lookup', function(event) {
var result = event.data
console.log('Status:', result.status, 'Account Id:', result.accountId)
});
vcredit.launch('lookup', {})