deepwall
HomeContact UsLogin
  • Overview
  • System Components
  • Key Concepts
  • How It Works
  • Sign In
  • 🚀GETTING STARTED
  • App Registration
  • Configure In-App Products
  • Paywall Setup
    • Create A Paywall
    • Configure Look & Feel
    • Texts and Translations
  • Displaying Paywalls
    • Activate Default Displays
    • Create Targeted Displays
    • Display Priorities
    • Display Reports
    • Edit Displays
    • Display Rules
    • On Close Paywalls
  • Store Configuration
  • Attributions Configuration
  • App Status and Settings
  • ⚙️ SDK Framework
    • SDK Installation
      • iOS SDK
      • Android SDK
      • React Native SDK
      • Flutter SDK
      • Cordova SDK
      • Unity SDK
    • Using the SDKs
      • Initialization
      • Configuration
      • Listening SDK Events
      • Requesting Paywalls
      • Closing a Paywall
      • Validating Receipts
      • Making Purchases
      • Upgrades and Downgrades
      • Non-subscription Purchases
      • Restoring Purchases
      • Transition To Another Paywall
  • 🧪EXPERIMENTS
    • Experiments Overview
    • Create Experiments
    • Experiment Reports
    • Manual Traffic Allocation
    • Update Experiments
    • How Optimization Works?
  • 📦Integrations
    • Integrations Overview
    • Events List
    • Adjust
      • Get App Token
      • Create Adjust Events
    • AppsFlyer
      • Get Dev Key
    • Webhooks
    • OneSignal
  •  App Tracking (iOS 14.5)
    • App Tracking Overview
    • Configure In-app Actions
    • Create ATT Prompt
    • Displaying ATT Prompts
    • Experiments
  • 📈DASHBOARD
    • App Overview
    • Invite Members
    • Access Management
  • GUIDES
    • Apple
      • Getting the App Credentials
      • Setup In-App Products
      • Getting the Shared Secret
      • Server to server notifications
    • Google
      • Getting App Credentials
      • Setup In-App Products
      • Create Service Account Key
      • Developer Notifications
    • Huawei
      • Getting App Credentials
      • Setup In-App Products
      • Developer Notifications
  • 🔍Testing
    • Test Flows
    • Troubleshooting
    • Sandbox Testing
      • Apple App Store
      • Google Play Store
  • 🔗SDK Links
  • iOS SDK
  • Android SDK
  • React Native SDK
  • Flutter SDK
  • Cordova SDK
  • Unity SDK
Powered by GitBook
On this page
  • Event Observation
  • Events Triggered
  • Event Parameters
  • Android Event Usage Example
  • Event Handling

Was this helpful?

  1. ⚙️ SDK Framework
  2. Using the SDKs

Listening SDK Events

Instructions for listening Deepwall SDK events

Deepwall SDK manages paywalls' UI display in your app, and it also manages purchases and restoration of purchases whenever users trigger the buy or restore actions on the displayed paywalls.

Deepwall posts various events for the paywall display, purchase, or restore operations for apps to observe and take necessary actions when needed.

Event Observation

For iOS apps, first implement the DeepWallNotifierDelegate protocol to your class. Then you can use observeEvents method for event observation.

For non-iOS apps you need to use the Deepwall EventBus model.

DeepWall.shared.observeEvents(for: self)
EventBus.subscribe(Consumer { 
when(it.type){
DeepWallEvent.CLOSED.value ->  {
val data = it.data as PaywallClosedInfo
Toast.makeText(this@MainActivity, "PAYWALL_CLOSED : ${data.pageId}", Toast.LENGTH_LONG).show() }
  } 
}})
import DeepWall, { DeepWallEventBus, DeepWallEvents } from 'deepwall-react-native-sdk';

componentDidMount() {
    DeepWallEventBus.getInstance().addListener(DeepWallEvents.PAYWALL_OPENED, this.paywallOpenedListener = data => {
        // handle the event
    })
}
StreamSubscription subscribeToStream =
    DeepwallFlutterPlugin.eventBus.on<DeepwallFlutterEvent>().listen((event) {
        // // access event.data
    });
