You can restore your transaction using the getPurchases()
API
Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(),
itemType, continueToken);
ArrayList mySkus, myPurchases, mySignatures;
mySkus = ownedItems.getStringArrayList(RESPONSE_INAPP_ITEM_LIST);
myPurchases = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);
mySignatures = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_SIGNATURE_LIST);
will list the items that you own and the corresponding data that you can use to verify the purchases.
While you make this call, be sure to
- Use the Google ID that you used to make the purchase.
- Not to use the STATIC Product IDs(android.test.purchased, android.test.refunded...). You can use the test-IDs that you created under your IAB test account.
- Use the appropriate product type and the package name of your app.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…