chirag04 / react-native-in-app-utils

A react-native wrapper for handling in-app payments
MIT License
890 stars 185 forks source link

iOS6-style vs iOS7-style receipts #155

Open gtebbutt opened 6 years ago

gtebbutt commented 6 years ago

I'm having a bit of trouble with Apple's own documentation on this, so apologies in advance if I've missed something obvious!

As far as I can tell, transactionReceipt returns an "iOS 6 style" receipt (regardless of actual iOS version) - which, in turn, will only give me the latest single subscription transaction when validated with Apple. I'm trying to retrieve full payment history for a given subscription, which appears to need an iOS 7 style receipt.

Is there a flag in the library to switch the receipt style, and/or a method to use the data already provided in order to get that full history from the Apple API?

gtebbutt commented 6 years ago

An update for those who might find this later: it seems that the callback to InAppUtils.purchaseProduct still receives a deprecated iOS 6 style transactionRecipt (Apple docs) but the InAppUtils.receiptData function will give the newer iOS 7 style appStoreReceipt (Apple docs).

My short term solution is to ensure that InAppUtils.receiptData is called from my JS code after every purchase, and the response stored accordingly in the DB. That said, I think it would be beneficial to update the library to use the appStoreReceipt consistently - especially since transactionReceipt has been deprecated for several iOS versions now.

chirag04 commented 6 years ago

@gtebbutt thanks for figuring out the problem. Can you send a PR with a fix for this?

chirag04 commented 6 years ago

Instead of making a breaking change, we can continue to support both i guess. Along with transactionReceipt we can return receiptData in the purchaseProduct response.