cordova.DeepwallCordovaPlugin.observeEvents(function(response){
    console.log(JSON.stringify(response));
    // access response.data
}, function(error){
    console.log(error);
})
public void DeepWallPaywallRestoreFailed(int productCode, string reason, string errorCode, bool isPaymentCancelled)
  {
    Debug.Log($"DeepWallPaywallRestoreFailed with productCode:{productCode}, reason: {reason}, errorCode:{errorCode}, isPaymentCancelled: {isPaymentCancelled}");
  }

We recommend removing the observer while you are closing if you observe events on screens.

DeepWall.shared.removeObserver(for: self)
componentWillUnmount() {
     DeepWallEventBus.getInstance().removeListener(this.paywallOpenedListener);
}
subscribeToStream.cancel();

Events Triggered

Following events are triggered by Deepwall SDK :

Event Name

Description

deepwallPaywallRequested PAYWALL_REQUESTED

Triggered whenever a paywall requested

deepwallPaywallResponseReceived PAYWALL_RESPONSE_RECEIVED

Triggered after a paywall success or failure response received

deepwallPaywallOpened PAYWALL_OPENED

Triggered whenever a paywall is opened after a paywall request

deepwallPaywallActionShowDisabled DO_NOT_SHOW

Triggered whenever a paywall cannot be displayed due to paywall display is set as None

deepwallPaywallNotOpened PAYWALL_NOT_OPENED

Triggered whenever a paywall cannot be displayed due to duplicate requests which means this paywall request has been sent while a previous request is being processed

deepwallPaywallResponseFailure PAYWALL_RESPONSE_FAILURE

Triggered whenever a paywall display has failed due to an error

deepwallPaywallClosed

CLOSED

Triggered when the displayed paywall is closed by the app user

deepwallPaywallPurchasingProduct PAYWALL_PURCHASING_PRODUCT

Triggered whenever a purchase is initiated by the user and the purchase is started

deepwallPaywallPurchaseSuccess PAYWALL_PURCHASE_SUCCESS

Triggered whenever a purchase or restore is made and receipt validation is successful or client receipt has been changed for any reason and Deepwall automatically validated the latest receipt. Validation type can be checked for restore success.

deepwallPaywallPurchaseFailed PAYWALL_PURCHASE_FAILED

Triggered whenever a purchase or restore has failed due to an error. Validation type can be checked.

deepwallPaywallRestoreFailed

Triggered whenever receipt validation has failed or there is no receipt after a restore request

deepwallPaywallExtraDataReceived EXTRA_DATA

Triggered by some of the paywalls which provide additional actions for the users (like credit use or another paywall request)

CONSUME_SUCCESS

Triggered whenever a consumable product is consumed successfully. (ANDROID ONLY)

CONSUME_FAILURE

Triggered whenever a consume action is failed. (ANDROID ONLY)

Event Parameters

iOS Event

Android Event

deepwallPaywallRequested

Parameters :

N/A

PAYWALL_REQUESTED

Parameters :

N/A

deepwallPaywallResponseReceived

Parameters :

N/A

PAYWALL_RESPONSE_RECEIVED

Parameters :

N/A

deepwallPaywallOpened

Parameters :

  • pageId: Int

  • testId: Int

  • relatedTestId: Int

  • isDisplay: Bool

PAYWALL_OPENED

Parameters :

PaywallOpenedInfo

  • pageId: Int

  • testId: Int

  • relatedTestId: Int

  • isDisplay: Bool

deepwallPaywallActionShowDisabled

Parameters :

  • pageId: Int

  • testId: Int

  • relatedTestId: Int

  • isDisplay: Bool

DO_NOT_SHOW

Parameters :

PaywallActionShowDisabledInfo

  • pageId: Int

  • testId: Int

  • relatedTestId: Int

  • isDisplay: Bool

deepwallPaywallNotOpened

Parameters :

  • pageId: Int

  • testId: Int

  • relatedTestId: Int

  • isDisplay: Bool

PAYWALL_NOT_OPENED

Parameters :

