Path Remapping Guide for React Plugins
Feature Overview
Path remapping allows you to customize external URLs while maintaining your plugin’s internal routing logic. Perfect for SEO-optimized URLs, branded paths, and multi-market operations.
Framework
React SDK v2 - Requires React with TanStack Query
React is Required: This guide covers path remapping for React-based TagadaPay plugins. All code examples use React hooks and patterns from the TagadaPay SDK v2.
What is Path Remapping?
Path remapping lets you expose custom, SEO-friendly URLs to your users while your plugin continues to use its original internal paths internally.Example Scenario
Your plugin defines these internal paths:SEO Benefits
Use keyword-rich URLs like
/buy-now instead of /checkoutBrand Consistency
Match URLs to your brand language across markets
A/B Testing
Test different URL structures without changing plugin code
Multi-Market
Localized URLs:
/acheter (FR) vs /kaufen (DE) vs /checkout (EN)How It Works
1
You configure the mapping in CRM
Tell TagadaPay: “When users visit
/custom/:id, route to plugin’s /hello-with-param/:myparam”2
TagadaPay injects configuration
The platform automatically injects the mapping as a meta tag in your plugin’s HTML
3
SDK handles routing
The SDK transparently handles URL matching and parameter extraction
4
Your plugin works unchanged
Your code continues to use internal paths - no modifications needed!
Architecture
Configuration
In Plugin Manifest
Mark which pages support remapping:In CRM (Done by Merchant)
Merchants configure remapping when mounting your plugin:SDK Usage
Basic Routing with shouldMatchRoute()
- User visits:
/buy-now(external URL) - SDK knows: “This is actually
/checkout” shouldMatchRoute('/checkout')returnstrue✅- Your component renders correctly!
Parameter Extraction with matchRoute()
New in v2.7.14:
matchRoute() extracts URL parameters from remapped paths automatically!Getting Path Information with getPathInfo()
Real-World Examples
Example 1: E-commerce Checkout
Plugin defines:Example 2: Thank You Page with Order ID
Plugin expects:Example 3: Multi-Market Localization
Plugin internal paths:Example 4: Product Pages with Slugs
Plugin:Parameter Name Rules
✅ Valid Remapping
:myparam → Works! ✅
❌ Invalid Remapping
Development & Testing
Local Development
Test path remapping in your local environment usinglocalStorage:
Query Parameter Method
Alternative testing method:Debugging
Add a debug component to see what’s happening:Production Behavior
Automatic Meta Tag Injection
In production, TagadaPay automatically injects remapping configuration:CDN Distribution
Remapped plugins are served from CDN subdomains:Best Practices
1. Always Use SDK Functions
❌ Don’t do this:2. Mark Pages as Remappable
In yourplugin.manifest.json:
3. Keep Internal Paths Descriptive
Even if merchants remap them, keep your internal paths clear: Good:4. Handle Both Scenarios
Your plugin should work whether remapping is active or not:5. Test Both Paths
During development, test your plugin with:- Original paths:
http://localhost:5173/checkout - Remapped paths: Use
localStorageto simulate remapping
API Reference
shouldMatchRoute(internalPath: string): boolean
Check if the current URL matches the given internal path.
Parameters:
internalPath: Your plugin’s internal path pattern (e.g.,/checkout,/product/:id)
boolean:trueif current URL matches (considering remapping),falseotherwise
matchRoute(internalPath: string): RouteMatchResult
Check if route matches AND extract URL parameters.
Parameters:
internalPath: Your plugin’s internal path pattern
getPathInfo(): PathInfo
Get detailed information about the current path and remapping status.
Returns:
getInternalPath(): string | null
Get the current internal path (or null if no remapping).
Returns:
string: Internal path if remapping is activenull: If no remapping is active
Troubleshooting
Parameters are empty
Problem:matchRoute() returns { matched: true, params: {} }
Solution: Ensure parameter names match in your manifest and CRM configuration:
Route not matching
Problem:shouldMatchRoute() returns false when it should match
Checklist:
- Is the page marked as
remappable: truein your manifest? - Is the internal path correct (check with
getPathInfo())? - Are you using the SDK function (not
window.location)? - Try adding logging:
console.log(getPathInfo())
Works locally but not in production
Problem: Remapping works in development but fails on CDN Solution:- Check that meta tag is injected: View page source and search for
tagadapay-path-remap - Rebuild your plugin:
pnpm build - Redeploy:
npx @tagadapay/plugin-cli deploy - Clear browser cache and CDN cache
Remapping not working locally
Problem:localStorage remapping doesn’t work
Solution:
Migration Guide
From Manual Routing
Before (manual routing):From React Router Params
Before:Advanced Patterns
Nested Routes with Remapping
Conditional Remapping Display
SEO Meta Tags with Remapping
Next Steps
API Reference
Complete SDK API documentation
Examples
Real-world plugin examples
Best Practices
Optimization tips and patterns
Tutorial
Build your first plugin
Need Help?
- Documentation: https://docs.tagadapay.com
- Support: developer-support@tagadapay.com
- Community: Join our developer Discord
