AndroidInAppBilling icon indicating copy to clipboard operation
AndroidInAppBilling copied to clipboard

how to use InAppBilling plugin with remote phonegap build @ build.phonegap.com

Open equry opened this issue 9 years ago • 3 comments

Hi, is it possible to use this pluggin with phonegap remote build, if yes please share the steps how?

if no, please share how to add this to an existing remote phone gap project.

here is my project,

  1. i have a single html file like following and config file has this setting
<gap:plugin name="com.smartmobilesoftware.inappbilling" version="3.0.2" />
<!DOCTYPE html>
<html>
<body>
        <h1>Hello World</h1>
        <button onclick="init()">Initalize the billing plugin</button>
        <button onclick="buy()">Purchase</button>
        <button onclick="ownedProducts()">Owned products</button>
        <button onclick="consumePurchase()">Consume purchase</button>
        <button onclick="subscribe()">Subscribe</button>
        <button onclick="getDetails()">Query Details</button>
        <button onclick="getAvailable()">Get Available Products</button>
<script>
    function successHandler (result) {
        alert('successhandler');
        var strResult = "";
        if(typeof result === 'object') {
            strResult = JSON.stringify(result);
        } else {
            strResult = result;
        }
        alert("SUCCESS: \r\n"+strResult );
    }

    function errorHandler (error) {
        alert("ERROR: \r\n"+error );
    }

    // Click on init button
    function init(){
        // Initialize the billing plugin
        //myOwnKeyRSABase64App FROM GOOGLE DEVELOPERS CONSOLE
        inappbilling.init(successHandler, errorHandler, {showLog:true, key: 'myOwnKeyRSABase64App'});
    }

    // Click on purchase button
    function buy(){
        // make the purchase
        inappbilling.buy(successHandler, errorHandler,"gas");
    }

    // Click on ownedProducts button
    function ownedProducts(){
        // Initialize the billing plugin
        inappbilling.getPurchases(successHandler, errorHandler);

    }

    // Click on Consume purchase button
    function consumePurchase(){
        inappbilling.consumePurchase(successHandler, errorHandler, "gas");
    }

    // Click on subscribe button
    function subscribe(){
        // make the purchase
        inappbilling.subscribe(successHandler, errorHandler,"infinite_gas");

    }

    // Click on Query Details button
    function getDetails(){
        // Query the store for the product details
        inappbilling.getProductDetails(successHandler, errorHandler, ["gas","infinite_gas"]);

    }

    // Click on Get Available Products button
    function getAvailable(){
        // Get the products available for purchase.
        inappbilling.getAvailableProducts(successHandler, errorHandler);
    }
</script>

</body>
</html>

equry avatar May 09 '15 00:05 equry

I would like to get info on this as well. If it can be installed via the remote Phonegap Build, that would be awesome.

jamminjames avatar Jun 06 '15 23:06 jamminjames

You guys need to either switch to a fork of this plugin:

<gap:plugin name="com.mcm.plugins.androidinappbilling" version="3.0.6" />

or add your BILLING_KEY:

<gap:plugin name="com.smartmobilesoftware.inappbilling">
    <param name="BILLING_KEY" value="MIIBIjANBgk...AQAB" />
</gap:plugin>

YodasWs avatar Jun 16 '15 14:06 YodasWs

Thanks for the reply, YodasWs. So, am I to understand that if I use <gap:plugin name="com.mcm.plugins.androidinappbilling" version="3.0.6" /> in the config.xml file, PhoneGap Build will install the plugin in such a way as to solve the problem with Google Play? Where does the billing key go in that case?

Do we include the info in the plugin.xml file manually anywhere in a PhoneGap Build install, or does that happen automatically? I notice there's a spot for the billing key in that file.

jamminjames avatar Jul 01 '15 02:07 jamminjames