j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.29k stars 529 forks source link

[GOOGLE PLAY] Billing API update my code doesn't work. #1555

Open ArbitaryMann opened 3 weeks ago

ArbitaryMann commented 3 weeks ago

Here is my code i tryed couple times but never got it working.

function initStore() { CdvPurchase.store.verbosity = CdvPurchase.LogLevel.DEBUG; try{ setTimeout(() => { sendSubscriptionSuccessNotification(); }, 2500);

}catch{

}
CdvPurchase.store.register([
    {
        id: 'dayemmonth',
        type: CdvPurchase.ProductType.NON_CONSUMABLE,
        platform: CdvPurchase.Platform.GOOGLE_PLAY,
    }
]);

CdvPurchase.store.initialize([CdvPurchase.Platform.GOOGLE_PLAY, CdvPurchase.ProductType.NON_CONSUMABLE]);
CdvPurchase.store.update();

}

function purchaseAccess() { showLoader(6000); const productId = 'dayemmonth'; const product = CdvPurchase.store.get(productId, CdvPurchase.Platform.GOOGLE_PLAY); if (product) { product.order(); } else { alert("Product not found"); } }