SDK configuration
You can now use the universal Glassfy Paywall functionality with the new API: for more info please have a look here
Fetch Paywall
Fetch the paywall view controller associated with a remote configuration and present it.
Optionally you can preload the paywall view controller as soon as your main view controller loads and display it when the user select the show paywall action.
Glassfy.paywall(id: "remote_configuration_identifier") { [weak self] vc, err in
if let vc = vc {
// optional customization
// customizePaywall(vc)
self?.present(vc, animated: true, completion: nil)
}
}
__typeof(self) __weak weakSelf = self;
[Glassfy paywallWithId:@"remote_configuration_identifier" completion:^(GYPaywallViewController *vc, NSError *err) {
if (vc) {
// optional customization
// [weakSelf customizePaywall:vc];
[weakSelf presentViewController:vc animated:YES completion:nil];
}
}];
Customize Paywall actions
By Tapping on Close, Link, Purchase or Restore Glassfy performs a default automatic action that you can change by setting a custom handler as in the code below.
private func customizePaywall(_ vc: Glassfy.PaywallViewController) {
vc.setPurchaseHandler { sku in
// user tap on purchase button
}
vc.setRestoreHandler {
// user tap on restore button
}
vc.setLinkHandler { url in
// user tap on a link
}
vc.setCloseHandler { transaction, err in
// user tap on close or a purchase/restore complete
}
}
- (void)customizePaywall:(GYPaywallViewController *)vc {
[vc setPurchaseHandler:^(GYSku * sku) {
// user tap on purchase button
}];
[vc setRestoreHandler:^{
// user tap on restore button
}];
[vc setLinkHandler:^(NSURL *url) {
// user tap on a link
}];
[vc setCloseHandler:^(GYTransaction *transaction, NSError *err) {
// user tap on close or a purchase/restore complete
}];
}
Updated 3 months ago