In app purchase

Will my app get a receipt with the initial purchase if app if free, then when user activates an In app purchase, will app get a second receipt based on productID, if so, what in the second receipt differentiates an initial purchase, from the IAP? Or is a single receipt updated to reflect the IAP, with original purchase and purchase date? Thanks Jeff

Accepted Reply

Right, yes that TP thing will do what you need.

StoreKit 2 has this in iOS 16.

P.S. I got an email notification when you posted your reply 17 minutes ago, but not when you posted your comment 12 hours earlier. Another reason to not post comments on this forum!

Replies

Or is a single receipt updated to reflect the IAP, with original purchase and purchase date?

Yes - there is a single app receipt, which describes the original (free) purchase of the app itself, and has a separate section describing each IAP purchase.

But note that using the app receipt may not be the easiest way to determine whether the IAP has been purchased. See the StoreKit and StoreKit2 documentation. Is this a new app, written in Swift? In that case, look at the StoreKit2 documentation for how to determine which IAPs have been purchased.

(Do you have serious concerns about piracy? That may influence how you check if the IAP has been purchased.)

Thanks for your reply, I can get a receipt from the sandbox on App Store, using my productID say com.myproduct.IAP, if make an in app purchase, this will be picked by a transaction listener, which is fine using StoreKit 2, which is fine. But I can't figure out how to get a receipt for my app which is at moment paid, which will have an IAP method, doesn't there have to be an original product ID to get this, or does the apple sandbox not provide an initial receipt? This part I am stuck on. Thanks Jeff

Can you clarify which "receipt" you are referring to? There is the "app receipt", which includes in-app purchases. Yes it is probably true that you do not get a receipt during development until you have done some sort of IAP activity. Maybe using SKReceiptRefreshRequest (in the old StoreKit) will force it to install a receipt with only the main app purchase details? Not sure.

But you don't need to use the "app receipt" to determine whether the IAP has been purchases; there are simpler ways to do that.

What are you really trying to do?

Hello endecoup, I have a paid app, and wish to migrate it and existing users to IAP, So I want to get original install date, or original purchase date, or original build number/version, I was of the understating that apple creates a receipt for all apps regardless of being PAID, or Free with IAP. So that I can determine whether test trial period, or for users that have the original Paid APP, to let it continue as previous normal.

Jeff

OK. Yes, this will work as you want in production.

The difficulty you have in in the sandbox, where you need (if possible) to force it to install a receipt when there are no IAPs. I do not know how to do that.

Just to add...

As I said above, the "app receipt" isn't the only way to do this. You also have the "AppTransaction" in StoreKit 2 (but only in iOS 16).

My guess is that that behaves in the same way regarding the sandbox, but I could be wrong.

Hello endecoup, yes this is what I trying to do, how can I test my code, this seems to be a flaw. I am considering setting IAP to 0.00, for a period of time, and getting existing users to get an IAP receipt, and a period of time flip from x.xx paid price to 0.00 and IAP price to x.xx I would prefer getting a production receipt method, but if that method worked what productID would I use? to get this original purchase receipt. I would be interested to know how others test their code, in sand box. But thanks for your input. Jeff

Do you have functioning code that checks for the IAP in the receipt?

There is no "product ID" for the original app purchase in the app receipt. The original purchase is not an IAP purchase. You need to be looking at attribute type 19, "Original Application Version".

  • Hello endectp, I have functioning code which checks the IAP receipt and works, this is only in testflight, i.e not released, which is why I want to get my code working correctly first. The issue I have if the original purchase of the app, request a receipt against the productID , none will be returned, which what I would expect. How can I get a production receipt for the app, in sandbox or TestFlight? Thanks Jeff

Add a Comment

Hello endecotp I have found my solution, using TPinAppReceipt library, I can get the "originalAppVersion", which from sandbox on apple connect always gives "1.0", and nil on Xcode sandbox, but I think this will do the trick, I was under impression that StoreKit 2 would give me the same functionality, but appears not. Thanks for your feedback. Jeff

Right, yes that TP thing will do what you need.

StoreKit 2 has this in iOS 16.

P.S. I got an email notification when you posted your reply 17 minutes ago, but not when you posted your comment 12 hours earlier. Another reason to not post comments on this forum!

@endecotp -- I was not able to test 'AppTransaction' via TestFlight.

It runs alright on Xcode-- receipt type is "Xcode". But I could not successfully retrieve the AppTransaction when downloading app via TestFlight.

And-- strangely, the originalAppVersion results in "Build Version" and not the main App Version.

What's happening?

I have very little experience with TestFlight so I cannot really comment on what will happen there.

In production, the original version reported is the CFBundleVersion from the Info.plist, I believe.