Skip to main content

Quick Start: Your First Plugin

Build a complete checkout plugin from scratch in 15 minutes. Choose between React for rich UIs or vanilla JavaScript for lightweight implementations.

What You’ll Build

A simple checkout page that:
  • Initializes automatically with funnel session
  • Displays product information
  • Processes payment
  • Auto-redirects to thank you page
  • Passes order data between steps

Prerequisites

node --version
# Should be v18 or higher
# npm (comes with Node.js)
npm --version

# OR pnpm (recommended for monorepos)
npm install -g pnpm

Choose Your Framework


Build for Production

# Build your plugin
npm run build

# Output will be in dist/ folder

Deploy to TagadaPay

# Install TagadaPay CLI globally
npm install -g @tagadapay/cli

# Login to your account
tgdcli login

# Deploy your plugin (interactive mode)
tgdcli deploy

# Follow prompts to:
# 1. Select store
# 2. Confirm build path (dist/)
# 3. Confirm deployment

Manual Upload

  1. Go to TagadaPay Dashboard → Plugins
  2. Click “Upload Plugin”
  3. Upload your dist/ folder as a ZIP file
  4. Fill in plugin details from manifest
  5. Click “Deploy”

Use Your Plugin in a Funnel

  1. Go to Funnels in your dashboard
  2. Create a new funnel or edit existing
  3. Add a “Checkout” step
  4. Select your plugin from the dropdown
  5. Select the /checkout page
  6. Add a “Thank You” step
  7. Select your plugin → /thankyou/:orderId page
  8. Save and test your funnel!

What Happens Automatically?

The SDK handles these tasks for you:
  • ✅ Creates anonymous session automatically
  • ✅ Manages authentication tokens
  • ✅ Persists session across page loads
  • ✅ Auto-initializes when TagadaProvider mounts
  • ✅ Loads funnel context from URL or cookie
  • ✅ Creates new funnel session if needed
  • ✅ Enabled automatically in local development
  • ✅ Loads config/resources.static.json for testing
  • ✅ Disabled automatically in production

Common Issues

Solution: Make sure your app is wrapped with <TagadaProvider>
// main.tsx - MUST wrap your app
<TagadaProvider>
  <App />
</TagadaProvider>
Solution: Check that you’re passing resources correctly:
await funnel.next({
  data: {
    resources: {  // ← Must be inside "resources" key!
      order: { id: 'ord_123', amount: 100 },
      customer: { id: 'cus_456', email: '[email protected]' }
    }
  }
});
Solution: The SDK auto-redirects by default. If it’s not working:
  1. Check that funnel.next() returns successfully
  2. Ensure the navigation response includes a url field
  3. Verify you’re not preventing navigation with custom handlers
To debug:
const result = await funnel.next({ ... });
console.log('Navigation result:', result);
// Should have result.url property
Solution: Make sure you’re importing from the correct path:
// ✅ Correct - React hooks
import { useFunnel } from '@tagadapay/plugin-sdk/v2';

// ✅ Correct - Standalone SDK
import { createTagadaClient } from '@tagadapay/plugin-sdk/v2/standalone';

// ❌ Wrong - old path
import { useFunnel } from '@tagadapay/plugin-sdk';

Next Steps


Need Help?