
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
Name | Type | Description |
---|---|---|
prefill | Object | Prefill data for the application |
prefill.expectedPurchaseAmount | Integer | Expected Purchase Amount in Cents |
prefill.primaryApplicant | Applicant | Primary Applicant (see Applicant table below) |
prefill.jointApplicant | Applicant | Joint Applicant (see Applicant table below) |
mode | String | Application mode, `full` or `prequalify`. The default mode is full. Please note that `prequalify` is not available in all cases. |
prequalificationId | UUID | Id of the pre-qualification, which is also used for prefill. Any other field specified, will override the values in the pre-qualification |
directToLto | Boolean | If true, this will trigger the application to skip directly to the first Lease-to-own provider in the cascade. |
checkout | Object | The 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
Name | Type | Description |
---|---|---|
firstName | String | Applicant First Name |
lastName | String | Applicant Last Name |
middleInitial | String | Applicant Middle Initial |
address | Address | Applicant Street address. See Address Table below |
String | Applicant Email Address | |
dateOfBirth | String | Applicant Date of Birth. Format is YYYY-MM-DD |
homePhone | String | Applicant home phone number |
mobilePhone | String | Applicant mobile phone number |
workPhone | String | Applicant work phone number |
Address Object Fields
Name | Type | Description |
---|---|---|
addressLine1 | String | First line of address |
addressLine2 | String | Second line of address |
city | String | Address city |
state | String | 2-digit state code |
postalCode | String | Zip 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:
Name | Type | Description |
---|---|---|
status | String | The status code of the application, one of: approved, declined, pending, error, canceled, abandoned |
applicationId | UUID | Versatile-assigned id of the application created. This id can be passed to your backend to lookup details |
accountId | UUID | Versatile-assigned accountId |
amount | Integer | amount 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:
Name | Type | Description |
---|---|---|
status | String | The status code of the pre-qualification, one of: prequalified, nooffer, error, canceled, abandoned |
prequalificationId | UUID | An 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, // $1000primaryApplicant: {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
Name | Type | Description |
---|---|---|
applicationId | UUID | If set, the checkout will use the account associated with the application |
accountId | UUID | If set, the customer account id will be used |
amount | Integer | amount in cents representing the total purchase price |
invoiceNumber | String | a number that can be used to track the order with the provider |
paymentMode | String | Indicates 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'. |
items | Array<item> | A list of order items |
items[].category | String | Order item Category (eg. Electronics) |
items[].productCode | String | Order item product code |
items[].price | Integer | Order item unit price in cents |
items[].quantity | Integer | Order item quantity |
skipVerification | Boolean | If true, skips account verification. Only applicable if either accountId or applicationId is set |
shippingAddress | Address | A customer shipping address |
shippingAddress.firstName | String | The address's first name |
shippingAddress.lastName | String | The address's last name |
shippingAddress.addressLine1 | String | Address line 1 |
shippingAddress.addressLine2 | String | Address line 2 |
shippingAddress.city | String | Address city |
shippingAddress.state | String | Address 2-digit state |
shippingAddress.postalCode | String | Address Zip |
custom | Object | a 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:
Name | Type | Description |
---|---|---|
status | String | The status code of the checkout, one of: success, canceled, error |
checkoutId | UUID | Versatile-assigned id of the checkout created. This id should be passed to your backend to complete the checkout and create a payment |
accountNumberLast4 | String | Last 4 digits of account number |
providerPlanCode | String | The provider's plan identifier |
splitPayment | Boolean | Flag whose true value indicates that payment was partially covered. In 'full' paymentMode, this is always false. |
amountCovered | Integer | The 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. |
custom | Object | the custom map passed into the options for checkout |
signatures | Array<Signature> | array of electronic signatures |
signatures[].datetime | String | ISO 8601 date/time of the signature |
signatures[].body | String | signature body |
terms | Array<Term> | array of terms/disclosures that were agreed to during checkout |
terms[].body | String | terms 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.dataconsole.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.
Name | Description |
---|---|
status | One of `found`, `notfound`, `error` |
accountId | The 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.dataconsole.log('Status:', result.status, 'Account Id:', result.accountId)});vcredit.launch('lookup', {})