Paywall action interceptor
Last updated
Last updated
© Purchasely 2020-2023
This feature replaces both Login and Purchase interceptor with a more generic approach.
Starting with v3.0, Purchasely allow you to intercept and override every paywall action.
This can be used to:
paywallObserver
mode: intercept purchase and restore actions to perform them using your own code or another SDK
Intercept the login button tapped to display your login form
Force the explicit acceptance of terms and conditions before a purchase
Intercept the call to a webview to inject credentials and be directly logged in
Block promo codes in Kids category apps to add a parental permission gate
Block direct access to external content (webview or link to Safari) in Kids category apps to add a parental permission gate
With the action interceptor, you get everything you need to:
Get the action (and context)
Display views, errors, messages, … above our paywalls
Choose if Purchasely should continue the action or not
You can intercept the following buttons being tapped:
Close
Login
Navigate (web or deeplink)
Purchase
Restore
Open another paywall
Promo code
The interceptor passes 4 parameters:
action
, the PLYPresentationAction
enum that gives the type of action
parameters
, a dictionary that contains the objects needed to perform the action (like a PLYPlan
for a purchase)
info
, the PLYPresentationInfo
object containing the controller of the paywall to dismiss it or display content / error messages above it, and the presentation id and content id associated to this paywall
proceed
a completion handler parameter with a boolean telling Purchasely if it should continue the action itself.
i.e. : Returning true on a purchase action will lead Purchasely to trigger the purchase
On a login action, call proceed(true) to refresh the paywall if the user has logged in
If you don't handle every action, you HAVE TO call proceed(true)
otherwise the bouton will keep spinning and nothing will happen.