我希望苹果在应用发布后将真实用户的购买通知发送到我的生产环境。
同时,我需要苹果将沙盒测试帐户的购买通知发送到我的测试环境。
但是,我只能在 apple iap 服务器到服务器通知的 apple connect 中配置一个 URL。
我尝试在我的生产环境中接收通知,并解析通知的有效负载,如果是沙箱通知,则将其传递到测试环境。但我不认为这是一个好方法,因为我的测试环境依赖于我的生产环境。
我该如何解决这个问题?
最佳答案
App Store 不提供不同环境的 URL。你必须用自己的单台服务器检查从App Store收到的消息的环境字段,区分是用于测试还是生产,然后将其发送回每个服务器。
引用自 Apple 文档:
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.
关于ios - 如何为apple iap 服务器到服务器通知设置测试和生产环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59189487/