Identify the subscriber

Glassfy automatically tries to identify the subscriber based on the information on the purchases received by the SDK.

The permissions object has associated two parameters that will allow 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 will remain the same. Due to the way the app stores are working is
not possible to disassociate a subscriber from his AppStore / PlayStore account so this identifier will
remain the same. The subscriberId may change if a user without a purchase removes and 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

Glassfy.permissions { [weak self] permissions, err in
  if let permissions=permissions {
      let subscriberID = permissions.subscriberId ?? ""
      let installationID = permissions.installationId ?? ""
      [...]
  }
}
Glassfy permissionsWithCompletion:^(GYPermissions *permissions, NSError *error) {
  if (permissions != nil) {
    NSString *subscriberId = permissions.subscriberId;
    NSString *installationId = permissions.installationId;
    [...]
  }
}
try {
  var permission = await Glassfy.permissions();
  var subscriberId = permission.subscriberId;
  var installationId = permission.installationId;
} catch (e) {
  // error
  [...]
}
try {
  const permissions = await Glassfy.permissions()
  const installationId = permissions.installationId;
  const subscriberId = permissions.subscriberId;
} catch (e) {
  // error
  [...]
}
try {
  const permissions = await Glassfy.permissions()
  const installationId = permissions.installationId;
  const subscriberId = permissions.subscriberId;
} catch (e) {
  // error
  [...]
}

Custom identifier

To identify the user you can set a custom identifier that will be included in Webhooks and will allow to share subscriptions among different devices.

  • Custom identifier on multiple devices. All the users with the same Custom identifier will share all the permissions.
  • Custom identifier on iOS and Android versions of the app. All the users with the same Custom identifier will share all the permissions.
  • Custom identifier on iOS and Paddle. All the users with the same Custom identifier will share all the permissions.

connect custom identifier

Glassfy.connectCustomSubscriber("my_custom_identifier") { error in
    // handle error.
}
[Glassfy connectCustomSubscriber:@""my_custom_identifier"" withCompletion:nil];
await Glassfy.connectCustomSubscriber("my_custom_identifier");

No custom id

Anonymous IDCustom IDActionPermission APermission B
AunsetInstall
BunsetInstall
AunsetBuy XX
BunsetBuy YXY

Multiple users share the same permission

Anonymous IDCustom IDActionPermission APermission B
AunsetInstall
BunsetInstall
AunsetBuy XX
Auser_1loginX
Buser_1loginXX

Multiple cusom ids

Anonymous IDCustom IDActionPermission APermission B
AunsetInstall
BunsetInstall
AunsetBuy XX
Auser_1loginX
Buser_1loginXX
AunsetlogoutX
Anonymous IDCustom IDActionPermission APermission B
AunsetInstall
BunsetInstall
AunsetBuy XX
Auser_1loginX
Buser_1loginXX
BunsetlogoutX

Multiple account purchases

Anonymous IDCustom IDActionPermission APermission B
AunsetInstall
BunsetInstall
AunsetBuy XX
BunsetBuy YXY
Auser_1loginXY
Buser_1loginX YX Y
BunsetlogoutXY
Anonymous IDCustom IDActionPermission APermission B
AunsetInstall
BunsetInstall
AunsetBuy XX
BunsetBuy YXY
Auser_1loginXY
Buser_1loginX YX Y
Auser_1Buy ZX Y ZX Y Z
AunsetlogoutX ZY

Did this page help you?