Glassfy automatically tries to identify the subscriber based on information on the purchases received by the SDK.
The permissions object has two parameters that help to uniquely identify the subscriber:
subscriberId : identifies the subscriber and is connected with the purchases from the store. If a user reinstalls an app the subscriberId remains the same. Due to the way app stores work it is not possible to disassociate a subscriber from their AppStore / PlayStore account so this identifier will remain the same. The subscriberId may change if a user without a purchases (or only with consumables purchases) reinstalls the app.
installationId: identifies the current installation of the application and is regenerated every time the app is reinstalled or installed on a different device.
How to get the subscriberId and the installationId
They are both associated with a permissions object:
Glassfy.permissions { [weak self] permissions, err in
if let permissions=permissions {
let subscriberID = permissions.subscriberId ?? ""
let installationID = permissions.installationId ?? ""
[...]
}
}
To identify the user you can set a custom identifier that will be included in Webhooks and allows you to share subscriptions among different devices. To disconnect the user pass null to Glassfy.connectCustomSubscriber function.
Custom identifier on multiple devices. All the users with the same Custom identifier share the same permissions.
Custom identifier on iOS and Android versions of the app. All the users with the same Custom identifier share the same permissions.
Custom identifier on iOS and Paddle. All the users with the same Custom identifier share the same permissions.
Connect custom identifier
Glassfy.connectCustomSubscriber("my_custom_identifier") { error in
// handle error.
}