-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
Support to iOS subscription offers #455
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@renatoalencar Thank you for the contribution! Since this is a new feature and it is not dependent to other methods, I'm happy to merge this without any doubt. By the way, I have one question for naming. You can see above comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes. Could you lastly update type definition in index.d.ts
and index.js.flow
? Sorry, that I've missed this in last review.
Right @hyochan, I will add TS and Flow typings. |
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
iOS launched this new feature that allows apps to have offers for renewing users, in order to "win back lapsed subscribers or retaining current subscribers", says the documentation.
So, this PR has two main components:
The discounts field in products field
The
SKProduct
now has adiscounts
property in order to provide the actual subscription available discounts, I add a new method to parse it and convert to anNSArray<NSDictionary *>
to be converted to JSON.The buyProductWithOffer method
This new method allows the user to purchase an offered subscription, the Apple documentation says you must generate a signature to determine the eligibility of the user to this offer, you must do it on your server using a pre-generated private key.
You must you
usernameHash
in the signature and transaction to identify the user, it can anything that identifies the user (an ID, UUID, username, etc).Finally, you pass all these stuff to the
buyProductWithOffer
, like:Further information:
I would be grateful for any feedback, thanks.
😄