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 Name | Description | Example |
|---|---|---|
| containerId | A selector which can be used as a parent element, under which SDK creates an iframe. | #dealer-selector-parent |
| options | A list of options to alter the default SDK behavior. A full list of options is documented in the next section. | |
| SearchListOptions | Defines 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. | |
| filterOptions | Defines 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. | |
| sortingOptions | Defines 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
| 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. | ||
| headerColor | The color of the dialog header. You can specify any valid RGB color in hex format. | #000000 | #FF0000 |
| buttons | An 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. | |
| headerText | The text to be displayed in dealer locator header. | Find a FFL dealer |
Button options
| Option | Description | Default | Example |
|---|---|---|---|
| label | Text to be displayed on the button | Select | |
| color | Button color in hex format | #000000 | #FF0000 |
| callback | A javascript callback function where SDK notifies you when the dealer is selected | null |
SearchListOptions
| Option | Description | Default | Example |
|---|---|---|---|
| zipCode | ZIP/postal code used for location-based dealer search. Use this when searching by location; if provided, keep tradeName and licenseKey empty. | 30075 | |
| distance | Search radius from zipCode (typically in miles) used to limit nearby dealer results. | 50 | |
| tradeName | Dealer business/trade name used for name-based search. If provided, keep zipCode and licenseKey empty. | CHATTAHOOCHEE MUNITIONS, LLC | |
| licenseKey | Dealer 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
| Option | Description | Default | Example |
|---|---|---|---|
| types | Comma-separated FFL type codes to include in results. | (omitted / not set) | '01,07' |
| includeRangeDealer | Include dealers that have a shooting range. | false | true |
| includeStockingDealer | Include stocking dealers. | false | true |
| excludeNonSOTDealer | Exclude dealers that are not SOT. | false | true |
| hasSotLicenseOnFile | Include only dealers with SOT license on file. | false | true |
| deliveryIndicator | Filter by delivery type (commercial or residential). | '' | 'commercial' |
| hasValidCertificate | Include only dealers with a valid license certificate. | false | true |
| hasEmailAddress | Include only dealers with an email address. | false | true |
| primaryGunBusiness | Include only dealers where firearms are primary business. | false | true |
| openOnWeekends | Include only dealers open on weekends. | false | true |
| includeBigBoxRetailer | Include big box retailers in results. | false | true |
| includePermanentlyClosedDealers | Include permanently/temporarily closed dealers. | false | true |
| onlyPermanentlyClosedDealers | Show only permanently/temporarily closed dealers. | false | true |
| hasBiometricScanner | Include only dealers with biometric scanner support. | false | true |
| includeBlacklisted | Include blacklisted dealers in results. | false | true |
| includeOptOutDealers | Include dealers that opted out. | false | true |
| onlyPreferredDealer | Show only preferred dealers. | false | true |
| onlyBlacklistedDealers | Show only blacklisted dealers. | false | true |
| onlyOptedInDealers | Show only opted-in dealers. | false | true |
| includeDealersWhoDontAcceptNFAItems | Include dealers that do not accept NFA items. | false | true |
| includeDealersWhoDontAcceptNonFFLSellers | Include dealers that do not accept non-FFL sellers. | false | true |
| includeExpired | Include expired dealers. | false | true |
| gunType | Comma-separated firearm type filter values. | (omitted / not set) | 'pistol,rifle' |
| minRatingCount | Minimum star rating threshold. | (omitted / not set) | 4 |
| minReviewCount | Minimum review count threshold. | (omitted / not set) | 11 |
| maxReviewCount | Maximum 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
| Option | Description | Default | Example |
|---|---|---|---|
| sortBy | Field used to sort dealer results. Supported values: preferred, name, rating. | 'preferred' | 'rating' |
| descending | Sort direction. true = descending, false = ascending. For preferred, this can be omitted. | undefined | true/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}`)
}Updated 3 months ago