-
Notifications
You must be signed in to change notification settings - Fork 187
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
Does this support monthly subscriptions in any way? #25
Comments
@chirag04 Wondering same thing here. Since subscriptions are technically products as well, does this library supports them? Specifically, auto-renewing subscription. I would imagine it should work since data such as subscription expiration, etc. is sent in the receipt..... Will follow up with findings if we figure it out before hearing back Thank you! |
subscriptions are not supported but i'm happy to accept a PR |
Very interested in this. @whitmanc any need of help in collaborating on this? |
@DClark5218 We're deciding what route we're going to take... If we end up using this library as a base/forking it, I'll let you know |
@whitmanc thanks for asking this question. I naively assumed it would support all purchase types. @chirag04 , since there are so many different types of IAP's, I think it would be a very useful addition to the documentation to specify which types are supported. |
👍 |
I'm following this blog post http://savvyapps.com/blog/how-setup-test-auto-renewable-subscription-ios-app to implement auto-renewable subscriptions We can use The only part missing is the receipt validation, I think we can implement it using only js based on receiptValidation of the blog post |
So to handle auto-renewable subscriptions do this: install this package https://github.com/sibelius/iap-receipt-validator
InAppUtils.loadProducts(products, (error, products) => {
InAppUtils.receiptData((error, receiptData)=> {
this.validate(receiptData);
});
}); import iapReceiptValidator from 'iap-receipt-validator';
const password = 'b212549818ff42ecb65aa45c'; // Shared Secret from iTunes connect
const production = false; // use sandbox or production url for validation
const validateReceipt = iapReceiptValidator(password, production);
async validate(receiptData) {
try {
const validationData = await validateReceipt(receiptData);
// check if Auto-Renewable Subscription is still valid
// validationData['latest_receipt_info'][0].expires_date > today
} catch(err) {
console.log(err.valid, err.error, err.message)
}
} |
Excellent! Thanks for sharing this.. On Mon, Jun 20, 2016 at 5:48 AM Sibelius Seraphini notifications@github.com
|
@sibelius want to merge receipt-validator into in-app-utils? |
@chirag04 great idea, I'll do that I think we should also integrate the android version from https://github.com/satya164/react-native-in-app-purchase |
totally agree. looking forward to your pr for receipt validator.
|
Question: When we get the recieptData back, is it already in a base64 string? That is what apple says it wants, but when I just send the string, or I send the base64 string by calling
I'm getting 21002 malformed either way. |
the receiptData from this lib is already a base64 string |
Any reason the validation data that I'd be getting back from the validateReceipt function would just be my original receipt data? the body looks good in case 7: but then it gets to the case 10: and it calls Shouldn't it be returning back body instead? |
I changed it to body and the code started working. I'll try to get a PR together but I have a few other things up in the air. |
Anything new on this? 😕 |
Seems like people are using subscriptions with this lib. I haven't used it myself so can't confirm. |
Just use the above instructions...use the referenced library in concert On Wed, Aug 24, 2016 at 9:49 AM, Chirag notifications@github.com wrote:
Austin Fatheree |
In our company we initiate subscriptions with this library. But we are'nt able right now to indicate if a subscription is still kept alive and valid or was it cancelled by the customer |
you should have a cron job to run every day to check everyday if the subscription is still valid. u can use this package in ur server: https://github.com/sibelius/iap-receipt-validator you need to store the receipt in ur server side to do this |
A, thx @sibelius. What will ne the argument "recepitData" in the validate() function? |
the result of: InAppUtils.loadProducts(products, (error, products) => {
InAppUtils.receiptData((error, receiptData)=> {
this.validate(receiptData);
});
}); |
@sibelius it doesn't look like |
From the feedback here, it seems like it does work with subscriptions. I'm going to close this one for now. |
I've just sent a PR to improve info on monthly subscriptions: #56 |
I'm about to do my first subscription. Need some newbie advice. Also note that the app is iOS/Android. @sibelius Could you elaborate more on:
I don't quite understand. Do you mean every day, this would check every receipt for every user? Doesn't that seem like a lot? What do I then do with the validation results? Do I save it to their account on the backend? What about: user opens the app -> then check their sub by validating their receipt -> then use the results to save the effects on the the backend with their account -> then apply the effects ?? If I should save to the backend on their user account, should the metadata look something like this?
Something like:
cause I have a bunch of other things I will need to keep track of and for both iOS/Android. if this was stored on the user account, makes it easier to deal with for iOS/Android compatibility.
Thanks! |
Can someone tell me why the |
@itinance did you manage to find out the answer to your last question? I've noticed that Has anyone gone through the lifecycle of an auto-renewable subscription to confirm that https://github.com/sibelius/iap-receipt-validator works as expected e.g. expiry adjusts correctly with a renewal & cancel? |
I’ve built my own approach directly in Objective-C for tests if a subscription is still valid. If helpful i can publish it, @jamesmsp89
Via IPhone...
… On 31. Jul 2018, at 11:54, jamesmsp89 ***@***.***> wrote:
@itinance did you manage to find out the answer to your last question? I've noticed that expires_date is the same as the purchase date. Testing in sandbox mode where I purchased a subscription yesterday, and today I am verifying the receipt is still valid. I would expect expiry date to be 3 months after the purchase date (for a 3-month auto-renewable subscription) and not the same as the purchase date.
Has anyone gone through the lifecycle of an auto-renewable subscription to confirm that https://github.com/sibelius/iap-receipt-validator works as expected e.g. expiry adjusts correctly with a renewal & cancel?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks @itinance. I now have a better understanding of what is going on and can share some observations:
|
The important thing is not to mix The former is the immutable receipt, while the later is the last renewed receipt. |
Thanks!
The text was updated successfully, but these errors were encountered: