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

How to deal with subscriptions? #156

Closed
liuzhen2008 opened this issue Mar 2, 2018 · 3 comments
Closed

How to deal with subscriptions? #156

liuzhen2008 opened this issue Mar 2, 2018 · 3 comments

Comments

@liuzhen2008
Copy link

liuzhen2008 commented Mar 2, 2018

As far as I know, when key event occur during a subscription life cycle, an event will be received by the client side.

Does that mean all I need to do on the server side is to call iap.validate('GOOGLE'/'APPLE', receipt) and consume the event like that?

On google and apple, they both have a server-to-server notifications. Does this module have configurations to connect to it? If not, I guess I have to resort back to having client app to send me updates?

Thanks

@superandrew213
Copy link
Contributor

superandrew213 commented Mar 3, 2018

You can use in-app-purchase to handle real time server notifications from Apple. Apple just sends you the receipt data that you would receive from the client.

For Google you need to make some small adjustments. See the issue that I opened here & my PR that makes it easy to handle Google real time server notifications.

@voltrue2 have you had any time to review this? I have been using it for while and haven't had any issues so far. It doesn't make any big changes. I am happy to use a different approach if you prefer :)

@liuzhen2008
Copy link
Author

@superandrew213 This is so cool. Do you know how I would correlate the receipt data with my in app user id?

I suppose my client still needs to send me something?

Could you point me to the code that I need to write to receive APPLE server-to-server notifications? I couldn't find it in the tutorials..

@liuzhen2008
Copy link
Author

liuzhen2008 commented Mar 8, 2018

@superandrew213 @voltrue2

If i use iap.verify() to verify a subscription receipt from client.

How do I tell when the subscription is cancelled? Do I basically look at expirationDate whenever I need to check whether my guy is subscribed or not depending on whether Date.now() is less than expirationDate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants