android-inapp-billing-v3
android-inapp-billing-v3 copied to clipboard
check if the user has requested a refund
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
I'm also facing this issue.
Me too (my app has targetSdkVersion 28)
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")
}
}
}`
Hi, anyone find a solution?
I'm also facing this issue.
Having the same issue, any news on it?
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