chirag04 / react-native-in-app-utils

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

How do I test receiptData() with existing paid app? #11

Open wootwoot1234 opened 9 years ago

wootwoot1234 commented 9 years ago

I have a paid app that I'm thinking about making free with in app purchases. If I make the switch I'll need to check if the user has already paid for the app and then enable the paid features. I think the receiptData() should do what I need but I'm not sure how to test it. I built the app and ran it using my development provisioning profile on my device and receiptData() just returns an error. So I built the app with a distribution provisioning profile and submitted it to the app store then downloaded the app using test flight but I'm still getting the same error. How do I get the receipt data from an existing app?

chirag04 commented 9 years ago

@marcgreenstock would you have ideas here?

marcgreenstock commented 9 years ago

@wootwoot1234 do you have StoreKit enabled in xcode? What is the error you are receiving?

wootwoot1234 commented 9 years ago

Thanks @chirag04 & @marcgreenstock

I didn't have the storekit.framework linked, it wasn't in the installation instructions, should it be? I just linked it and will try testing it again now. Do you know if it needs to be built with the distribution provisioning profile? Do I need to upload it to the itunes connect and then test it using test flight? Is there an easier way?

chirag04 commented 9 years ago

@wootwoot1234 I mention about the setup in Notes on README.

You have to set up your in-app purchases in iTunes Connect first. Follow this tutorial for an easy explanation.

Follow the link to the tutorial in the readme.

wootwoot1234 commented 9 years ago

@chirag04 thanks for the reply. Do I need to setup in-app purchases if I'm just trying to read the receipt data? Right now I'm just interested in seeing which version of the app the user bought (and the price they paid if possible) to determine if they paid for the app before I change the app to free and use in-app purchases. Once I'm sure I can read the receipt data then I'll start the in-app purchase development (which I've done before in other apps).

wootwoot1234 commented 9 years ago

I'm not sure of the receiptData() did what I wanted so I made my own method for just checking if the app has been paid for or not. I created a pull request with my code, see #12