SDK

Implementation

With the Notificare's Monetize add-on you can easily sell virtual goods in the App Store. Our library will provide you all the mechanisms to quickly develop an engaging in-app store experience where you can sell digital products.

Please note that be able to complete a transaction while using sandbox servers, you will need to create test users with access to your app in Apple’s Developer Portal. Your can find more information about test users here.

In your App.js add the following event listener that will be trigger as soon as your products are ready to be consumed:

this.eventEmitter.addListener('storeLoaded', (data) => {
  //Load your UI
});

If there is some issue with your products or your account, the following event is triggered instead:

this.eventEmitter.addListener('storeFailedToLoad', (data) => {
  //Handle error
});

If your store is loaded successfully, at any time you can request the list of products with the following method:

Notificare.fetchProducts().then((products) => {
  //Handle success
}).catch((e) => {
  //Handle error
});

You can also retrieve a list of the purchased products, this can be used to allow or not products to be bought again (depending on their type) or automatically give access to the content they unlock. To do that, simply invoke the following method:

Notificare.fetchPurchasedProducts().then((products) => {
  //Handle success
}).catch((e) => {
  //Handle error
});

To get a specific product, using any of the objects return from your list of products, invoke the following method:

let product = products[0];
Notificare.fetchProduct(product).then((data) => {
  //Handle success
}).catch((e) => {
  //Handle error
});

Finally to allow a user to buy a product, simply invoke the method below. Invoking this method, will start teh buying process flow which will return some of the events described below in this page.

let product = products[0];
Notificare.buyProduct(product);

In-App Purchase Delegates

The method above will start the purchase flow handled by iOS and the App Store. You can then use the following delegates to understand the state of the purchase or the hosted content associated to the product. Use should use them to update UI or show errors.

this.eventEmitter.addListener('productTransactionCompleted', (data) => {

});

this.eventEmitter.addListener('productTransactionRestored', (data) => {

});

this.eventEmitter.addListener('productTransactionFailed', (data) => {

});

this.eventEmitter.addListener('productContentDownloadStarted', (data) => {

});

this.eventEmitter.addListener('productContentDownloadPaused', (data) => {

});

this.eventEmitter.addListener('productContentDownloadCancelled', (data) => {

});

this.eventEmitter.addListener('productContentDownloadProgress', (data) => {

});

this.eventEmitter.addListener('productContentDownloadFailed', (data) => {

});

this.eventEmitter.addListener('productContentDownloadFinished', (data) => {

});

This is all you need to display, sell and handle hosted content for your in-app products.