dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.75k stars 632 forks source link

subscription renew issue #1145

Closed abdulahad96 closed 3 years ago

abdulahad96 commented 3 years ago

Version of react-native-iap

^4.4.0

Version of react-native

0.61.3

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

Android

Expected behavior

when subscription renew listener occurr

Actual behavior

no updatepurchase listener occur

Tested environment (Emulator? Real Device?)

real device

Steps to reproduce the behavior

await RNIap.requestSubscription(productID) this.purchaseUpdateSubscription = purchaseUpdatedListener(purchase => { const res = await api.IAPTransactionvalidate(Purchase); await RNIap.finishTransaction(purchase); }); please help me about this concern

floelm commented 3 years ago

Hey,

for recurring subscriptions it is recommended to use the real time developer notifications for android. Here are the docs:

https://developer.android.com/google/play/billing/rtdn-reference

I am not sure if this packages listener is supposed to be triggered with recurring purchases too.

abdulahad96 commented 3 years ago

I need a functionality that realize my app that subscription renewed and i can reward user after hit an api. your solution can create problem when i neglected push notification. please help me

floelm commented 3 years ago

With the Real Time Developer Notifications you can directly hit your API (Google Pub/Sub) and give or extend the users reward based on the notification you receive. It should help you to keep track or a users subscription (cancelled, renewed, ...).

I am not sure what you mean by that: "your solution can create problem when i neglected push notification"

abdulahad96 commented 3 years ago

is your solution give notify to my app when renewal occurred when app is not open and then later i open app so is it still notify me?

floelm commented 3 years ago

The RT Developer Notifications are supposed to notify your backend where you keep track of a users subscription status (e.g. a renewal). I assume your app communicates to your backend on startup anyways where you can then pass this information: e.g. subscription is active or subscription has been renewed. This is independent of whether the app is open during renewal or not.

stale[bot] commented 3 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

andresesfm commented 3 years ago

Looks like it's been answered, if more info please reopen