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/18.3.1/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. | ||
| includeOnlyWithTags | A list of network dealer tag IDs. Only dealers that have at least one of these tags are shown. | ['tag-id-1', 'tag-id-2'] | |
| excludeWithTags | A list of network dealer tag IDs. Dealers that have any of these tags are hidden. | ['tag-id-3'] | |
| 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 | |
| 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 | |
theme | Optional colors for the dealer list. Passed on the iframe URL as theme. Only the colors you set are overridden. Each value is a hex color, #RGB or #RRGGBB. | theme | |
theme.cardIconsColor | Dealer card inline SVG icons. Image icons, green opt-in, and red opt-out stay unchanged. | #0C1E46 | #E21A22 |
theme.mapListViewSwitcherColor | Active Map View / List View switcher background. Inactive tab stays white. | #0C1E46 | #F5F5F5 |
theme.buttonColor | Select, Requires PIN, Show all, and Expand buttons. | #0C1E46 | #E21A22 |
theme.zipCodeColor | "ZIP Code" label and value on the results line. Does not color the search input. | #0090C6 | #000000 |
theme.filterBackgroundColor | Filter panel and filter chips. | #FFFFFF | #F5F5F5 |
theme.filterByBackgroundColor | Filter By button background, including hover. This button does not change color on hover. | #D7EBF9 | #F5F5F5 |
theme.filterByTextColor | Filter By label and Filter By icon. | #0090C6 | #E21A22 |
theme.filterIconColor | Checkbox icons inside the filter. | #CECECE | #E21A22 |
theme.filterRadioColor | Filter and sort radio buttons. | #E2E8F0 | #E21A22 |
theme.filterHoverColor | Hover inside the filter, sort list, and distance menu. Does not change the Filter By button. | #0090C6 | #E21A22 |
theme.filterLinkColor | Restore and Save links under the filter row. | #0090C6 | #E21A22 |
theme.searchIconColor | Icon inside the search field. | #0090C6 | #333333 |
theme.cardHeaderBackgroundColor | Dealer card header background. | #E1E9FF | #333333 |
theme.cardBorderColor | Border around the dealer card. A selected card keeps its green border. | #E7E7E9 | #333333 |
theme.cardIconBorderColor | Border of the phone and social icons on the dealer card. | #E7E7E9 | #333333 |
theme.buttonBorderColor | Border of the Select and PIN buttons on the dealer card. | #000000 | #333333 |
theme.headerColor | The color of the dialog header. You can specify any valid RGB color in hex format. | #000000 | #E21A22 |
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,
theme: {
cardIconsColor: '#E21A22',
filterByTextColor: '#E21A22',
filterByBackgroundColor: '#F5F5F5'
}
}
);
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 about 1 month ago