Launch Dealer Locator using Checkout SDK

Using the Checkout SDK you can launch the dedicated dealer locator UI to find dealers in your area.

Usage

Include the Checkout 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/15.0.0/ffl-select-sdk.js" async=true 
</script>

Demo

Try the live example: FFL Dealer Locator demo

Initialize the SDK with options

SDK exposes a dealer selector class, which can be simply used as follows:

const ffl = new FFLCheckoutSDK.FFLDealerLocator(containerId, options, SearchListOptions, filterOptions, sortingOptions);

The meaning of each parameter is described below:

Parameter NameDescriptionExample
containerIdA selector which can be used as a parent element, under which SDK creates an iframe.#dealer-selector-parent
optionsA list of options to alter the default SDK behavior. A full list of options is documented in the next section.
SearchListOptionsDefines the search input passed to the Dealer Locator. Use only one primary search field at a time (zipCode, tradeName, or licenseKey) and keep the other two as empty strings to avoid mixed search criteria. distance is generally used with zip-code searches.
filterOptionsDefines optional filters to narrow the dealer results returned by the search. You can pass flags and filter values such as dealer type, SOT-related filters, business attributes, gun type, and rating/review ranges. Pass an empty object () when no filters are required.
sortingOptionsDefines how the dealer list is ordered in the results view. Set sortBy (for example: preferred, name, or rating) and optionally set descending (true or false) to control direction. If not provided, default sorting behavior is applied by the locator.

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.
headerColorThe color of the dialog header. You can specify any valid RGB color in hex format.#000000#FF0000
buttonsAn array of button configuration objects. Please refer to next section for available list of options for each button object. At the maximum, only 2 buttons can be passed in this array, passing more than 2 buttons, will throw an exception.Single button with default options.
headerTextThe text to be displayed in dealer locator header.Find a FFL dealer

Button options

OptionDescriptionDefaultExample
labelText to be displayed on the buttonSelect
colorButton color in hex format#000000#FF0000
callbackA javascript callback function where SDK notifies you when the dealer is selectednull

SearchListOptions

OptionDescriptionDefaultExample
zipCodeZIP/postal code used for location-based dealer search. Use this when searching by location; if provided, keep tradeName and licenseKey empty.30075
distanceSearch radius from zipCode (typically in miles) used to limit nearby dealer results.50
tradeNameDealer business/trade name used for name-based search. If provided, keep zipCode and licenseKey empty.CHATTAHOOCHEE MUNITIONS, LLC
licenseKeyDealer FFL license key/number used for exact license-based lookup. If provided, keep zipCode and tradeName empty.1-58-121-07-8H-22932/15822932

Example SearchListOptions

const SearchListOptions = {
  zipCode: '30075',
  distance: 50,
  tradeName: '',
  licenseKey: '',
};

Filter options

OptionDescriptionDefaultExample
typesComma-separated FFL type codes to include in results.(omitted / not set)'01,07'
includeRangeDealerInclude dealers that have a shooting range.falsetrue
includeStockingDealerInclude stocking dealers.falsetrue
excludeNonSOTDealerExclude dealers that are not SOT.falsetrue
hasSotLicenseOnFileInclude only dealers with SOT license on file.falsetrue
deliveryIndicatorFilter by delivery type (commercial or residential).'''commercial'
hasValidCertificateInclude only dealers with a valid license certificate.falsetrue
hasEmailAddressInclude only dealers with an email address.falsetrue
primaryGunBusinessInclude only dealers where firearms are primary business.falsetrue
openOnWeekendsInclude only dealers open on weekends.falsetrue
includeBigBoxRetailerInclude big box retailers in results.falsetrue
includePermanentlyClosedDealersInclude permanently/temporarily closed dealers.falsetrue
onlyPermanentlyClosedDealersShow only permanently/temporarily closed dealers.falsetrue
hasBiometricScannerInclude only dealers with biometric scanner support.falsetrue
includeBlacklistedInclude blacklisted dealers in results.falsetrue
includeOptOutDealersInclude dealers that opted out.falsetrue
onlyPreferredDealerShow only preferred dealers.falsetrue
onlyBlacklistedDealersShow only blacklisted dealers.falsetrue
onlyOptedInDealersShow only opted-in dealers.falsetrue
includeDealersWhoDontAcceptNFAItemsInclude dealers that do not accept NFA items.falsetrue
includeDealersWhoDontAcceptNonFFLSellersInclude dealers that do not accept non-FFL sellers.falsetrue
includeExpiredInclude expired dealers.falsetrue
gunTypeComma-separated firearm type filter values.(omitted / not set)'pistol,rifle'
minRatingCountMinimum star rating threshold.(omitted / not set)4
minReviewCountMinimum review count threshold.(omitted / not set)11
maxReviewCountMaximum review count threshold (used with min).(omitted / not set)25

Example filterOptions

const filterOptions = {
  types: '01,07',
  excludeNonSOTDealer: true,
  includeRangeDealer: true,
  deliveryIndicator: 'commercial',
  gunType: 'pistol,rifle',
  minRatingCount: 4,
  minReviewCount: 11,
  maxReviewCount: 25
};

Sorting Options

OptionDescriptionDefaultExample
sortByField used to sort dealer results. Supported values: preferred, name, rating.'preferred''rating'
descendingSort direction. true = descending, false = ascending. For preferred, this can be omitted.undefinedtrue/false

Example sortingOptions

// Preferred (default-style) sort
const sortingOptions = { sortBy: 'preferred' };

// Name A → Z
const sortingOptions = { sortBy: 'name', descending: false };

// Rating highest first
const sortingOptions = { sortBy: 'rating', descending: true };

To show the FFL dealer locator dialog, just use the show method:

fflDealerLocator.show();

A full Example

const fflDealerLocator = new FFLCheckoutSDK.FFLDealerLocator('#dealer-selector-parent',{});

fflDealerLocator.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: boolean
}

Full Example of the callback:

(dealer) => {
  console.log(`Dealer selected: ${dealer.fflLicenseNumber}`)
}


Did this page help you?