Skip to main content

Creating an Extension

You are reading an outdated document

Get the latest developer guides on Fynd Partners Help

You're ready to create a new extension. You want to set up your development environment so that you can start coding. In this document, you'll use FDK CLI to create a Node.js embedded extension. FDK CLI generates starter code for building your extension and automates many common development tasks.


Why you should create an extension

You want your extension to embed in the Fynd Platform admin inside an iframe. Since this is your first time creating a Fynd Platform extension, you want to start with some boilerplate code that makes your programming experience easier and more efficient. By creating an embedded extension, you're able to add features to certain parts of Fynd Platform's user interface and online websites/sales channels. You'll also deliver the best seller experience because your extension will be closely integrated with Fynd Platform.


What you'll learn

After you've finished this document, you'll have accomplished the following:

  • Set up your local development environment
  • Generated starting code for building your extension
  • Installed your extension on a development account

Requirements

note

Preferred frontend framework is VueJS (v2.x).


How to get Partner access token

  1. Log in to your Fynd Partners
  2. Click on Manage
  3. Select your organization**
  4. Click on Access Token
  5. Click on Generate Token
  6. Copy the token
  7. Whoo! Now you are ready to develop an extension.

Steps to create an extension

Step 1: Install FDK CLI

npm install -g fdk-cli

Step 2: Create a new project


Step 3: Start a local development server

After your extension is created, you can work with it by navigating to your project directory and running npm run serve to start a local development server. FDK CLI uses ngrok/localtunnel to create a tunnel that allows your extension to be accessed using a unique HTTPS URL, which is mandatory when creating an extension.

Step 4: Install your extension on your development account

With the server running, open the URL that your terminal printed out in the previous step. When you open the URL, you're prompted to install the extension on your development account.


How to get API key and secret

  1. Log in to your Fynd Partners account
  2. Click on Manage
  3. Select your organization
  4. Click on Extensions
  5. Click on Create
    1. Select Private (These are available only to one seller and are not present on marketplaces)
    2. Select Public (These are available for all Fynd Platform sellers on the extension marketplace and are verified by our Fynd Platform team)
  6. Fill in the required details.
  7. Click Save
  8. It will create your extension configuration and you can take API key and secret from your Partners dashboard
  9. Whoo! Now you are ready to develop an extension.

Steps to register an extension

  1. Create a Fynd Partners account using the steps mentioned here
  2. Run npm install -g fdk-cli on your terminal
  3. Run fdk extension init - this will setup the development folder for extension and will register your extension
  4. Or you can use sample example project repo clone

How to execute Fynd Platform APIs

To call Fynd Platform APIs, utilize FDK - Fynd Development Kit. It has all exposed APIs embedded under functions with classes for specific services. All API uses OAuth2 to securely communicate with Fynd Platform services.

It mainly exposes two clients: ApplicationClient and PlaformClient.

PlatformClient - For calling Fynd Platform admin APIs

ApplicationClient - For calling user-facing APIs like products, cart, user address, checkout, etc.

For further examples and details, visit here.

How to call Platform APIs in background tasks?

Background tasks running under some consumer or webhook or under any queue can get platform client via a method getPlatformClient. It will return instances of PlatformClient as well. Here, FdkClient access_mode should be offline. Cause such client can only access PlatformClient in background task.