Features
- License Key Validation: Validates license keys against the Dodo Payments API.
- License Key Activation: Activates license keys with an instance name, for keys that have an activation limit.
- Environment Support: Configurable for both test mode and live mode.
- TypeScript Support: Fully typed implementation with error handling.
Getting Started
Before you start, you need the Figma desktop app and a Dodo Payments product that issues license keys.1
Create Base Plugin
Create your own Figma plugin project with Figma’s plugin quickstart guide. Figma generates a scaffold with a
manifest.json file.2
Clone the Example Implementation
Clone the dodopayments-figma repository:In the cloned
manifest.json, replace name and id with the values from your generated plugin’s manifest.json. This example is your starting point for the integration.3
Install Dependencies
In the project root, run:
4
Configure Environment
Set
API_MODE in src/ui/api.ts:API_MODE selects the API host: https://test.dodopayments.com for test_mode, or https://live.dodopayments.com for live_mode.5
Customize Components
Customize the plugin components in
src/ui/components/ to match your needs:- Update
Authenticated.tsxto expose functionality for users with valid license keys. - Customize
LicenseKeyInput.tsxto match your design.
Authenticated.tsx is where you add your plugin’s premium features. The plugin shows it only after a license key is validated or activated.Configuration
1
Configure Network Access
The example sends every license key request through a CORS proxy at In
https://dodo-payments-proxy.aagarwal9782.workers.dev, and its manifest.json allows network access only to that proxy. The proxy isn’t available, so call the Dodo Payments API directly. The API accepts cross-origin requests from any origin, including the null origin of the plugin UI.In your manifest.json, replace the proxy domain with the Dodo Payments API hosts:src/ui/api.ts, replace fetch(proxyReq) with fetch(req) in validateLicenseKey and activateLicenseKey, so each request goes to the API directly.This allows the plugin to validate and activate license keys with the Dodo Payments API.2
Configure API Mode
In
src/ui/api.ts, configure the API mode:Development
1
Import Plugin
Import the plugin into the Figma desktop app:
- Open a design file.
- Open the Figma menu and select Plugins.
- Under Development, select Import new plugin from manifest…, then select the
manifest.jsonfile in the project root.
dist/, so start the development server or run npm run build before you run the plugin.You need the Figma desktop app to develop and test plugins locally, because Figma reads the plugin code from local files.
2
Start Development Server
Your plugin rebuilds automatically when you change the source code.
Build Commands
The project includes these npm scripts:License Key Integration
The example implementation checks a license key before it unlocks the plugin. You can customize each step:- User Input: Users enter their license key in the plugin UI.
- Validation: By default, the plugin validates the key with Validate License (
POST /licenses/validate). - Activation: If your license keys have an activation limit, set
needsActivationtotrueinsrc/ui/components/Unauthenticated.tsx. The plugin then activates the key with Activate License (POST /licenses/activate) instead of validating it, and names the instanceFigma Plugin. - Access Control: For a valid key, the plugin saves the key with
figma.clientStorageand showsAuthenticated.tsx. The next time the plugin opens, it validates the saved key again.
Publishing
When your plugin is ready:- Build for production:
npm run build - Test thoroughly in both test mode and live mode.
- Follow Figma’s plugin publishing guidelines.
- Submit the plugin for review through the Figma Community.