onepf / OpenIAB

Open In-App Billing for Google Play, SlideMe, Amazon Store, Nokia Store, Samsung Apps, Yandex.Store, Appland, Aptoide, AppMall and Fortumo.
http://onepf.org/openiab/
Apache License 2.0
476 stars 171 forks source link

How I can choose pay by Yandex.Store #493

Open nathan158 opened 9 years ago

nathan158 commented 9 years ago

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?

nathan158 commented 9 years ago

use this API ?

mHelper.launchPurchaseFlow(MainActivity.this, InAppConfig.SKU_GAS, RC_REQUEST, mPurchaseFinishedListener, payload);

It is right ?

nathan158 commented 9 years ago

get view as demo

![Uploading image_pay.jpg…]()

RomanZhilich commented 9 years ago

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.

nathan158 commented 9 years ago

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?


i get Logcat: " IabResult: 3, No suitable appstore was found (response: 3:Billing Unavailable)" if i use code as follow:

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);
        }
    });

if i use the code below , i get the view like demo about buy gus.

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

nathan158 commented 9 years ago

parameter as demo code:

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";
nathan158 commented 9 years ago

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

nathan158 commented 9 years ago

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?