Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android In-App Billing. Cancelled subscription is active even after expiration date

When testing subscriptions, it turned out that canceled subscriptions remain active even after their expiration date. At the same time in Google Play subscription list is empty. I tried two popular IAB libs (in-app-billing v3 and android-checkout).

What causes the problem? Is the problem relevant only when testing? Is there a way to check if the subscription is truly active without the need of running own backend?

bp = new BillingProcessor(a,
            "xxx",
            new BillingProcessor.IBillingHandler() {
            ...
                @Override
                public void onBillingInitialized() {
                    bp.loadOwnedPurchasesFromGoogle();
                    bp.isSubscribed(planId); // true for expired cancelled subscription that is not listed in google play
                }
            });

UPD

I implemented in-app billing without external libs by official guidelines (https://developer.android.com/google/play/billing/billing_integrate.html) and now it works as intended although i have to wait some time to cancelled expired subscription become inactive (sometimes an hour, sometimes a day).

like image 620
HoneyBooBoo Avatar asked Nov 07 '22 08:11

HoneyBooBoo


1 Answers

you may try this one.

purchase.getPurchaseState()
// 0 (purchased), 1 (canceled)- 2 (refunded).
like image 71
eren Avatar answered Nov 14 '22 23:11

eren