Home > front end >  How to get purchase history using Anjlab getPurchaseHistory() method Android In App Billing
How to get purchase history using Anjlab getPurchaseHistory() method Android In App Billing

Time:10-21

I am new to Java and android development. I have a app and I need to purchase history using Anjlab library. On git I found this page

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

and it mentions the following:

BillingProcessor bps;
bps = BillingProcessor.newBillingProcessor(this, getResources().getString(R.string.play_console_license), this);


public List<BillingHistoryRecord> getPurchaseHistory(String type, Bundle extraParams)

I am unfamiliar on how to use

public List<BillingHistoryRecord> getPurchaseHistory(String type, Bundle extraParams)

and I am not entirely sure how to use it.

My goal is to print out the transaction history eg the token and orderid etc

Thank You

CodePudding user response:

To get the token you can do something like this:

        BillingProcessor bps;
        bps = BillingProcessor.newBillingProcessor(this, getResources().getString(R.string.play_console_license), this);
                bps.loadOwnedPurchasesFromGoogle();
                bps.getPurchaseListingDetails("yourproductcode");
                String token = Objects.requireNonNull(bps.getSubscriptionTransactionDetails("yourproductcode")).purchaseToken;
        

You may want to add to empty checks around this

  • Related