MustapTR
MustapTR

Reputation: 57

Getting multiple subscriptions with Android In-App Billing v3

Library : https://github.com/anjlab/android-inapp-billing-v3

I am using the Android In-App Billing v3 library and would like to sell one product more than once. If the subscription is purchased, I provide 1 usage right to the user. If the user wishes, he should be able to create his second subscription and buy the second right. bp.consumePurchase (getString (R.string.trackmonth)); this code did not work.

 @Override
    public void onBillingInitialized() {

  boolean controlnumber = bp.loadOwnedPurchasesFromGoogle();
        if(controlnumber) {
            TransactionDetails subscriptionTransactionDetails = bp.getSubscriptionTransactionDetails(getString(R.string.trackmonth));
            bp.consumePurchase(getString(R.string.trackmonth));
            if (subscriptionTransactionDetails != null) {
                Log.d("TAG", "onBillingInitialized: active");
            } else {
                Log.d("TAG", "onBillingInitialized: not");
            }
        }


   @Override
    public void onPurchaseHistoryRestored() {
        Log.d("TAG", "onPurchaseHistoryRestored: ");
        bp.consumePurchase(getString(R.string.trackmonth));

    }

Upvotes: 0

Views: 297

Answers (1)

from56
from56

Reputation: 4127

Subscriptions are tied to a period of time and a renewal, consuming them makes little sense.

You can't consume subscriptions, use an in-app product instead

Upvotes: 1

Related Questions