App Store server notification for testing purposes?

Hello,

So far we have been validating the receipts via a nightly script. But the proper way would be to handle App Store server notification to automate the process.

But our App is already live for sometime, if we'd set that URL we would get all production notifications sent straight to our test server.

But first we need to test it with a sandbox environment. How can we do this? There should have been two URLs in the application info, one for production and one for sandbox.

Any advice please?

If you've registered for server-to-server notifications, then notifications should happen for both production and sandbox In-App Purchases. When the server receives the notifications, there will be an "environment" field set to either "Production" or "Sandbox" for your process to distinguish the purchase environment.

If your process is not receiving server-to-server notification for sandbox purchases, then this would be a bug report.

rich kubota developer technical support CoreOS/Hardware/MFI

Hello, @houmie

In order to manage server-to-server notifications I suggest you visit the following URL:

https://developer.apple.com/videos/play/wwdc2020/10671

and to download the code in resource "Determining Service Entitlement on the Server", in URL

https://developer.apple.com/documentation/storekit/in-app_purchase/subscriptions_and_offers/determining_service_entitlement_on_the_server

Analyzing the code you can get an idea of how you can get a summary of the history of the purchases, and get the latest state of the last one hundred of purchased subscription.

Kind regards, Oscar

Hello, @houmie.

In my previous message I forgot to mention that in the source code (the example is based in NodeJS) you can see how to connect with the verifyReceipt URL if you need to validate the contents of a received notification. The code manages automatically the sandbox or production environment: it calls to the production URL, and if the response says that the receipt is for sandbox, it will call to the sandbox verifyReceipt URL. It is interesting to analyze the actions of the processReceiptJSON function, and the auxiliary ones used by processReceiptJSON.

Kind regards, Oscar

App Store server notification for testing purposes?
 
 
Q