Checkout SDK
The FFL checkout SDK is designed to integrate FFL dealer selection interface into any client side javascript based application. The SDK expects only few set of parameters, and it opens the dealer list into an iframe. When user selects the FFL dealer, it returns the information of selected dealer on a provided callback.
Usage
Include the SDK into head
The SDK is deployed on CDN and can be directly included using script tag, preferably inside head element.
<script src="https://libs.masterffl.com/ffl-select/select-sdk/17.0.0/ffl-select-sdk.js" async=true></script>Initialize the SDK with options
SDK exposes a dealer selector class, which can be simply used as follows:
const fflSelect = new FFLCheckoutSDK.FFLDealerSelector(zipCode, containerId, storeDomain, dealerSelectionCallback, options);The meaning of each parameter is described below:
| Parameter Name | Description | Example |
|---|---|---|
| zipCode | A valid US zipcode where you want the SDK to show the dealer list. | 30075 |
| containerId | A selector which can be used as a parent element, under which SDK creates an iframe. | #dealer-selector-parent |
| storeDomain | The domain of your store, this is used for licensing purpose. This typically must match the domain of your page, otherwise handshake will fail. | masterffl.com |
| dealerSelectionCallback | A javascript callback where SDK notifies you when the dealer is selected. | |
| options | A list of options to alter the default SDK behavior. A full list of options is documented in the next section. |
Full list of SDK options
| Option | Description | Default | Examples |
|---|---|---|---|
| googleMapKey | A google map key which is required to enable the map view in dealer selection. If this is not provided, map view will not be available. | ||
| distance | The distance in miles which should be used to search the dealers. A valid value is in between 1-50. | 10 | |
| onlyNFADealers | If this is true, then SDK will only show the dealers who are capable to process NFA transfers. | false | |
| includeAcceptingNonFFLSellers | By default, the dealers who do not accept transfers from non-ffl sellers (individuals), are excluded in the listing. This can be overridden by passing true to this option. | false | |
| headerColor | The color of the dialog header. You can specify any valid RGB color in hex format. | #000000 | #FF0000 |
| buttonColor | The color of the selection button. You can specify any valid RGB color in hex format. | #000000 | #FF0000 |
| envMode | The environment to be used for dealer list. By default it points to production, but can be switched to lower environment for initial testing. | prod | qa/prod |
| allowZipCodeEdits | When set to True the zip code input should be enabled and user can edit the zip code. | false | |
| hideHeader | Hides the dialog header when set to true. Useful when the host application already provides its own header and wants to maximize available space. | false |
To show the FFL selection dialog, just use the show method:
fflSelect.show();A full Example
const fflSelect = new FFLCheckoutSDK.FFLDealerSelector('30075', '#dealer-selector-parent', 'masterffl.com', (dealer) => {}, {distance: 20});
fflSelect.show();Working with the callback
As mentioned above, SDK accepts a Javascript callback, which returns the selected dealer information. Callback is a standard Javascript function with just one parameter, which contains the dealer attributes. The schema of the dealer object is as follows:
{
fflLicenseNumber: string,
tradeName: string,
contact: {
phoneNumber: string,
address: {
street1: string,
city: string,
state: string,
zipCode: string,
}
},
isOptedOutForTransferFromNonFFLSeller: true,
masterFFLTransferPIN: string
}Updated 3 months ago