Checkout API SDK
FFL Checkout API SDK can be used by clients who want to build their own UIs backed by MasterFFL APIs. This SDK is available for both Typescript and Javascript clients. The SDK is available on CDN as well as npm package. We recommend that CDN should be used on client side (browser), and npm package can be used for server side and react native platforms. Currently, we are working on adding support for other platforms also.
SDK interfaces
Sample code for integration
Client side integration (Inside Browser)
<head>
<script type="text/javascript" src="https://eb9c20d17a28.us-east-2.captcha-sdk.awswaf.com/eb9c20d17a28/jsapi.js" data-awswaf-challenge-compact="true" defer></script>
<script src="https://libs.masterffl.com/ffl-select/select-api-sdk/23.0.2/ffl-select-api-sdk.js"></script>
<script type="module">
const environment = 'prod'; // use 'qa' to point to our QA environment
const fflDealerListModule = new FFLSelectAPISDK.FFLDealerListModule({
searchOptions: {
zipCode: 30075,
distance: 5,
},
paginationOptions: {
pageSize: 5, // Set initial page size to 5
pageNumber: 1,
}
}, environment);
const dealerist = await fflDealerListModule.getPage(1);
console.log(dealerist)
</script>
</head>Server side integration
Firstly, Update the package.json file to include our NPM package:
npm i @masterffl/[email protected]Please note that this npm package is on a private repository which needs authentication, so you may need to update .npmrc accordingly. The token will be provided after you get github access during onboarding.
Now you can use the package in any Javascript file like this:
import FFLSelectAPISDK from "@masterffl/ffl-select-api-sdk-component";
const fflDealerListModule = new FFLSelectAPISDK.FFLDealerListModule({
secrets: {
apiKey: 'Insert your API Key here',
apiSecret: 'Insert your API secret here'
},
searchOptions: {
zipCode: 30075,
distance: 5,
},
paginationOptions: {
pageSize: 5, // Set initial page size to 5
pageNumber: 1,
}
});
const dealerist = await fflDealerListModule.getPage(1);
console.log(dealerist)Full list of options
export interface DealerListOptions {
searchOptions: SearchListOptions;
paginationOptions: PaginationOptions;
filterOptions: FilterOptions;
sortingOptions: SortingOptions;
}
export interface SearchListOptions {
zipCode: string;
distance: number;
tradeName: string;
licenseKey: string;
phoneNumber: string;
}
// Note: When using the search option with a zipcode, you must also provide a distance value. Supported distance values are 5, 20, or 50.
export interface PaginationOptions {
pageSize: number;
pageNumber: number;
}
export interface FilterOptions {
hasValidCertificate: boolean;
includeBlacklisted: boolean;
includeOptOutDealers: boolean;
includeExpired: boolean;
types: string; // values: 01,02,03,06,07,08,09,10,11
minRatingCount: number;
minReviewCount: number;
maxReviewCount: number;
deliveryIndicator: string; // values: commercial or residential
primaryGunBusiness: boolean;
gunType: string;
hasEmailAddress: boolean;
openOnWeekends: boolean;
includeRangeDealer: boolean;
includeStockingDealer: boolean;
onlyPreferredDealer: boolean;
onlyBlacklistedDealers: boolean;
includeBigBoxRetailer: boolean;
includePermanentlyClosedDealers: boolean;
onlyPermanentlyClosedDealers: boolean;
excludeNonSOTDealer: boolean;
hasSotLicenseOnFile: boolean;
hasBiometricScanner: boolean;
onlyOptedInDealers:boolean;
includeDealersWhoDontAcceptNFAItems: boolean;
includeDealersWhoDontAcceptNonFFLSellers: boolean;
}
export interface SortingOptions {
sortBy: string; //values: preferred, rating, distance, name (any one)
descending: boolean; // values: true or false (Only when distance and name is selected for sorting)
}Models
export class FFLDealerListModule {
async getNextPage()
async getPreviousPage()
getTotalPageCount()
getPage(pageNumber: number)
hasMorePages()
}
//Dealer
export interface FFLDealer {
id: string;
fflLicenseNumber: string;
hasValidFFLCertificateOnFile: boolean;
tradeName: string;
isPermanentlyClosed: boolean;
isTemporarilyClosed: boolean;
sotInformation: Sot;
isPreferred: boolean;
businessType: string;
isCommercial: boolean;
isRangeDealer: boolean;
phoneNumber: string;
website: string;
premiseAddress: Address;
reviewAndRatings: ReviewAndRatings;
distance: number | null;
operatingHoursText: string[];
socialProfiles: SocialProfiles;
geo: GeoLocation;
firearms: FirearmFees;
agreedToAcceptTransfer: boolean;
agreedToAcceptTransfersFromNonFFLSellers: boolean;
mailingAddress: Address;
shippingAddress: Address;
isBlacklisted?: boolean;
isDeleted?: boolean;
hasEmails?: boolean;
isByAppointmentOnly?: boolean;
myFFLSubscriptionTier?: string;
hasCompatibleSOT?: boolean;
isNFAPreferred?: boolean;
masterFFLTransferPINEnabled?: boolean;
}
export interface Sot {
isSotDealer: boolean;
hasValidSOTFile: boolean;
acceptsSOTTransfers: boolean;
}
export interface Address {
state: string;
zipCode: string;
street: string;
city: string;
}
export interface ReviewAndRatings {
ratings: number;
reviews: number;
export interface SocialProfiles {
facebook: string | null;
yelp: string | null;
google: string | null;
}
export interface GeoLocation {
lat: string;
lng: string;
}
export interface FirearmFees {
discountForMultipleFirearms: string;
handGun: string;
longGun: string;
nfa: string;
nics: string;
other: string;
}Updated 3 months ago