I've been struggling with this problem for days now. I know there are a lot of questions with the same problem on SO but i couldn't get it to work.
What I have done
- Uploaded APK in beta phase
- Created Merchant account
- Added test user
Code
AndroidManifest.xml
<uses-permission android:name="com.android.vending.BILLING" />
MainActivity.java
public class MainActivity extends AppCompatActivity {
private IabHelper mHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// ...
setupInAppBillings();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
super.onActivityResult(requestCode, resultCode, data);
}
}
// [....]
private void setupInAppBillings() {
String base64EncodedPublicKey = "MY PUBLIC KEY";
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
Toast.makeText(getContext(), "In-app Billing setup failed: " + result, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getContext(), "In-app Billing is set up OK", Toast.LENGTH_SHORT).show();
}
}
});
}
}
Tested on
- Huawei P8 (Google Play Version 6.2.14)
- In Switzerland, so a supported country for In-App Billing
What I've tried
- Deleted cache and data from Google Play
- Tutorial from Google Developer site
- Went trough the checklist from user sokie: answer of sokie
The only thing I haven't done from this list is the setup of the License Verification Library (LVL). But I couldn't find any information that this step is required for an In-App Purchase. If not needed I want to do it without this library because I don't really need it as stated on the Google Site.
The Google Play Licensing service is primarily intended for paid applications that wish to verify that the current user did in fact pay for the application on Google Play.
Is there something I miss?