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)

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

DeepWall.shared.removeObserver(for: self)

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:

pageRequesting Paywalls

For making purchases and handling purchase events:

pageMaking Purchases

For restoring purchases and handling restore events:

pageRestoring Purchases

For closing paywall and handling close event:

pageClosing a Paywall

Last updated