PaywallOpenedInfo

  • pageId: Int

  • testId: Int

  • relatedTestId: Int

  • isDisplay: Bool

deepwallPaywallResponseFailure

Parameters :

  • errorCode: String

  • reason: String

  • testId: Int

  • relatedTestId: Int

  • isDisplay: Bool

PAYWALL_RESPONSE_FAILURE

Parameters :

PaywallFailureResponse

  • errorCode: String

  • reason: String

  • testId: Int

  • relatedTestId: Int

  • isDisplay: Bool

deepwallPaywallClosed

Parameters :

  • pageId: Int

CLOSED

Parameters :

PaywallActionShowDisabledInfo

  • pageId: Int

deepwallPaywallPurchasingProduct

Parameters :

  • productCode: String

PAYWALL_PURCHASING_PRODUCT

Parameters :

PaywallPurchasingProductInfo

  • productCode: String

deepwallPaywallPurchaseSuccess

Parameters :

  • type: PloutosValidationType

  • result: PLPurchaseResponse

    • subscriptions: Array of SubscriptionItem

    • products: Array of ProductItem

PAYWALL_PURCHASE_SUCCESS

Parameters :

SubscriptionResponse

  • type: DeepwallReceiptValidationType

  • result: SubscriptionDetail

    • subscriptionArray of PurchaseSubscriptionItem

    • products: Array of String

deepwallPaywallPurchaseFailed

Parameters :

  • productCode: String

  • reason: String

  • errorCode: String

  • isPaymentCancelled: Bool

PAYWALL_PURCHASE_FAILED

Parameters :

SubscriptionErrorResponse

  • type: DeepwallReceiptValidationType

  • result: DeepwallPurchaseFailedInfo

    • productCode: String

    • reason: String

    • errorCode: String

    • isPaymentCancelled: Bool

deepwallPaywallRestoreFailed

Parameters :

  • reason: RestoreFailedReason

    • .noReceipt

    • .failed

  • errorCode: String

  • errorText: String

  • isPaymentCancelled: Bool

N/A

deepwallPaywallExtraDataReceived

Parameters :

  • DeepWallExtraDataType model

EXTRA_DATA

Parameters :

Any

N/A

CONSUME_SUCCESS

Parameters :

N/A

N/A

CONSUME_FAILURE

Parameters :

Int

Following parameters are supported with iOS SDK 2.4.2+ and Android SDK 2.6.0+ :

testId: Current id of display or experiment returned as response (This id changes whenever display or experiment is updated)

relatedTestId: Original id of display or experiment returned as response (This id does not change for a display or experiment)

isDisplay: If value is TRUE then the responded paywall is from a display, otherwise from an experiment.

Android Event Usage Example

EventBus.subscribe(Consumer { 
when(it.type){
   DeepWallEvent.EXTRA_DATA.value -> { 
   Toast.makeText(this, it.data.toString(), Toast.LENGTH_SHORT).show() } 

DeepWallEvent.CLOSED.value ->  {
val data = it.data as PaywallClosedInfo
Toast.makeText(this@MainActivity, "PAYWALL_CLOSED : ${data.pageId}", Toast.LENGTH_LONG).show() }


DeepWallEvent.PAYWALL_PURCHASE_SUCCESS.value -> {
val subscriptionResponse = it.data as SubscriptionResponse
subscriptionResponse.result.subscriptionList.forEach { subItem->
   if(subItem.isActive == 1){
       //Do something
   }
       }
DeepWall.closePaywall()
}

DeepWallEvent.PAYWALL_OPENED.value -> { 
val data = it.data as PaywallOpenedInfo
Toast.makeText(this@MainActivity, "PAYWALL OPENED : ${key.pageId}", Toast.LENGTH_LONG).show() } 
}})

Event Handling

You can see the following guides to learn about more about using SDKs and event handling triggers.

For displaying paywalls and handling display events:

For making purchases and handling purchase events:

For restoring purchases and handling restore events:

For closing paywall and handling close event:

PreviousConfigurationNextRequesting Paywalls

Last updated 3 years ago

Was this helpful?

Requesting Paywalls
Making Purchases
Restoring Purchases
Closing a Paywall