
Configuration
The VCredit object
The VCredit object is the main interaction point with the Storefront SDK.
VCredit.create
This call bootstraps the the Storefront SDK.
It has a single parameter, options
, which have the following properties:
Name | Type | Description |
---|---|---|
secureSessionUrl | String | *Required*. This is the path to your backend where you will call the Versatile Credit Ecommerce API to generate a session token. |
secureSessionBody | String | An optional body to send to the secureSessionUrl as JSON. This body can be an object, string, boolean, number, or function. If the body is a function, it will be invoked every time a new session token is required. |
target | String | A DOM selector string that targets the parent element of the Storefront SDK User Interface elements. The default selector is `#vcredit` or a new window if there is no #vcredit element. You can also specify a value of "_blank" to explicitly launch into a new window |
After VCredit.create
is called, the SDK will make a POST request to the secureSessionUrl, which should point to your backend. Your backend
should call the Versatile Credit Ecommerce API to
generate a session and return the response to the SDK.
Example
var vcredit = VCredit.create({secureSessionUrl: 'https://yourbackend.com/sessions',secureSessionBody: { // OptionalyourData: 'foo'},target: '_blank'})