Christian Brevik

React Native InApp Billing

February 09, 2016

I just released v1.0 of my React Native Billing library. Sometimes the things you make for your own needs, is useful for other people as well!

The library came about because I needed InApp Billing support in an Android app made with React Native. Since there was no other Billing-plugins available, I just implemented a simple bridge for the app, wrapping the excellent anjlab InApp library.

Later on, I noticed people on the reactiflux chat asking for an InApp Billing implementation, and decided to release my own simple bridge.

This has been much improved upon since, with stability improvements and a much larger API. You do not need much JavaScript-code to use the API:

const InAppBilling = require('react-native-billing')
  .then(() => InAppBilling.purchase('android.test.purchased'))
  .then(details => {
    console.log('You purchased: ', details)
    return InAppBilling.close()
  .catch(err => {

In order to begin any operation that calls the Google Play API, like purchase or getProductDetails, you will need to call open(). This is in order to open the service channel to Google Play.

After that, you can call for example purchase, and deal with the response. Since every operation returns a Promise, you may also string several operations after one another.

Finally, you will have to call close() after you are done. This is very important since failure to close the Google Play service channel may degrade the performance of the app.

Quite simple! Visit the Github repo for an installation guide and API.

Christian Brevik

Hi there! I'm a developer living in Trondheim. Find me on Github or Twitter.