I want to send the receipt got from AppStore after an in-app subscription to the server in order to verify it (because Apple recommends verifying from the server rather than the app). The receipt has symbols like, "+", "/", and "=". Since I could not send with those symbols I changed them, e.g. replacing + with "%2B" and so on. But even after that, I can get only a part of the receipt on my server. Sending it as a serialized JSON also did not help. (I need to send more data along with the receipt to the server, therefore I cannot pass the receipt without converting into NSString) How can I resolve this issue?
Asked
Active
Viewed 67 times
1 Answers
0
There is a few things that come to mind.
Check your server for a request body size limits and make sure what you're sending does not exceed this limit.
You should never modify the receipt as it is cryptographically signed by Apple and any changes to it would simply make it invalid if you're trying to verify signature etc.
There is an option for you to tell Apple to notify your server for any in app purchase.
It's possible to enter a webhook/callback URL for Apple to hit.
Select your app
Select 'App Information'
Look for 'Subscription Status URL' on the lower right of the screen. If you have the proper permissions, you can set a url for the Apple server to POST to when new purchase has been made.

Pancho
- 4,099
- 1
- 21
- 32
-
Thank you very much. Regarding the server to server notifications; I added Subscription Status URL, and when I test the Default ATS Secure Connection with the command "nscurl --ats-diagnostics
", it is passed. But I did not get any notification to my nginx server from Appstore. Any idea on how to debug this issue? (The URL I gave points to a PHP file) – Kulakshi Nov 05 '20 at 16:14 -
You can read more about app store server notifications here https://developer.apple.com/documentation/appstoreservernotifications/enabling_app_store_server_notifications – Pancho Nov 05 '20 at 16:23
-
I read this and tried server to server method before trying to send the receipt to the server and verify it as a workaround. No idea why notifications fail. The configurations are matched with their guidelines. Thanks anyway for the help :) – Kulakshi Nov 05 '20 at 16:31
-
there is a difference between sandbox and production. If you're making purchases in development this has to be pointing to their sandbox environment and for real in app purchases Apple will switch it automatically to use their production servers. Take a look on how to test this in sandbox as this is what appears to have gone wrong in your case. – Pancho Nov 05 '20 at 16:44
-
Do you mean the receipt verification URL? – Kulakshi Nov 06 '20 at 03:51