Skip to main content

SDK update - Using Google Play Billing 5

· 3 min read

A major update has been pushed! 🥳

The iOS & Android SDKs have been upgraded to v3, and the react-native-iaphub library to v8, we recommend updating the library to the latest version.

The big change is that our Android SDK is now using the Google Play Billing Library version 5!

What's new with the Google Play Billing Library version 5?​

You might have noticed Google released some new features in May 2022 (Google documentation).

Basically everything got a little more complex in order to offer new features (but fortunately you have IAPHUB to make things a little easier for you).

In short:

  • A subscription product has now the possibility to have multiple offers.
  • Each offer has the possibility to offer multiple intro phases (up to 2).

What's the changes in the SDK update?​

Multiple offers​

If you have multiple Android offers, the oldest (first one you've created) will be used by default. We've decided to not support multiple Android offers in order to have a common system with iOS.

To have a different offer simply create a new product, you can do pretty much everything with smart listings.

Multiple intro phases​

Since Android now supports multiple intro phases (you can now for example offer a free trial followed by an introductory price), we had to change our API which is why it is a major update, but updating the library should be pretty easy.

So what's the differences with the new API? The following properties have been removed:

  • subscriptionIntroPrice
  • subscriptionIntroLocalizedPrice
  • subscriptionIntroPayment
  • subscriptionIntroDuration
  • subscriptionIntroCycles
  • subscriptionTrialDuration

Instead you'll have a property subscriptionIntroPhases that is an ordered list containing the intro phases the user is eligible to.

So for instance, if you create 2 intro phases: a free trial of 1 month followed by an introductory price of $4.99 for 3 months, the subscriptionIntroPhases property will contain the following:

[
{
type: "trial",
price: 0,
currency: "USD",
localizedPrice: "FREE",
cycleDuration: "P1M",
cycleCount: 1,
payment: "upfront"
},
{
type: "intro",
price: 4.99,
currency: "USD",
localizedPrice: "$4.99",
cycleDuration: "P1M",
cycleCount: 3,
payment: "as_you_go"
}
]

And also if the user isn't eligible to any intro price/trial, the array will be empty (or null if it isn't a subscription). Easy right?

We're here to help​

If you have any questions or issues upgrading the library to the latest version, you can of course contact us at [email protected].