A quick lookup of the SDK's public methods, grouped by area. For step-by-step setup, see Getting Started; for push & in-app messaging, see the Notification Integration guide.
Unless noted otherwise, all methods are on the shared singleton PaylisherSDK.shared.
Setup & lifecycle
| Method | What it does |
|---|
setup(_ config: PaylisherConfig) | Initializes the SDK with your configuration. Call once, as early as possible (app start). |
debug(_ enabled: Bool = true) | Toggles verbose SDK logging at runtime. |
flush() | Sends all queued events immediately instead of waiting for the next batch. |
reset() | Clears the current user's identity and local state (distinct ID, super properties, feature flags, session). Call on logout. |
optIn() | Resumes data capture for the user. |
optOut() | Stops all data capture for the user. |
isOptOut() -> Bool | Returns whether the user is currently opted out. |
close() | Shuts the SDK down and releases its resources. |
Sessions
| Method | What it does |
|---|
getSessionId() -> String? | Returns the current session ID, or nil if no session is active. |
startSession() | Manually starts a new session. |
endSession() | Manually ends the current session. |
Event tracking
| Method | What it does |
|---|
capture(_ event: String, properties:userProperties:userPropertiesSetOnce:groups:) | Sends a custom event. Only event is required; all other parameters are optional. |
screen(_ screenTitle: String, properties:) | Sends a $screen (screen-view) event. |
register(_ properties: [String: Any]) | Sets super properties — included with every subsequent event; persisted across sessions. |
unregister(_ key: String) | Removes a previously registered super property. |
User identity
| Method | What it does |
|---|
identify(_ distinctId:, userProperties:, userPropertiesSetOnce:) | Associates events with a specific user and sets person properties. See Identify User. |
alias(_ alias: String) | Adds another distinct ID for the same user. |
getDistinctId() -> String | Returns the current distinct ID (the one passed to identify, or the auto-generated anonymous ID). |
getAnonymousId() -> String | Returns the device's anonymous ID. |
group(type:key:groupProperties:) | Associates the session's events with a group (e.g. company/organization). |
Feature flags
| Method | What it does |
|---|
reloadFeatureFlags() | Re-fetches feature flags from the server. |
getFeatureFlag(_ key: String) -> Any? | Returns a flag's value — Bool for boolean flags, the variant String for multivariate flags. |
isFeatureEnabled(_ key: String) -> Bool | Returns whether a flag is enabled. |
getFeatureFlagPayload(_ key: String) -> Any? | Returns a flag's JSON payload, if any. |
Notifications
These notification helpers live on NotificationManager.shared (except registerFCMToken). See the Notification Integration guide for usage.
| Method | What it does |
|---|
PaylisherSDK.shared.registerFCMToken(_ fcmToken: String) | Registers the device's FCM token so the backend can target push to this device. Emits $fcm_token_registered. |
NotificationManager.shared.handleNotificationResponse(_ response: UNNotificationResponse) -> Bool | Handles a notification tap or dismiss: captures notificationOpen / notificationDismiss, dedupes, and opens the action deep link. Call from didReceive response. |
NotificationManager.shared.handleForegroundPresentation(_ notification: UNNotification) -> Bool | Captures notificationReceived for a foreground notification. Call from willPresent. |
NotificationManager.shared.handleLaunchOptions(_ launchOptions:) -> Bool | Captures notificationOpen when the app is cold-launched from a notification tap. Call from didFinishLaunchingWithOptions. |
NotificationManager.shared.customNotification(windowScene:userInfo:_:_:_:) | Renders a Paylisher in-app overlay (banner / modal / fullscreen / carousel). |