For IAP after clicking on a button I can see 'the item is not available for purchase I have full rollout apk in alpha test and added test user and also verify sky I can't see any price and buy option, I have tried following code
public class MainActivity extends AppCompatActivity {
IInAppBillingService mService;
TextView textView;
IabHelper mHelper;
Bundle skuDetails;
private BillingClient mbilBillingClient;
public static final int REQUEST_CODE = 1001;
String sku = "mycodes";
ServiceConnection mServiceConn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView=(TextView)findViewById(R.id.mytext);
String base64EncodedPublicKey="mylicencekey";
// compute your public key and store it in base64EncodedPublicKey
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// Oh no, there was a problem.
Log.d("tags", "Problem setting up In-app Billing: " + result);
}
// Hooray, IAB is fully set up!
}
});
mServiceConn = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
mService = null;
}
@Override
public void onServiceConnected(ComponentName name,
IBinder service) {
mService = IInAppBillingService.Stub.asInterface(service);
}
};
Intent serviceIntent =
new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");
bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(),"ravin", "inapp",null);
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
startIntentSenderForResult(pendingIntent.getIntentSender(),
REQUEST_CODE, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
Integer.valueOf(0));
} catch (RemoteException e) {
e.printStackTrace();
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Toast.makeText(this, "hi="+resultCode, Toast.LENGTH_SHORT).show();
if (requestCode == REQUEST_CODE) {
int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");
String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE");
if (resultCode == RESULT_OK) {
try {
JSONObject jo = new JSONObject(purchaseData);
String sku = jo.getString("productId");
Log.e("error","You have bought the " + sku + ". Excellent choice,adventurer!");
}
catch (JSONException e) {
Log.e("error","Failed to parse purchase data.");
e.printStackTrace();
}
}
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (mService != null) {
unbindService(mServiceConn);
}
}
Please anyone can give a solution, I have also added BILLING Permission and use same sign apk and version