How to setup test and production environments for apple in purchase notification

Viewed 150

I want apple send purchase notification of real user to my production environment after the app is published.

And meanwhile, i need apple to send purchase notification of sandbox test account to my test environment.

However, i can only config one URL in apple connect from apple iap server-to-server notification.

I try to receive notification in my production environment, and parse the payload of the notification, if it is a notification of sandbox, then deliver it to test environment. but i do not think this is a good way, because my test environment rely on my production environment.

How can i fix this problem?

2 Answers

Unfortunately, you can configure only one URL. But, why not do the separation on your own. Create both the production and test environment and add a component configured as a receiver for the notifications from Apple, which then forward the notification based on the environment property to the right environment.

Update 2021: Later this year Apple will introduce an improved server notification section in AppStoreConnect, where you will be able to configure one URL for production and another one for sandbox notifications.

In the notification response, there is a parameter called the environment(Response body). With that, you can identify whether the notification should be handled in the production server or in the test server. I would suggest having a common URL and according to the environment[Sandbox, PROD] redirect to the corresponding handler.

Related