Deep Link Integration
Paylisher Web SDK includes a deep link manager API for browser/web app flows.
Configure on init
import Paylisher from 'paylisher-sdk';
Paylisher.init('YOUR_API_KEY', {
dataStudioHost: 'https://your.paylisher.host',
deepLinkConfig: {
captureDeepLinkEvents: true,
autoHandleDeepLinks: true,
authRequiredDestinations: ['wallet', 'profile'],
pendingDeepLinkTimeoutSeconds: 300,
debugLogging: false,
},
});
authRequiredDestinations means routes that must wait for login before navigation.
Example: if a deep link opens wallet or profile and user is not authenticated yet, SDK keeps it pending until you complete auth.
Set deep link handler
Paylisher.setDeepLinkHandler({
paylisherDidReceiveDeepLink: (deepLink, requiresAuth) => {
console.log('Deep link destination:', deepLink.destination, 'requiresAuth:', requiresAuth);
},
paylisherDeepLinkRequiresAuth: (deepLink, completion) => {
const authSuccess = true; // your auth flow result
completion(authSuccess);
},
paylisherDeepLinkDidFail: (url, error) => {
console.log('Deep link failed:', url.toString(), error?.message);
},
});
Use this handler when:
- You want to run your own route navigation.
- Some destinations require auth before navigation.
- You want custom error handling for invalid deep links.
Handle a deep link manually
Paylisher.handleDeepLink('https://your.domain/campaign/CAMPAIGN_KEY?jid=JID_VALUE');
Use this when the URL comes from your own router, custom event bus, or a non-standard entry point.
Pending deep link controls
const hasPending = Paylisher.hasPendingDeepLink();
const pendingDestination = Paylisher.getPendingDeepLinkDestination();
if (hasPending && pendingDestination) {
Paylisher.completePendingDeepLink();
}
Other controls:
Paylisher.clearPendingDeepLink();
Paylisher.cancelPendingDeepLink();
These methods are mostly useful if you use authRequiredDestinations and custom auth flow.
Deferred deeplink APIs (optional)
If you need install-attribution matching APIs, add deferred config and host:
Paylisher.init('YOUR_API_KEY', {
dataStudioHost: 'https://your.paylisher.host',
campaignHost: 'https://your.campaign.host',
deferredDeepLinkConfig: {
enabled: true,
autoHandleDeepLink: true,
debugLogging: false,
attributionWindowMillis: 24 * 60 * 60 * 1000,
additionalEventProperties: {
environment: 'production',
},
},
});
Then use:
await Paylisher.deferredDeepLink('https://your.app/path', 'your_campaign_key');
const match = await Paylisher.fetchDeferredDeeplink();
Or callback-based check:
await Paylisher.checkDeferredDeepLink({
onSuccess: (match) => {
console.log('Matched deferred deep link:', match.url);
},
onNoMatch: () => {
console.log('No deferred deep link match');
},
onError: (error) => {
console.error('Deferred deep link check failed:', error.message);
},
});
For testing only:
await Paylisher.resetDeferredDeepLinkForTesting();