SDK Guide
General Usage
8 min
overview the enefits sdk is designed for anyone with a website or an app to authenticate and verify nft ownership as a way to give access, perks, or benefits as a result of ownership typically the sdk is used after creating offers within enefits if you're interested in implementing the server side enefits api, head to this documentation https //docs enefits co/general usage to learn more the enefits sdk is available for the following platforms web mobile (ios, android, react native, and unity) with the enefits sdk you can do things like the following give nft holders access to private sales or special areas of your website or app issue redeemable single use or multiple use coupons or vouchers give early access to your content before making available to general public in order to use the enefits sdk you will need an enefits account as well as an api key to obtain an api key, simply register at http //enefits co http //enefits co , go to developer in the account menu in the top right section from there, generate an api key and save this for all api requests as defined below we only show this once so if you lose this api key, you’ll have to re generate from the developer section in this documentation we refer to the api key as {api key} integration steps step 1 (optional) create an nft collection enefits allows brands to give perks/benefits to holders of any nft out in the wild however, you may decide that you want to create an offer exclusive to holders of an nft belonging to your own collection follow this guide to create an nft collection step 2 create an offer and select collection targets at the heart of enefits is the ability to target offers to holders of nfts you can any combination of nft collections to make your offer available to for example, you may have an exclusive collection of your own that an offer is available to but also make available to holders of bored ape yacht club or meebits nfts follow this guide to create an offer and set target nft collections step 3 integrate sdk with your website or app this step is important because it allows your website or app to verify ownership of the nft by the holder before granting access to the offer you created in step 2 there are two parts to sdk integration that you’ll need to be aware of integrating the sdk so that your audience can connect their wallet to make available their public wallet address(es) unlocking access to the relevant sections of your website/app based on if the offer you are querying is in fact available to the address they expose after connecting their wallet in order to integrate the sdk, you’ll first need to generate an api key from your account follow this guide to generate an api key you’ll also need to know which offer you are querying for this is done by using the offer id for the offer you created in step 2 to get your offer id, log into enefits x and then click on my offers you’ll find the relevant offer id under the offer id column in the offers listing initialize the sdk within your website provide the api key provide the offer id(s) you will be checking for prompt user to connect their wallet add a “connect wallet” element to the site this will allow the user to connect to an installed wallet in the browser (usually metamask or fortmatic) the wallet addresses that the user permits access to will be returned in the response verify offer eligibility based on nft ownership run the “checkoffers” method no passed value will return all offers that the address is eligible for if an offer id is passed into checkoffers, the sdk will check specifically if the address connected is eligible for this specific offer run brand specific app or website routines based on response process the response of checkoffers method based on the response, perform the routines relevant to your brand’s offer/logic if the user is in a logged in session, you may decide to activate a premium subscription if the user is purchasing something on your website, you may want to show an exclusive coupon code that is unlocked based on their ownership