TagadaPay Plugin SDK v2
Build custom checkout pages, multi-step funnels, and e-commerce experiences that run on TagadaPay’s hosting infrastructure. The SDK connects your page to TagadaPay’s backend — sessions, checkout data, payments, analytics — so you focus on the UI.React + TypeScript
Modern React hooks with full TypeScript support
Vanilla JavaScript
Framework-agnostic standalone SDK
Funnel System
Pass data seamlessly between funnel steps
Auto-redirect
Automatic navigation and URL routing
Quick Start
- React
- Vanilla JS
Core Concepts
1. Provider-Based Architecture (React)
The SDK uses React Context to provide global state and functionality:- Initializes authentication and session
- Auto-initializes funnel if enabled
- Provides hooks like
useFunnel(),useCheckout(), etc. - Handles automatic redirects
- Manages debug mode based on environment
2. Funnel System
Build multi-step funnels where data flows automatically between steps:3. Automatic Features
The SDK handles common tasks automatically: Auto-initialization- Funnel session initializes automatically when
TagadaProvidermounts - No manual
initializeSession()calls needed - Controlled via
autoInitializeFunnelprop (default:true)
- Navigating with
funnel.next()automatically redirects to the next step URL - No need for custom
onNavigatehandlers - Browser is redirected immediately after successful navigation
- Automatically enabled in local development
- Loads local config from
config/resources.static.json - Disabled in production automatically
4. Plugin Manifest
Define your plugin’s pages, features, and requirements:Available Hooks (React)
Funnel Navigation
| Hook | Description |
|---|---|
useFunnel() | Navigate between steps and access session context |
Data Fetching
| Hook | Description |
|---|---|
useCheckout() | Fetch and manage checkout session |
useProducts() | Fetch products with caching |
useOffer() | Fetch offers for upsells |
useStoreConfig() | Fetch store settings |
useCustomer() | Fetch customer data |
Step Configuration
| Hook | Description |
|---|---|
useStepConfig() | Access per-step runtime config: scripts, static resources, payment flow, pixels |
useFunnel().stepConfig | Same data, available directly from the funnel hook |
Utilities
| Hook | Description |
|---|---|
useCurrency() | Format money with formatMoney() |
useTranslation() | Multi-language translation helper |
usePluginConfig() | Access plugin configuration |
Standalone SDK (Vanilla JS)
For non-React applications, use the standalone SDK. It gives you the same features — just without React hooks.Environment Detection
The SDK automatically detects your environment:| Environment | When | Behavior |
|---|---|---|
local | localhost, *.localhost, ngrok | Debug mode ON, local config loaded |
development | dev., staging. | Debug mode ON |
production | app.*, other domains | Debug mode OFF |
debugMode prop:
Configuration Presets
Define multiple configuration variants with metadata:meta.name is displayed in the CRM marketplace when merchants select presets.
Step Config & Script Injection
Every funnel step can carry runtime configuration — scripts, tracking pixels, static resources, and payment flow overrides — that are injected when the page is served. This lets merchants customize behavior per funnel step without touching your plugin code.How It Works
When TagadaPay serves your plugin, it injects astepConfig object into the HTML (via window.__TGD_STEP_CONFIG__). The SDK reads it automatically and makes it available through useStepConfig() or useFunnel().stepConfig.
Script Injection
Merchants can add custom JavaScript to any funnel step. Scripts are injected at one of four positions and run automatically — your plugin doesn’t need any code for this.| Position | Where it runs |
|---|---|
head-start | First thing in <head> (before CSS, fonts) |
head-end | End of <head> (after CSS, good for analytics) |
body-start | First thing in <body> (before your app renders) |
body-end | End of <body> (after your app, default) |
window.Tagada — a global object the SDK sets up with helper methods and funnel context:
window.Tagada API
The SDK exposes these helpers on window.Tagada for injected scripts:
| Method | Description |
|---|---|
Tagada.ready(callback) | Run when DOM is ready |
Tagada.loaded(callback) | Run when DOM is ready and funnel is initialized |
Tagada.delay(callback, ms) | Run after a delay (default 1s) |
Tagada.retry(condition, callback, maxAttempts, interval) | Retry until condition is true |
Tagada.waitForElement(selector, callback, timeout) | Run when a CSS selector matches |
Tagada.waitForElements(selector, callback, timeout) | Same, but for multiple elements |
| Property | Description |
|---|---|
Tagada.pageType | Current step ID (e.g. "checkout", "thankyou") |
Tagada.isInitialized | true once the funnel is ready |
Tagada.ressources | Resources from the current funnel context (order, customer, etc.) |
Tagada.funnel | Funnel metadata: sessionId, funnelId, currentStepId, previousStepId |
Tagada.stepConfig | Full RuntimeStepConfig object for this step |
Reading stepConfig in Your Plugin (Optional)
If your plugin needs to read the step config directly (e.g., to conditionally render based on static resources), use the hook:useFunnel():
Practical Examples
Add a Facebook Pixel to checkout only
Add a Facebook Pixel to checkout only
In the CRM, go to your funnel → Checkout step → Scripts, and add:Name: Facebook Pixel
Position: head-end
Content:This runs only on the checkout step. Other steps (upsell, thank you) won’t have this pixel unless you add it there too.
Position: head-end
Content:
Show a banner on a specific step
Show a banner on a specific step
Track conversions on the thank you page
Track conversions on the thank you page
Add this script to the Thank You step only:Name: Conversion Tracking
Position: body-end
Content:
Position: body-end
Content:
Tagada.loaded() waits until the funnel is initialized, so Tagada.ressources is guaranteed to have the order data.Different scripts per A/B variant
Different scripts per A/B variant
Each A/B variant has its own
stepConfig. If variant A has a script and variant B doesn’t, only visitors assigned to variant A will see that script.This is configured in the CRM when you set up split testing on a funnel step — each variant can have its own scripts, static resources, and pixel configuration.Next Steps
Quick Start
Build your first plugin in 15 minutes
Initialize Checkout
Create checkout sessions programmatically
Tutorial
Step-by-step plugin development
API Reference
Complete API documentation
Funnel Resources
Learn how to pass data between steps
Examples
See real plugin examples
Best Practices
Production-ready tips
