Paywall observer mode
When to use it ?
This mode is perfect to use Purchasely data and Purchasely paywalls without changing your existing purchase layer.
You can use this mode if you want to:
use Purchasely remotely modifiable paywalls
benefit of our unified data set of subscription events to get a better understanding of your subscribers' lifecycle
fuel your marketing tools with these events and create no-code automations
all this without changing your legacy transaction processor / backend
What you can do in this mode ?
You can:
Display paywalls and modify them remotely
Create as many paywalls as you need and multiply the touch points
Receive our subscription events from our Webhook to trigger your automations
Connect our data with your marketing tools using our integrations
Analyse your business with our great charts
Purchasely will provide the controllers (iOS) and fragments (Android) for your paywalls and will inform you about subscription events through our Webhook and integrations.
In this mode Purchasely won't consume your purchases or acknowledge purchases made.
On iOS we won't finish the transaction of your consumables that will remain in the queue if you don't do that in your code.
On Android the transactions will be cancelled and refunded after 3 days.
General overview

Implementation
1- Start the SDK
The start
method must be called as soon as possible to catch every purchase / renewal.
The most important argument to set, besides apiKey
, of course, is the runningMode
in paywallObserver
The userID
parameter is optional and allows you to associate the purchase to a user instead of a device. You can also set it up later if you wish to.
import Purchasely
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Purchasely.start(withAPIKey: "API_KEY,
appUserId: nil,
runningMode: .paywallObserver,
eventDelegate: nil,
logLevel: .debug) { (success, error) in
print(success)
}
return true
}
2- Set user identifier
We need to know whenever a user is logged in or logged out to:
Hide the login button in the paywalls
Check if the user already used a trial and display the correct price
Use a PaywallActionInterceptor to handle login from a paywall and display your login screen
3- Configure and present paywalls
To display a paywall, you need to can get a Controller / Fragment from Purchasely.
Then you must use the Paywall Actions Interceptor to perform the purchase triggered from Purchasely's paywalls with your purchase system.
Here is an example where MyPurchaseSystem
is your internal subscription management system.
Purchasely.setPaywallActionsInterceptor { [weak self] (action, parameters, presentationInfos, proceed) in
switch action {
// Intercept the tap on purchase to display the terms and condition
case .purchase:
// Grab the plan to purchase
guard let plan = parameters?.plan, let appleProductId = plan.appleProductId else {
proceed(false)
return
}
MyPurchaseSystem.purchase(appleProductId) { (success, error) {
// We handle the purchase so we tell Purchasley not to handle it
proceed(false)
if success {
presentationInfos?.controller?.dismiss(animated: true, completion: nil)
}
}
default:
proceed(true)
}
}
4- Sync your purchases (Android only)
In oberver
and paywallObserver
modes, when a purchase or a restoration is made with your current flow, call the synchronize()
method of our SDK to send the receipt to our backend. This allow us to save the receipts on our server to prepare for your migration.
Purchasely.synchronize()
5- Configure deeplinks (optional)
Paywalls can be used in many othe ways that can be:
Push notifications deeplinks
6- Migrate your existing subscriber base (optional)
If your app already has subscribers, you must migrate them to Purchasely to:
Have complete dashboards including every subscriber acquired in the past
Handle status using the
userSubscriptions
Follow this guide to import your subscribers to Purchasely.
Last updated
Was this helpful?