cordova InAppPurchase Plugin gives error "ERROR TypeError: Cannot read property ‘getProducts’ of undefined"

I use cordova in-app-purchase plugin in my App, but getting error of “ERROR TypeError: Cannot read property ‘getProducts’ of undefined”

.ts File is like:

window['plugins'].inAppPurchase.getProducts(productIds).then(products => {
      console.log('got products: ', JSON.stringify(products));
      self.buyProducts(products[0].productId);

    });

Stuck in this. Thanks in advance.

Source: New feed
Source Url cordova InAppPurchase Plugin gives error "ERROR TypeError: Cannot read property ‘getProducts’ of undefined"