Search in sources :

Example 1 with BillingFlowParams

use of com.android.billingclient.api.BillingFlowParams in project zype-android by zype.

the class BillingManager method initiatePurchaseFlow.

/**
 * Start a purchase or subscription replace flow
 */
public void initiatePurchaseFlow(final String skuId, final ArrayList<String> oldSkus, @SkuType final String billingType) {
    Runnable purchaseFlowRequest = new Runnable() {

        @Override
        public void run() {
            Log.d(TAG, "Launching in-app purchase flow. Replace old SKU? " + (oldSkus != null));
            BillingFlowParams purchaseParams = BillingFlowParams.newBuilder().setSku(skuId).setType(billingType).setOldSkus(oldSkus).build();
            mBillingClient.launchBillingFlow(mActivity, purchaseParams);
        }
    };
    executeServiceRequest(purchaseFlowRequest);
}
Also used : BillingFlowParams(com.android.billingclient.api.BillingFlowParams)

Example 2 with BillingFlowParams

use of com.android.billingclient.api.BillingFlowParams in project Android-InAppBilling by LiteKite.

the class BillingManager method initiatePurchaseFlow.

/**
 * Start a purchase flow.
 *
 * @param activity    requires activity class to initiate purchase flow.
 * @param skuId       The SKU ID registered in the Google Play Developer Console.
 * @param billingType InApp or Subscription based Product.
 */
public void initiatePurchaseFlow(final Activity activity, final String skuId, @SkuType final String billingType) {
    if (areSubscriptionsSupported()) {
        Runnable purchaseFlowRequest = new Runnable() {

            @Override
            public void run() {
                BaseActivity.printLog(TAG, "Launching in-app purchase flow.");
                BillingFlowParams purchaseParams = BillingFlowParams.newBuilder().setSku(skuId).setType(billingType).build();
                myBillingClient.launchBillingFlow(activity, purchaseParams);
            }
        };
        executeServiceRequest(purchaseFlowRequest);
    }
}
Also used : BillingFlowParams(com.android.billingclient.api.BillingFlowParams)

Example 3 with BillingFlowParams

use of com.android.billingclient.api.BillingFlowParams in project PhoneProfiles by henrichg.

the class BillingManager method startPurchaseFlow.

public void startPurchaseFlow(final String skuId, final String billingType) {
    // Specify a runnable to start when connection to Billing client is established
    Runnable executeOnConnectedService = new Runnable() {

        @Override
        public void run() {
            BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder().setType(billingType).setSku(skuId).build();
            int responseCode = mBillingClient.launchBillingFlow(mActivity, billingFlowParams);
            PPApplication.logE(TAG, "startPurchaseFlow responseCode=" + responseCode);
            getFragment().displayAnErrorIfNeeded(responseCode);
        }
    };
    // If Billing client was disconnected, we retry 1 time and if success, execute the query
    startServiceConnectionIfNeeded(executeOnConnectedService);
}
Also used : BillingFlowParams(com.android.billingclient.api.BillingFlowParams)

Example 4 with BillingFlowParams

use of com.android.billingclient.api.BillingFlowParams in project PhoneProfilesPlus by henrichg.

the class BillingManager method startPurchaseFlow.

public void startPurchaseFlow(final String skuId, final String billingType) {
    // Specify a runnable to start when connection to Billing client is established
    Runnable executeOnConnectedService = new Runnable() {

        @Override
        public void run() {
            BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder().setType(billingType).setSku(skuId).build();
            int responseCode = mBillingClient.launchBillingFlow(mActivity, billingFlowParams);
            PPApplication.logE(TAG, "startPurchaseFlow responseCode=" + responseCode);
            getFragment().displayAnErrorIfNeeded(responseCode);
        }
    };
    // If Billing client was disconnected, we retry 1 time and if success, execute the query
    startServiceConnectionIfNeeded(executeOnConnectedService);
}
Also used : BillingFlowParams(com.android.billingclient.api.BillingFlowParams)

Example 5 with BillingFlowParams

use of com.android.billingclient.api.BillingFlowParams in project zype-android by zype.

the class BillingManager method initiatePurchaseFlow.

/**
 * Start a purchase or subscription replace flow
 */
public void initiatePurchaseFlow(final Activity activity, final String skuId, final ArrayList<String> oldSkus, @SkuType final String billingType, SkuDetails item) {
    Runnable purchaseFlowRequest = new Runnable() {

        @Override
        public void run() {
            Log.d(TAG, "Launching in-app purchase flow. Replace old SKU? " + (oldSkus != null));
            BillingFlowParams purchaseParams = BillingFlowParams.newBuilder().setSkuDetails(item).build();
            mBillingClient.launchBillingFlow(activity, purchaseParams);
        }
    };
    executeServiceRequest(purchaseFlowRequest);
}
Also used : BillingFlowParams(com.android.billingclient.api.BillingFlowParams)

Aggregations

BillingFlowParams (com.android.billingclient.api.BillingFlowParams)6 ReactMethod (com.facebook.react.bridge.ReactMethod)1