React-native-iap: [Question] How should i know that the user cancelled a subscription?

Created on 21 Sep 2020  路  2Comments  路  Source: dooboolab/react-native-iap

Version of react-native-iap

4.6.1

Version of react-native

0.63.2

Platforms you faced the error (IOS or Android or both?)

Android

Expected behavior

My flow in my app briefly is as following:

  1. get my subscription list as soon as my app launch
  2. when user subscribe, await the receipt from purchaseUpdatedListener
  3. send the receipt to my server to validate with the billing servers from google/apple (using a separate library, we are using python on Backend)
  4. my server confirm receipt validation and i finishTransaction and grant user the subscription.

Now my issue, when a user is subscribed, and decided to cancel a subscription ( i am testing this on Android Emulator )from google play store. How from my app should i listen/monitor/know that the user canceled the subscription to reflect it on the app? or it is only doable from my Backend?

Most helpful comment

All 2 comments

@kamdobrz is correct, there is real-time notifications available for android as well:
https://developer.android.com/google/play/billing/rtdn-reference

Another option is to use a service such as iaphub that will take care of the receipt validation for you and send you a webhook when the user cancel his subscription.

Was this page helpful?
0 / 5 - 0 ratings