Cordova-plugin-purchase "store" is undefined on android

554 Views Asked by At

I use the Quasar Framework. When i try to acces the window.store.register() it gives me an error saying store is undefined.

The funny thing is, if i use the older outdated version of this Plugin (cc.fovea.cordova.purchase) everything works fine, but then i cant pulbish my app to the play store because it a too old Billing Library

It also works on android.

This is exactly what i dit:

cordova plugin install cordova-plugin-purchase --variable BILLING_KEY="Key124"

window.store.register([{ id: 'premium', type: window.store.PAID_SUBSCRIPTION}])

-> Store is undefined

I CANT access the plugin. Help!

1

There are 1 best solutions below

1
Andyba On

The global object is now in CdvPurchase.store

The plugin used to export the store object globally, in window.store. Some users complained that this interferes with other libraries.

If you wish to minimize changes to your code, you can chose to export it globally by doing window.store = window.CdvPurchase.store

More information in this migration guide