android-inapp-billing-v3 icon indicating copy to clipboard operation
android-inapp-billing-v3 copied to clipboard

check if the user has requested a refund

Open ghost opened this issue 6 years ago • 7 comments

Hi. I have implemented this library.

I tried to buy a product and the transaction is successful. Then I made the refund, but on my app still the functionality of the PRO version

How can I check each time I start my app if the user has requested a refund and then block the PRO features?

This is my code:

In onCreate:


        bp = new BillingProcessor(this, "mykey", this);
        bp.initialize();`

@Override
   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
       if (!bp.handleActivityResult(requestCode, resultCode, data)) {
           super.onActivityResult(requestCode, resultCode, data);
       }
   }

   @Override
   public void onBillingInitialized() {
       /*
        * Called when BillingProcessor was initialized and it's ready to purchase
        */
       if (bp.loadOwnedPurchasesFromGoogle()){
           if (bp.isPurchased("my_product_create_on_play_console")){
               Log.d("LOG", "Restored");
               //finishSuccess();
           }else  {
               Log.d("LOG", "Restored1");

               //  showAlert("Purchase was not found on your Account\nPlease use the 'Buy Now' button to unlock the Full Version", false);
           }
       }else{
           Log.d("LOG", "Restored22");
           //Log.d(LOG_TAG, "Have not Purchased");
       }
   }

   @Override
   public void onProductPurchased(String productId, TransactionDetails details) {
       Toast.makeText(MainActivity.this, "Grazie per aver acquistato le nuove funzionalità. :-)", Snackbar.LENGTH_LONG).show();
       prefs.edit().putBoolean("versionepro",true).commit();
       Log.d("LOG", "eeeeeeeee");
   }

   @Override
   public void onBillingError(int errorCode, Throwable error) {
       /*
        * Called when some error occurred. See Constants class for more details
        *
        * Note - this includes handling the case where the user canceled the buy dialog:
        * errorCode = Constants.BILLING_RESPONSE_RESULT_USER_CANCELED
        */
       Log.d("LOG", "rrrrrrr");
   }

   @Override
   public void onPurchaseHistoryRestored() {
       Log.d("LOG", "tttttttttt");
   }

I asked for a refound of the test order yesterday. On google play console I read "refunded" but on my app is still the purchase made Thank you

ghost avatar Sep 27 '18 19:09 ghost

I'm also facing this issue.

elmurzaev avatar Oct 20 '18 21:10 elmurzaev

Me too (my app has targetSdkVersion 28)

viks178 avatar Nov 01 '18 18:11 viks178

Me too.

The variables sku and purchased are always true after the refund. Fix please.

The variable pagamentoLocale instead is a local variable that is loaded by reading in the preferences of the app. And for more control I check all the possible combination of purchased and pagamentoLocale. But the problem with the update of the purchases/refund remains.

`//----- eventi per il billing ----- override fun onBillingInitialized() {

    Log.i("CHECK BILLING", "Inizializzato")

    //conotrllo il pagamento tramite l'oggetto di billing
    bpCheck.loadOwnedPurchasesFromGoogle()

    val sku = bpCheck.listOwnedProducts()

    Log.i("CHECK BILLING","SKU :" + sku.joinToString())

    val purchased = bpCheck.isPurchased(idProduct)

    Log.i("CHECK BILLING","Is Purchased :" + purchased)

    //controllo i vari casi di pagamento
    when{
        purchased && pagamentoLocale ->{
            //online vero | locale vero
            //è già presente un pagamento
            Log.i("CHECK BILLING", "Online $purchased | Locale $pagamentoLocale")
        }

        purchased && !pagamentoLocale ->{
            //online vero | locale falso
            //imposto le variabili locali di pagamento a vere
            Log.i("CHECK BILLING", "Online $purchased | Locale $pagamentoLocale")
            pagamentoLocale = true
            preferenzeApp.edit().putBoolean(PURCHASE_KEY,true).apply()
            Toast.makeText(this,getString(R.string.purchase_restored),Toast.LENGTH_LONG).show()
        }

        !purchased && pagamentoLocale ->{
            //online falso | locale vero
            Log.i("CHECK BILLING", "Online $purchased | Locale $pagamentoLocale")
            pagamentoLocale = false
            preferenzeApp.edit().putBoolean(PURCHASE_KEY,false).apply()
        }

        !purchased && !pagamentoLocale ->{
            //online falso | locale falso
            //non è presente nessun pagamento
            Log.i("CHECK BILLING", "Online $purchased | Locale $pagamentoLocale")
        }
    }
}`

httyd98 avatar Nov 13 '18 21:11 httyd98

Hi, anyone find a solution?

stefanoMancon avatar Mar 21 '19 08:03 stefanoMancon

I'm also facing this issue.

jarvanh avatar Nov 27 '19 00:11 jarvanh

Having the same issue, any news on it?

Hunte060708 avatar Jan 16 '21 10:01 Hunte060708

I am also facing the same issue, please fix this as soon as possible. because all users going for a refund and still enjoy the pro version of the app

NaveenDevrani avatar Dec 27 '22 06:12 NaveenDevrani