0

I'm using Appodeal sdk, but it's the same principle in AdMob

On Paid version, when a user do subscription, how to check a user actually paid, returning a boolean true or false.

with this result I want to unshow the code of Appodeal to such user. what is the best way to handle this? using javascript?

> function onDeviceReady() {
> 
>   var test ;
>   var appKey = "...";
>     
    if (test) {

>      document.removeEventListener('deviceready', onDeviceReady, false);
> 
>     Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false);
>     Appodeal.initialize(appKey, Appodeal.INTERSTITIAL);
>     Appodeal.cache(Appodeal.INTERSTITIAL);
>     Appodeal.enableInterstitialCallbacks(true);
>       
>          document.addEventListener('onInterstitialLoaded', function(){
> 
>     Appodeal.show(Appodeal.BANNER_BOTTOM); 
> 
>    //after init
> 
>   Appodeal.isLoaded(Appodeal.INTERSTITIAL, function(result){
>     if (result == true)
>     Appodeal.show(Appodeal.INTERSTITIAL);   

} })

I used the fovea plugin for PhoneGap, and enabled subscription on the console, how do I test this as well

Thanks

eyalix
  • 133
  • 1
  • 2
  • 18
  • My answer found on this reference https://stackoverflow.com/questions/37024015/inapp-purchases-with-cordova – eyalix Jan 09 '18 at 08:55

1 Answers1

0

I used disableADS() function to hide Ads for subscribed users

  store.when("id subscribe").owned(function() {                  
     console.log("PRODUCT PURCHASED");                  
     alert('You purchased the ad-free version! Please restart the application to finish.');                 
     disableADS(); // custom function triggered          
    });                   // After we've done our setup, we tell the store to do         
    // it's first refresh. Nothing will happen if we do not call store.refresh()                
   store.refresh();            
   }

  function buyADS(){   
     store.order('id subscribe');
    }
  function disableADS(){
    flag=true;
  }
</script>



<script type="text/javascript"> 
 function onDeviceReady() {

   var appKey = "12345";
      if (!flag) {

  document.removeEventListener('deviceready', onDeviceReady, false);

 Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false);
 Appodeal.initialize(appKey, Appodeal.INTERSTITIAL);
 Appodeal.cache(Appodeal.INTERSTITIAL);
 Appodeal.enableInterstitialCallbacks(true);

document.addEventListener('onInterstitialLoaded', function(){

 Appodeal.show(Appodeal.BANNER_BOTTOM); 

 Appodeal.isLoaded(Appodeal.INTERSTITIAL, function(result){
 if (result == true)
 Appodeal.show(Appodeal.INTERSTITIAL); 
}}
)}
</script>

check the reference as well. InApp purchases with cordova

eyalix
  • 133
  • 1
  • 2
  • 18