Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3 Implementation #510

Merged
merged 8 commits into from
Jun 9, 2019
Merged

Version 3 Implementation #510

merged 8 commits into from
Jun 9, 2019

Conversation

hyochan
Copy link
Owner

@hyochan hyochan commented Jun 9, 2019

Hi everyone! I am planning for the major update for react-native-iap which will start from version 3. This will be coming sometime in June or July.

This update will cover the following.

  1. Removed deprecation
    • finishTransanction
    • buyProductWithoutFinishTransanction
  2. Renaming methods

    There are some methods which are named as platform specific and which aren't. We decided to make them all platform specific.

    • consumePurchase ➡️consumePurchaseAndroid
    • consumeAllItems ➡️consumeAllItemsAndroid
    • getPromotedProduct ➡️ getPromotedProductIOS
    • buyPromotedProduct ➡️ buyPromotedProductIOS
    • endConnection ➡️ endConnectionAndroid
  3. Migrate android's billing client to version 2.0.1 (Most recent in 2019 June).
    • Migrated to com.android.billingclient:billing:2.0.1 from 1.1.

      After the migration, you should always call getItems before purchasing the product even in android(this was default in ios). When you call getItems, this will be stored in variables which will later be used to get SkuDetails. Previously, we only needed sku string but it now requires full SkuDetails which is hard to share between react-native and android. Therefore, I chose to map those in between.

  4. Redesigning the purchaseUpdate system

    Receiving purchase response is critical in our module. However, some of the results may get pended on the backend side on either android and ios which resulted in implementing addAdditionalSuccessPurchaseListenerIOS(related iOS in-app purchase failure when payment method added live when there is not payment method already present #307 Add additional event listener to handle success purchase after failure. #348). The purchase should not rely on the promises since this could be pended or sometimes Apple is throwing more than one responses which is impossible to catch just with callback and promise patterns.

    • Implement purchaseUpdateListener which receives all the responses from Apple and Google.
    • Implement below methods that rely on purchaseUpdateListener. These resolve promise messages but not required.
      • requestPurchase
      • requestSubscription
      • requestPurchaseWithQuantityIOS
  5. Set deprecation message for future deprecate methods.

    The deprecation will not be removed immediately. It could be removed in next major release maybe in 4.0.0.

    • Deprecate buyProduct ➡️requestPurchase.
    • Deprecate buySubscription ➡️requestSubscription.
    • Deprecate buyProductWithQuantityIOS ➡️requestPurchaseWithQuantityIOS.
    • Deprecate addAdditionalSuccessPurchaseListenerIOS.

New purchase flow
image

Fixes #506
Fixes #497
Fixes #496
Fixes #460
Fixes #412
Fixes #386
Fixes #423
Resolve #491

@hyochan hyochan added 🚽 migration Activities due to changes in framework 📘 release Released version upgrade labels Jun 9, 2019
@hyochan hyochan changed the title react-native-iap version3 proposal Version 3 proposal Jun 9, 2019
@hyochan hyochan changed the title Version 3 proposal Version 3 Implementation Jun 9, 2019
@jvandenaardweg
Copy link
Contributor

Great work on this!

@hyochan hyochan mentioned this pull request Jun 19, 2019
@curiousdustin curiousdustin mentioned this pull request Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment