0
我正在集成Android应用内结算api。但由于在某处出现异常,我丢失了purchaseToken。现在在API 3中,如果不消费购买的产品,我无法重新购买它。我现在无法消费,因为我没有purchaseToken?如何检索它? 或者我可以重置购买?应用内付费API的Lost purchaseToken Api
我正在集成Android应用内结算api。但由于在某处出现异常,我丢失了purchaseToken。现在在API 3中,如果不消费购买的产品,我无法重新购买它。我现在无法消费,因为我没有purchaseToken?如何检索它? 或者我可以重置购买?应用内付费API的Lost purchaseToken Api
你可以通过查询购买得到它。
下面是来自谷歌的例子:http://developer.android.com/google/play/billing/billing_integrate.html#billing-download
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
Log.d(TAG, "Query inventory finished.");
// Have we been disposed of in the meantime? If so, quit.
if (mHelper == null) return;
// Is it a failure?
if (result.isFailure()) {
complain("Failed to query inventory: " + result);
return;
}
Log.d(TAG, "Query inventory was successful.");
/*
* Check for items we own. Notice that for each purchase, we check
* the developer payload to see if it's correct! See
* verifyDeveloperPayload().
*/
// Do we have the premium upgrade?
Purchase premiumPurchase = inventory.getPurchase(SKU_PREMIUM);
....
//<- here you can consume your purchase
}