Reputation: 921
I'm just finishing a game for android and I'm testing out the in app purchase functions. I'm sending testing using android.test.purchased
It was working fine until a few hours ago. But now when I click the "accept and buy" in google play, the store gives the error.
Google play error "Error while retrieving information from server [DF-DFERH-01]"
Does anyone know what this error means?
Upvotes: 68
Views: 297923
Reputation: 423
I was getting this error because I used the incorrect offer token in the 'setOfferToken()' function.
Upvotes: 1
Reputation: 85
Version 5, The error is caused because the OldPurchaseToken is invalid or the subscription has expired.
You need to check if the user has an active subscription and return the Purchase to get the OldPurchaseToken using the .queryPurchasesAsync(....) from the billingClient
Here's an example to restore the purchase.
void restorePurchases() {
billingClient = BillingClient.newBuilder(this)
.enablePendingPurchases()
.setListener((billingResult, list) -> {}).build();
final BillingClient finalBillingClient = billingClient;
billingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingServiceDisconnected() {
}
@Override
public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
finalBillingClient.queryPurchasesAsync(
QueryPurchasesParams.newBuilder().setProductType(BillingClient.ProductType.SUBS).build(), (billingResult1, list) -> {
if (billingResult1.getResponseCode() == BillingClient.BillingResponseCode.OK) {
if (list.size() > 0) {
Log.d("Test1234",list.get(0).getPurchaseToken()); // This is the OldPurchaseToken
prefs.setPremium(1); // set 1 to activate premium feature
showSnackBar(btn_restore_fab, "Successfully restored");
} else {
showSnackBar(btn_restore_fab, "Oops, No purchase found.");
prefs.setPremium(0); // set 0 to de-activate premium feature
}
}
});
}
}
});
}
Upvotes: 0
Reputation: 724
In case of V5 Billing, the purchase must include setOfferToken(selectedOfferToken)
ImmutableList productDetailsParamsList =
ImmutableList.of(
ProductDetailsParams.newBuilder()
// retrieve a value for "productDetails" by calling queryProductDetailsAsync()
.setProductDetails(productDetails)
// to get an offer token, call ProductDetails.getSubscriptionOfferDetails()
// for a list of offers that are available to the user
.setOfferToken(selectedOfferToken)
.build()
);
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
.setProductDetailsParamsList(productDetailsParamsList)
.build();
// Launch the billing flow
BillingResult billingResult = billingClient.launchBillingFlow(activity, billingFlowParams);
if selectedOfferToken
is invalid we get the error mentioned.
https://developer.android.com/google/play/billing/integrate
To get the token one could use below code
ProductDetails productDetails;
String offerToken = "";
if (productDetails.getSubscriptionOfferDetails() != null) {
for(int i = 0; i < productDetails.getSubscriptionOfferDetails().size();i++) {
offerToken = productDetails.getSubscriptionOfferDetails().get(i).getOfferToken();
if(!offerToken.isEmpty()){
break;
}
}
}
Upvotes: 3
Reputation: 1486
It works for me.....
I went to the settings on my phone and deleted my gmail account then re-added and synced the account and it worked for me.
settings>accounts>delete account settings>accounts>add account>sync and follow screen prompts
hope it works for you, i was receiving the df-dferh-01 error as well and couldnt buy in app purchases and this did the trick
Upvotes: 8
Reputation: 1875
Long press on Google play application
Now again click on Google Play app, It will work now.
Upvotes: 0
Reputation: 218
Tested on a Huawei P20:
Reinstall Google Play: (Source)
Restart device.
Note: before finding this solution, I followed the instructions from some of the other answers here: removed my Google account from my device and added it again, cleared data and cache from various google play apps. This may or may not be necessary; feedback is welcome.
Upvotes: 0
Reputation: 3876
In my case, this error message was displayed when I tried downloading an app from Google Play Store using a VPN. The download only worked when I disabled the VPN. Using a VPN, downloads were only working for the apps I downloaded previously.
This looks like a censorship from Google, which is really bad for the user experience and I hope they will stop this.
Fortunately I don't use Android on my smartphone, it was on my Linux laptop using Anbox or Android x86 in VirtualBox.
Upvotes: 0
Reputation: 5495
Nothing above made it work for me. The thing for me is that I was testing a subscription and i forgot SkuType.SUBS, changing it to INAPP for the reserved google test product fixed it.
Upvotes: 0
Reputation: 62488
Try this, as it solved in my case on a Samsung mobile phone:
1. Open the "Google Play" app and press the home button to return
2. Go to Settings → Applications → Manage Applications
3. Select the "ALL" tab, Search for "Google Play Store" and press it to open.
4. Press "Force stop"
5. Press "Clear cache"
6. Press "Clear Data"
7. Now Open Play Store and it will work normally.
If the above steps does not help then try the following as well:
1. Go to Settings → Applications → Manage Applications
2. Select the "ALL" tab, Search for "Google Services Framework" and press it to open.
3. Press "Force stop"
4. Press "Clear cache"
5. Press "Clear Data"
Upvotes: 51
Reputation: 849
I had the same issue because of an incorrect product sku.
I was using android.test.purchase
instead of android.test.purchased
.
Upvotes: 8
Reputation: 9287
Issue resolved after installing Google Play Services (NEVER needed them until now, removed because used too many resources on my Android 2.3), and do the following steps:
Clear data for the following apps:
Restart your phone.
Settings > Devices
. It may take a half-hour to several hours to appear.When your phone has shown up in the Play Store with the date registered as today's date, proceed with the next steps, but not before.
Apps > All > Google Play services
.Upvotes: 2
Reputation: 6821
This is a reported bug with Google: Bug Report. It seems to be related with Google's servers and is very intermittent. IE, you'll notice how all the comments revolve around a few specific days. Haven't been able to fix it myself, but the one comment suggests trying the following:
It seems this error is only related to the static responses from Google. Using real product IDs don't suffer from this problem.
Update: My answer here is pretty old and the InApp purchase library has changed quite a bit since. Refer to @Ehsan Sajjad answer instead.
Upvotes: 8
Reputation: 19
I had the same issue. Solved it simply; I have (2) google accounts linked to my Play Store. It just so happens that I installed "an" app from "account B", and I was trying to rate it from "account A". So, switched accounts, and voilá.
Upvotes: 0
Reputation: 1
It has to do with the new Play Store update.
Go to:
settings/apps/all/Google Play Store
Select Google Play Store
and select uninstall updates - that should solve your issue. Open up play store and purchase your app or game select bill to Verizon or whatever phone provider you use then accept. Log in to your Google account and you're done. When you close out the play store it will update again to the latest version and will allow you to bill to account.
Upvotes: 0
Reputation: 163
suggestions of solving this problem is, If you already had installed app in your phone before downloading from google play.(obviously run from your code ) then first uninstal it. and then download and install app from google play . it worked for me .Thanks and regards.
Upvotes: 1