如何为苹果IAP服务器端通知设置测试和生产环境

4

我希望在应用程序发布后,苹果能够向我的生产环境发送真实用户的购买通知。

同时,我需要苹果向我的测试环境发送沙盒测试账户的购买通知。

然而,我只能在苹果连接中配置一个URL从苹果IAP服务器到服务器的通知。

我尝试在生产环境接收通知,并解析通知的有效负载,如果它是沙盒通知,则将其传递到测试环境。但我认为这不是一个好的方法,因为我的测试环境依赖于生产环境。

我该如何解决这个问题?

1个回答

0

App Store不提供不同环境的URL。您需要检查从App Store接收到的消息的环境字段,使用自己的单个服务器区分测试或生产环境,并将其发送回每个服务器。

引用自苹果文档:

If you enabled App Store server notifications for your app, test your logic for
transactions in the sandbox environment. To determine if a notification for a 
subscription event occurred in the test environment, check whether the value of 
the environment field in the server-to-server JSON responseBody object equals 
Sandbox.

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接