Open nathan158 opened 9 years ago
use this API ?
mHelper.launchPurchaseFlow(MainActivity.this, InAppConfig.SKU_GAS, RC_REQUEST, mPurchaseFinishedListener, payload);
It is right ?
get view as demo
![Uploading image_pay.jpg…]()
Hello.
If I understand you correctly, you what to select specific store to handle purchase.
OpenIAB picks store during setup process (IabHelper.startSetup()
). If you what to change store you'll have to make new IabHelper
object and call startSetup()
once again.
Excuse me , so sorry , I am not very understanding,if i want to choose pay by Yandex.Store,what parameter i will use ? how i should set if i what to choose Yandex.Store?
OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder() .setStoreSearchStrategy(OpenIabHelper.Options.SEARCH_STRATEGY_BEST_FIT) .addAvailableStoreNames(OpenIabHelper.NAME_YANDEX) .setVerifyMode(OpenIabHelper.Options.VERIFY_EVERYTHING) .addPreferredStoreName(OpenIabHelper.NAME_YANDEX);
builder.addStoreKey(OpenIabHelper.NAME_YANDEX, InAppConfig.YANDEX_PUBLIC_KEY);
builder.setVerifyMode(OpenIabHelper.Options.VERIFY_SKIP);
mHelper = new OpenIabHelper(MainActivity.this, builder.build());
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
@Override
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
Log.d(TAG, "1--Problem setting up in-app billing: " + result);
setupDone = false;
return;
}
setupDone = true;
Log.d(TAG, "2---Setup successful. Querying inventory.");
mHelper.queryInventoryAsync(mGotInventoryListener);
}
});
OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder() .setStoreSearchStrategy(OpenIabHelper.Options.SEARCH_STRATEGY_BEST_FIT);
builder.addStoreKey(OpenIabHelper.NAME_YANDEX, InAppConfig.YANDEX_PUBLIC_KEY);
builder.setVerifyMode(OpenIabHelper.Options.VERIFY_SKIP);
mHelper = new OpenIabHelper(MainActivity.this, builder.build());
mHelper.startSetup(new OnIabSetupFinishedListener() {
@Override
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// complain("Problem setting up in-app billing: " + result); Log.d(TAG, "1--Problem setting up in-app billing: " + result); setupDone = false; return; } setupDone = true; Log.d(TAG, "2---Setup successful. Querying inventory."); mHelper.queryInventoryAsync(mGotInventoryListener); } });
mHelper.launchPurchaseFlow(MainActivity.this, InAppConfig.SKU_GAS, RC_REQUEST, mPurchaseFinishedListener, payload);
so sorry , my english is not skilled . so sorry
OpenIabHelper mHelper; String TAG = "OpenIAB_pay"; boolean setupDone; Button btn_pay; static final int RC_REQUEST = 10001;
//premium upgrade (non-consumable)
public static final String SKU_PREMIUM = "sku_premium";
//gas (consumable)
public static final String SKU_GAS = "sku_gas";
//subscription (infinite gas)
public static final String SKU_INFINITE_GAS = "sku_infinite_gas";
Excuse me : on the API: " mHelper.launchPurchaseFlow(MainActivity.this, InAppConfig.SKU_GAS, RC_REQUEST, mPurchaseFinishedListener, payload); "
what mean of parameter "InAppConfig.SKU_GAS" and "RC_REQUEST" ? I have not this two parameter private. and I have not any parameter private.
so sorry i am confused
Excuse me : what mean of parameter " InAppConfig.SKU_GAS " and " RC_REQUEST " ? we don't have these two parameters, any ideas where could we get them?
Dear Engineer: I reference the demo code , run the program. the view of pay get out . How I can choose pay by Yandex.Store on code?