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 NameDescriptionExample
zipCodeA valid US zipcode where you want the SDK to show the dealer list.30075
containerIdA selector which can be used as a parent element, under which SDK creates an iframe.#dealer-selector-parent
storeDomainThe 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
dealerSelectionCallbackA javascript callback where SDK notifies you when the dealer is selected.
optionsA 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

OptionDescriptionDefaultExamples
googleMapKeyA 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.
includeOnlyWithTagsA list of network dealer tag IDs. Only dealers that have at least one of these tags are shown.['tag-id-1', 'tag-id-2']
excludeWithTagsA list of network dealer tag IDs. Dealers that have any of these tags are hidden.['tag-id-3']
distanceThe distance in miles which should be used to search the dealers. A valid value is in between 1-50.10
onlyNFADealersIf this is true, then SDK will only show the dealers who are capable to process NFA transfers.false
includeAcceptingNonFFLSellersBy 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
envModeThe environment to be used for dealer list. By default it points to production, but can be switched to lower environment for initial testing.prodqa/prod
allowZipCodeEditsWhen set to True the zip code input should be enabled and user can edit the zip code.false
hideHeaderHides the dialog header when set to true. Useful when the host application already provides its own header and wants to maximize available space.false
themeOptional 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.cardIconsColorDealer card inline SVG icons. Image icons, green opt-in, and red opt-out stay unchanged.#0C1E46#E21A22
theme.mapListViewSwitcherColorActive Map View / List View switcher background. Inactive tab stays white.#0C1E46#F5F5F5
theme.buttonColorSelect, 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.filterBackgroundColorFilter panel and filter chips.#FFFFFF#F5F5F5
theme.filterByBackgroundColorFilter By button background, including hover. This button does not change color on hover.#D7EBF9#F5F5F5
theme.filterByTextColorFilter By label and Filter By icon.#0090C6#E21A22
theme.filterIconColorCheckbox icons inside the filter.#CECECE#E21A22
theme.filterRadioColorFilter and sort radio buttons.#E2E8F0#E21A22
theme.filterHoverColorHover inside the filter, sort list, and distance menu. Does not change the Filter By button.#0090C6#E21A22
theme.filterLinkColorRestore and Save links under the filter row.#0090C6#E21A22
theme.searchIconColorIcon inside the search field.#0090C6#333333
theme.cardHeaderBackgroundColorDealer card header background.#E1E9FF#333333
theme.cardBorderColorBorder around the dealer card. A selected card keeps its green border.#E7E7E9#333333
theme.cardIconBorderColorBorder of the phone and social icons on the dealer card.#E7E7E9#333333
theme.buttonBorderColorBorder of the Select and PIN buttons on the dealer card.#000000#333333
theme.headerColorThe 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
}

Did this page help you?