I'm always getting "RESULT_DEVELOPER_ERROR = 5 – invalid arguments provided to the API", when trying to consume a purchase with
String purchaseToken = "inapp:" + getPackageName() + ":" + productId;
int response = 0;
try {
response = mService.consumePurchase(3, getPackageName(), purchaseToken);
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
For that reason, I can always only make a purchase once. However, I need to be able to make the purchase much more often. I've been trying to fix this problem for 2 days now, no success. :/
Making and consuming purchases with SKU "android.test.purchased" works completely fine, however as soon as I export the .apk with the production key and add a live SKU, the purchase only shows up once and then never again.
Here some more details
- The version code of the .apk in the play store and the exported .apk I'm using on my phone are the same and were signed with the same keystore
- I've tried it for both managed and unmanaged products, however that shouldn't matter, because according to the latest in-app billing documentation, managed and unmanaged are treated as managed products and both have to be consumed
- I only have 5 SKU items, so it doesn't hit the limit of 20, which was the problem here
Best Answer
The purchase token is different from the SKU itself, instead, you should retrieve the
purchaseToken
via code such as: